sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
41235e4f98d160e382f25e35ceef0a75919ba885d2a16f89cb24b8c1fb28b301 | Python | 1,363 | 45 | from ..neuralnodes import utils, NL, func
import numpy as np
from .params import Params
def run_model(stim: np.ndarray, p: Params, fs: float = 1_000, verbose_output: bool = False, return_dict: bool = False):
# --- STIMULUS -----------------------------------------------------------
try:
p = Params.fro... |
d0568f53c61d4d4408cab0dd30c5188a9b4933d5c24deff8495739884eee3536 | Python | 1,363 | 40 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
e8cc7255d7d7c48af435ad9814c1bb7558e954f918f6e697e9be8410f3ea95b9 | Python | 1,363 | 45 | import sys
import glob
#get runid
runid=glob.glob("./wandb/latest-run/run-*.wandb")[0].split('-')[-1].replace('.wandb','')
metric_file=sys.argv[1]
metric_file = metric_file.strip()
fobj = open(metric_file)
header=fobj.readline().strip().split(' ')
header.append('Threshold')
train=fobj.readline().stri... |
260841c81df39a11db722b60e505fe2ae2ff6759ccdd1ab556d65f97b54dcbde | Python | 1,364 | 46 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
6390113ebc0987180701a29edfa0663074ebb8e9d150ca695363d0b60e0ec388 | Python | 1,364 | 40 | import torch
import torch.nn as nn
import math
class lap_ablation_no_adjust_module(torch.nn.Module):
def __init__(self, channels=None):
super(lap_ablation_no_adjust_module, self).__init__()
self.learn_scale = nn.Parameter(torch.ones([1, channels, 1, 1]))
self.learn_width = nn.Parameter(to... |
735893f46ebeafe09a9434d311a5ebc1e12238f7d584b7417a35c707af676654 | Python | 1,364 | 43 | """
Created on 12/09/2019
@author: Gonzalo D. Maso Talou
"""
import numpy as np
class CentralPaddingFilter(object):
"""
Filter that pads a given image to the size specified in the contructor. If target width or height are smaller that the original
images remains as is. Case the image could n... |
ff8deb5aedb2885823b4aa7fa711b81e7883e53aaa817d23ee583fda8a568549 | Python | 1,364 | 36 | # SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL
#
# SPDX-License-Identifier: AGPL-3.0-or-later
'''
Computing simplex counts and edge participation for manipulated connectomes
Author(s): Daniela Egas S.
Last modified: 12.2023
'''
import conntility
from connalysis.network import topology
import pandas as pd
... |
13b6fe26e04767e51f61a60bdcbb256b377d5fc8fb214b6ee0b12bf4ef52c30c | Python | 1,365 | 39 | """Radial-basis kernels used by multiple subsystems.
The Wendland C² kernel provides the CCF boundary editor's interactive
*brush falloff* (``regtools.ccf_boundary_editor.viewer_items.BrushCurveItem``):
when the user drags a point on a contour, samples within the brush radius
are displaced with this weighting so ... |
17089890ddc1ac0d92f152b36dc0ee917ebdc2ef35e8ae76baeb17219317bfe1 | Python | 1,365 | 46 | #! /usr/bin/env python
from lab.parser import Parser
parser = Parser()
def check_planner_exit_reason(content, props):
error = props.get('error')
if error != 'none' and error != 'timeout' and error != 'out-of-memory':
print 'error: %s' % error
return
out_of_time = False
out_of_memory ... |
1fb41e81162a47057d6d21f07eb670b4ff9ce6ab1682d3d59ce0ef8a1938af10 | Python | 1,365 | 44 | """
Training and evaluation settings
"""
from constants import REYMULTICLASSIFIER, REYREGRESSOR
config = dict()
"""
dirs with specific multilabel classification models
"""
config[REYMULTICLASSIFIER] = {
'non-aug': {
'78 100': '../spaceml-results/data_78x100-seed_1/final/rey-multilabel-classifier',
... |
9408f65bdb6aef35c4184886dace1b71af6e2407f3c4b296faa6272f77ac139f | Python | 1,365 | 45 | import pytest
import torch
from elasticai.creator.arithmetic import FxpParams
from elasticai.creator.nn import fixed_point as nn_creator
@pytest.mark.parametrize(
"total_bits, frac_bits, init",
[
(3, 2, 0.25),
(4, 2, 0.25),
(4, 3, 0.25),
(6, 4, 0.5),
(8, 5, 0.125),
... |
e6e3773315476ea4b12be5aafc82ec664bc497d262d70fad7740005bdd5bdaa6 | Python | 1,365 | 28 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
e91a4cf4865db20631e6da44b193789843cd5e25f6dd71c68f0014314935e0e7 | Python | 1,365 | 57 | from ..annotations.base import BaseAnnotation
class Label2D(BaseAnnotation):
"""
Show a label in 2D space (viewport / render)
Attributes
----------
text: str
Text to be displayed
location: tuple[float, float]
Normalized coordinates (0.0 - 1.0) of the postion in viewport / ren... |
38863c16da822dcaaed91bde8ff9a9c6c0fb778f265c5b7a7ba427cd304d7f0e | Python | 1,366 | 45 | import pytest
import torch
from elasticai.creator.arithmetic import FxpParams
from elasticai.creator.nn import fixed_point as nn_creator
@pytest.mark.parametrize(
"total_bits, frac_bits, init",
[
(3, 2, 0.25),
(4, 2, 0.25),
(4, 3, 0.25),
(6, 4, 0.5),
(8, 5, 0.125),
... |
14f9925c9bf03dedb20edc897af3f68f92886b188047e900ac9e1996e9aa8673 | Python | 1,367 | 50 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Utility functions
Created on Thu Jun 13 2019
@author: jmagraner
"""
# %%
import autograd.numpy as np
### Orthogonalise output matrix ###
def apply_orth_transform(params,specs):
# NOTE: more careful implementation needed!
# This implementation does not support... |
6c2456f3ec0a9730b18dbb9e311abb60a3fc5ec554900ceface6b60edabb1037 | Python | 1,367 | 41 | import torch
import torch.nn as nn
import math
class lap_ablation_no_scale_module(torch.nn.Module):
def __init__(self, channels=None):
super(lap_ablation_no_scale_module, self).__init__()
self.learn_adjust = nn.Parameter(torch.zeros([1, channels, 1, 1]))
self.learn_width = nn.Parameter(to... |
1d782ed3b67ebb60473da65bb58675c272315387e5aac9adec2ca493139e8baa | Python | 1,368 | 45 | """Utilities"""
import pandas as pd
from hed.schema.hed_schema_constants import HedKey, HedSectionKey
def flatten_schema(hed_schema, skip_non_tag=False):
"""Returns a 3-column dataframe representing a schema.
Parameters:
hed_schema (HedSchema): the schema to flatten
skip_non_tag (bool): Ski... |
1d7d5c0654a9198083e3a79f3f30303413148f81f70bd7e78515560a19c58f17 | Python | 1,368 | 52 | # -*- coding: utf-8 -*-
"""
Created on Fri May 4 15:37:21 2018
@author: Francois
"""
import cv2
import numpy as np
def Contrast_Brightness(image,contrast,brightness):
alpha=(contrast+50)/50
beta=brightness
print('number of channel',len(cv2.split(image)))
b, g, r = cv2.split(image)
... |
7da655a30b76e7f51f60fe56b64eedd627dd43d5f5908cb68740b527b19eae4a | Python | 1,368 | 54 | """Generate a synthetic network using the LFR benchmark model."""
import sys
import numpy as np
import pandas as pd
from scipy import sparse
import lfr
if "snakemake" in sys.modules:
params = snakemake.params["parameters"]
N = float(params["n"])
k = float(params["k"])
tau = float(params["tau"])
t... |
250487ae4409ad496ed5ac020ad372c2289ed98982a9e0fb9c81b4bb74d22180 | Python | 1,370 | 40 | import torch
import torch.nn as nn
import math
class lap_ablation_no_width_module(torch.nn.Module):
def __init__(self, channels=None):
super(lap_ablation_no_width_module, self).__init__()
self.learn_adjust = nn.Parameter(torch.zeros([1, channels, 1, 1]))
self.learn_scale = nn.Parameter(tor... |
4af0280ba73bbf6012594659fa62241581ccda6cb89844625d4b09881e025609 | Python | 1,370 | 32 | # Since Gaussian16 and LmodA packages are commercial software and Closed Source Software respectively,
# this test model won't work on other systems.
# However we offer our Local vibrational mode calculation package upon request for academic porposes.
import os
import sys
sys.path.append("/scratch/users/amahamadakalap... |
c64eca7e3f4888f1a97f06b2f097e9e6bba5efe8db5b458862209403738ce59c | Python | 1,370 | 20 | """posthoc_at_rest_who_2026-09-28.py (post hoc, descriptive). AT_REST input A: which cells fire > 50 Hz at rest under the
laboratory prior (F4) and the published signs (S)? Same run as AT_REST (seed 31), broken down by cell class."""
import sys; sys.path.insert(0, 'D:/eucys/03-CODE')
import numpy as np, pandas as pd
im... |
342881a7ca85c4e00be79fb238b88f0497ce526c7279638548de11c1f5427d3f | Python | 1,371 | 39 | """This module provides wrapper functions for the FSL `FNIRTFILEUTILS
<https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FNIRT/>`_ tool
.. autosummary::
:nosignatures:
fnirtfileutils
"""
import fsl.utils.assertions as asrt
from fsl.wrappers import wrapperutils as wutils
@wutils.fileOrImage('src', 'ref', 'out', 'jac')
@... |
4b3c2c45c4f23647a03852daf8b88e194dc4af7e6ed9658b67dbecd45ec49021 | Python | 1,371 | 44 | import sys
import os
import struct
import numpy as np
NB_NEURONS_WAVE_MONITOR = 16
DT = 2**-5
# PLOT_LIB = "matplot"
PLOT_LIB = "plotext"
fpath = sys.argv[1]
plot_time_ms = int(sys.argv[2])
sel_nrn = list(map(int, sys.argv[3].split(',')))
dtype = np.dtype(np.float32)
nb_samples = in... |
4c514b98aca4c9565819a5937bc7290aeaca742ed4b15bd8f9c1b68c1869acf1 | Python | 1,371 | 44 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
fc2fa3e2041d21f8686a86eaa9876ff35a0d01ac2a96eebd461fab8b8722e8de | Python | 1,371 | 44 | #!/usr/bin/env/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# import params.CoraLpParams
# import params.CollabHyperbolicParams
# import params.DDEuclideanParams... |
895f3a333cc6864ae2e7dae45c0afb6a6d3174e2470c117a9d417cd08546895d | Python | 1,373 | 52 | import numpy as np
import time
import threading
import RPi.GPIO as GPIO
class Co2_Controller:
def __init__(self, is_values, ought_values):
self.is_values = is_values
self.ought_values = ought_values
self.on_interval = np.array([0.05, 0.1, 0.1, 0.1, 0.2])
self.off_min_interval ... |
acc867e381da15fff38366a464a578d9402589bd7cd5451ec87cc7a9666a85ac | Python | 1,374 | 44 | import yaml
class ParsedConfig:
def __init__(self, yaml_file):
with open(yaml_file, 'r') as f:
config = yaml.load(f, Loader=yaml.FullLoader)
self.batch_size = config.get('BATCH_SIZE')
self.optimizer = config.get('OPTIMIZER')
self.initial_learning_rate = config.get('IN... |
b5752f18089a542db630841342456f5079f20d6b1aea32ab8673efae21ac2705 | Python | 1,374 | 67 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
bb760c9621fd024117b3bf838f8c77571dd5bf3f45c19414d0373d62e1fd1099 | Python | 1,374 | 45 | from __future__ import annotations
from shutil import which
import pytest
from quacc import get_settings
pytestmark = pytest.mark.skipif(
which(str(get_settings().QCHEM_CMD)) is None, reason="QChem not installed"
)
from pathlib import Path
from ase.build import molecule
from quacc.recipes.qchem.core import re... |
027c86f41ef0d2fc819b3b8487f2c247f0fd1f6fe559ddfaf7293c9d009c2025 | Python | 1,378 | 50 | from .cocotb_func import (
all_within_tolerance,
error_count_outside_tolerance,
is_mae_within_tolerance,
)
from .cocotb_prepare import build_report_folder_and_testdata, read_testdata
from .cocotb_pytest import CocotbTestFixture, cocotb_test_fixture, eai_testbench
from .cocotb_runner import (
check_cocot... |
2ce74f54573b0fef2e3945e1c077fe902705f16fc1b3376246b2c03fc1b070fb | Python | 1,378 | 41 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2021 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : image_enhancer.py
# Author : Yufeng Liu
# Date : 2021-05-17
# Description :
#
#================... |
d622476050dec5bab157ae778924d52db01fd6f74ef52dd32d6698a1de3ce1f7 | Python | 1,378 | 47 | import sys
from pybioshell.core.data.io import Pdb
from pybioshell.core.calc.structural import evaluate_phi, evaluate_psi, ContactMap
import time
if len(sys.argv) < 3 :
print("""
Calculates contact map for a number of models from a single PDB file and prints how often any two residues
are in contact
USAGE:
p... |
8f243aa1e6c0c7fb9999ba5d937910a9b38863dbbd81293e64134cb303cea8fb | Python | 1,379 | 39 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
971517a9f353571f38cdfead7166e42d91c0e9654146d251a5f780f59aa16806 | Python | 1,379 | 61 | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import logging
from pip._vendor import requests
from pip._vendor.cachecontrol.adapter import CacheControlAdapter
from pip._vendor.cachecontrol.cache import DictCache
from pip._vendor.cachecontrol.controller import logger
from argpars... |
cda79479d0a68ab2d1160a1c2a907a861a83e91af0bf51b65e1e7fa8ef51aaa3 | Python | 1,379 | 35 | """Closing a window with an in-flight worker must drain it (no QThread abort)."""
import time
import pytest
@pytest.fixture(scope="module")
def _qapp():
try:
from PySide6.QtWidgets import QApplication
except Exception as exc: # pragma: no cover
pytest.skip(f"PySide6 unavailable:... |
0ee474123a1d3e434a15845e788f91a132324ab4091c707d6db3ed240d0c5484 | Python | 1,380 | 37 | import torch
class CoherenceNetLoss():
# Loss function module for Coherence Net
def __init__(self):
self.criterion = torch.nn.L1Loss()
def stream_loss(self, outputs, targets):
"""Calculate Loss for the streams and stream 1 integerator
Args:
outputs: Tensor... |
3a03e3aab978d056c8d399192b6758714ba68fd0ec8d9eeecded9aab2651944c | Python | 1,380 | 43 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
fa40d7e01a20908c16cf52da2b9f8a6b445075f45893b84bdf2c1036edc45558 | Python | 1,380 | 37 | try:
# Python 3.x
from builtins import open as file_open
except ImportError:
# Python 2.x
from codecs import open as file_open
import options
from . import lisp_parser
from . import parsing_functions
def parse_pddl_file(type, filename):
try:
# The builtin open function is shadowed by thi... |
1a01fc18ad6fc725f31e8e519de4097ca7ca7ab1148416401408987645955eb1 | Python | 1,381 | 43 | """
Created on Tue Aug 3 23:24:39 2021
@author: Haotian Teng
"""
import numpy as np
import os
import sys
import argparse
def main(args):
chunks = []
counts = []
for i in args.input:
try:
c = np.load(i)
except FileNotFoundError:
print("Didn't find %s, skip."%(i))
... |
8f80b6f8620880838fe7c593d725e4aea0130f4cf526cdc3ca9533446bb8b111 | Python | 1,381 | 60 | """
Segmentation and analysis meta-data
"""
from __future__ import unicode_literals
#######################################################
#
# Experiment description and file names
#
# identifier
identifier = 'project_ctrl_5'
# experimental condition
treatment = 'ctrl'
# further info (optional)
animal_nr = 'a30p ... |
aa953eb2df3deda16ae3f58fd16fa735991cc1169f837a1f93b7b23bb665b1a1 | Python | 1,381 | 42 | import matplotlib.pyplot as plt
import re
with open('logs_baseline.txt', 'r') as f:
data = f.read()
train_loss = re.findall(r" loss: (0\.\d+)", data)
val_loss = re.findall(r" val_loss: (0\.\d+)", data)
train_loss = list(map(lambda x : float(x), train_loss))[:48]
val_loss = list(map(lambda x : float(x), val_los... |
cf400d39cea24e555101c98b184c5f05839abaa96ab2ab7c8fea2820e5758714 | Python | 1,381 | 46 | import json
import os
import operator
import pdb
import matplotlib.pyplot as plt
import numpy as np
#import _init_paths
#from config.defaults import get_cfg
#from utils.ava_eval_helper import read_labelmap
#from datasets.ava_dataset import Ava
def main(json_file):
with open('categories_count.json', 'r') as fb:
... |
1a7ddd89ecbf951922a038081f0aa014c261ecd5937ffd7db07953b1e9b059d8 | Python | 1,382 | 43 | __version__ = "0.0.1"
try:
#Model
import model.KuramotoClassFor
import model.parserConfig
#analysis
import analysis.frequency
import analysis.synchronization
import analysis.cluster
import analysis.connectivityMatrices
import analysis.Wavelets
#simulations
from simulations.testModel import RunKuramotoFor
f... |
7b4aa191d081f0c1abc07f0dc3a9dd5ad04db6921225deb16411bb9820e354cf | Python | 1,382 | 46 | from ..neuralnodes import utils, NL, func
import numpy as np
from .params import Params
def run_model(stim: np.ndarray, p: Params, fs: float = 1_000, verbose_output: bool = False, return_dict: bool = False):
# --- STIMULUS -----------------------------------------------------------
try:
p = Params.fr... |
c70483fd9e5fb13d0e8d28302e02bc21fa936be3ffa201842fa66e6c8cd21779 | Python | 1,382 | 37 | import json
from pathlib import Path
from shutil import rmtree
from elasticai.creator.file_generation import find_project_root
def build_report_folder_and_testdata(dut_name: str, testdata: dict) -> Path:
"""Building the test/simulation folder which contains the test data and hardware design for testing in cocotb... |
5d6ba519e241e4a3b2913c405c9d6462dd0bfd86a9922908ae6555def6fdecce | Python | 1,383 | 38 | """
STATUS BAR FUNCTION
This file contains the function necessary for drawing the status bar.
"""
import sys
bar_length = 50
fill_character = '█'
empty_character = ' '
def draw_batch_status_bar(progress_for_executions, executions_max, run_for):
print('-' * 30)
for key, value in progress_for_executions.item... |
7399729ddf3457df16bf3cddc93ea55e880eb4df65ec964aff39607ef72571f7 | Python | 1,383 | 45 | """
Optuna example that optimizes a classifier configuration for cancer dataset using LightGBM tuner.
In this example, we optimize the validation log loss of cancer detection.
"""
import numpy as np
import optuna.integration.lightgbm as lgb
from lightgbm import early_stopping
from lightgbm import log_evaluation
imp... |
7d15af9f3d5a2336c8abd029de00240198031faa28e73c4cad4e99395072ab42 | Python | 1,383 | 43 | # Copyright 2016 Étienne Bersac
# Copyright 2016 Julien Danjou
# Copyright 2016 Joshua Harlow
# Copyright 2013-2014 Ray Holder
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... |
c09421227f8c83d27ca35e83f0f986a71178413b3800eacd87c83d8ac95d28a0 | Python | 1,383 | 39 | import tensorflow.compat.v1 as tf
import numpy as np
from skimage.transform import resize
import os
PB_FILE = os.path.join(os.path.dirname(__file__), 'pretrained_weights', 'brainextractor.pb')
class Extractor:
def __init__(self):
self.SIZE = 128
self.load_pb()
def load_pb(self):
grap... |
48f73df86d5c530df7ec5573b2c4fecbf6567b567675087203109147b4e2d04e | Python | 1,384 | 45 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys
sys.path.insert(0, os.path.abspath('../../cellmincer/'))
# -- Project information --------------... |
9db5952347e52e9ada4c57a8a51855d9e267a55168719131e21c8e5d2fb2a88a | Python | 1,385 | 53 | import os
import PIL
from napari_plugin_engine import napari_hook_implementation
PIL.Image.MAX_IMAGE_PIXELS = 93312000000
def read_swc(path):
from neurom import load_morphology
import numpy as np
from .fMOST_datasets import datasets
m = load_morphology(path)
print("Morphology loaded")
data ... |
3ff8ee5c0a788f41c69234cd772da3525f79e6c6f1dee704cea5d057a8c0dd1b | Python | 1,386 | 48 | # set QT_API environment variable
import os
os.environ["QT_API"] = "pyqt5"
import qtpy
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
import control.widgets as widgets
import control.camera as camera
import control.core as core
import control.m... |
b822c33f86a7b8b39c70d93f5eb48903f67645eec3a3fbd32f5b753f619ce2af | Python | 1,386 | 49 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
c5c4dcf944b3731b7f65ea69a3d8430a481e5f986270ea4309a8855206902479 | Python | 1,386 | 47 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Atchuth Naveen
Code developed at UC Irvine.
command line executable to convert a directory of tif images
to a nifti image stacked along a user-specified axis
call as: python tif_to_nii.py img_dir out_dir {--channel channel}
(append optional arguments to the ... |
b4649793fbfe21999b8f5180cc78adf00de460840c882a55b0215fb02fbf289e | Python | 1,387 | 69 | from types import TracebackType
from typing import IO, Iterable, Iterator, List, Optional, Type
class NullFile(IO[str]):
def close(self) -> None:
pass
def isatty(self) -> bool:
return False
def read(self, __n: int = 1) -> str:
return ""
def readable(self) -> bool:
re... |
c66fc97fefb90a2b19d623798713fb107b3a89080f30d3521650d39199e1e21a | Python | 1,387 | 40 | import torch
from torch import nn
class conv_block(nn.Module):
def __init__(self, in_channels, out_channels, **kwargs):
super(conv_block, self).__init__()
self.relu = nn.ReLU()
self.conv = nn.Conv2d(in_channels, out_channels, **kwargs)
self.batchnorm = nn.BatchNorm2d(out_cha... |
1531daf948553957fcb93bf6ab480c90e4eedd0fc89cea55fc8247dec05291a3 | Python | 1,389 | 44 | import os
import requests
import zipfile
from appdirs import user_data_dir
FILE_ID = "1oyknOulq_j0w9kzOKKIHdTLo5HphT99h"
PRETRAINED_MODEL_DIR = user_data_dir("cddd")
def download_file_from_google_drive(id, destination):
URL = "https://docs.google.com/uc?export=download"
session = requests.Session()
resp... |
4455f1d4e91ce9ba38e5d6c16fd8db4413b15153ff883f7730d0071e76f1ac1e | Python | 1,389 | 26 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
4e15b146c56b27b56cc0bdf39f2de642fb25b33611159cec30061aeb612ae1cb | Python | 1,389 | 23 | from lib2to3.pgen2.token import AWAIT
import os
import shutil
path = "/home/zhaomengdi/Project/eworm/Celegans_as_deep_net_net/chemotaxis_net/components/param/cell"
files= os.listdir(path)
AWAL_list = ["AWAL","AWAR","AWCL","AWCR"]
AIYL_list = ["AIYL","AIYR","AIAL","AIAR","AIZL","AIZR","RIBL","RIBR","AIBL","AIBR","SAAD... |
ab44a472bb41502adcb66f1c2a863e3166775540d7ea07bcd92642094129e977 | Python | 1,389 | 40 | import torch
from elasticai.creator.arithmetic import FxpArithmetic, FxpParams
from tests.system_tests.helper.parse_tensors_to_bytearray import (
parse_bytearray_to_fxp_tensor,
parse_fxp_tensor_to_bytearray,
)
def test_tensors_to_bytearray():
torch.manual_seed(0)
total_bits = 8
frac_bits = 2
... |
1a233c04a1a696322e00336f72211f29df5473f4792cf9575979ea63efa917d2 | Python | 1,392 | 37 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
DIR = os.path.dirname(os.path.abspath(__file__))
BENCHMARKS_DI... |
502c5641b8619356b9ebd6dfb8b8f5dbf6cd943fb91afdce9a5f97fcedcd6804 | Python | 1,392 | 53 | import os
import logging
import numpy as np
__all__ = ["DatabaseUtils"]
log = logging.getLogger(__name__)
class DatabaseUtils:
"""
Basic functions
"""
def __init__(self) -> None:
pass
def generate_name(self, olddb: str) -> str:
"""
Add "_new" to file string
"""
... |
64e81a7ff02b20a389367461f22a5233a92c1f8bff8841bc64be74f6e5915bee | Python | 1,392 | 45 | #!/home/dingml/anaconda3/envs/expressBert39/bin/python3
import json
import warnings
from collections import OrderedDict
from textwrap import indent
import numpy as np
import torch
import os
import argparse
def make_directory(in_dir):
if os.path.isfile(in_dir):
warnings.warn("{} is a regular file".format(in... |
b01a60e8dbd86640617169b9515f3525e9454b445411182bd796d23e275c9fa6 | Python | 1,392 | 43 | import sys, math
from pybioshell.core.data.io import find_pdb
from pybioshell.core.calc.structural import SaturatedRing6Geometry
if len(sys.argv) < 3 :
print("""
Validates a hexagonal saturated ring, defined by 6 atoms.
USAGE:
python3 validate_saturated_ring6.py input.pdb ligand _atom1_ _atom2_ _atom3_ _ato... |
b02e82119f8f48f9e67bad058825ba6e8aef2d6e0896f31ce46b89e4e38c7d88 | Python | 1,392 | 43 | import torch
from elasticai.creator.nn.float.math_operations import MathOperations
from tests.tensor_test_case import assertTensorEqual
def test_quantize() -> None:
arithmetics = MathOperations(mantissa_bits=3, exponent_bits=1)
a = torch.tensor([-3.0, -2.0, -1.69, -0.2, 0.2, 1.69, 2.0, 3.0])
assertTensor... |
b06e7bce751b47612340e2eb4b267094f1b774fc56fbcb44f00cbb5e79e249e6 | Python | 1,392 | 45 | from __future__ import annotations
import pytest
pytest.importorskip("psi4")
from ase.build import molecule
from quacc.recipes.psi4.core import static_job
def test_static(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
atoms = molecule("H2")
output = static_job(atoms, charge=0, spin_multiplicity=... |
29fbeb2ab3890d3a783fef96258ae767135d8f67e4f1d1a6cbfa2a927c6d78bb | Python | 1,393 | 40 | """
Simple wrapper for freesurfer's mri_info function that returns a numpy matrix
Run:
python mri_info.py <in_file> <transformtype>
to generate transformation matrices given a freesurfer orig.mgz file
"""
import os
import subprocess
import numpy as np
from .config import paths
import logging
log = logging.getLog... |
801bf3831149b909367ab185fc5bb3a8dfad55ef3745f471445fe1cb57c4ef6f | Python | 1,393 | 35 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
982b22995ef18b6f79d7288032806c7f973a18a59aef2f14c3506792a2db8157 | Python | 1,393 | 57 | """ exceptions.py
Exceptions used for error handling.
"""
class DataBaseError(Exception):
"""_summary_
Args:
Exception (Exception): Base python exception.
"""
def __init__(self, error):
Exception.__init__(self, error)
self.error = error
class GeneIDException(Exception):
... |
81e3c62471344bec600d98aa8516e767e2792346a3a2c4e14e79cb6d0c0cf460 | Python | 1,394 | 41 | import nibabel as nib
import numpy as np
import os
import csv
import argparse
def calculate_lesion_volume(mask_path):
try:
# Load the NIfTI file
nifti_img = nib.load(mask_path)
data = nifti_img.get_fdata()
header = nifti_img.header
# Calculate voxel volume in mm³
... |
f82c8296da61a6563f70be6c91090f8740fe6415dc8894b528b59f6a3e9aafe0 | Python | 1,394 | 31 | #
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... |
064c98d2d28aa28d2193fe462302318f6d888fc4f7f3d4629507b7db5a3a36b9 | Python | 1,395 | 41 | import nibabel as nib
import numpy as np
import os
import csv
import argparse
def calculate_lesion_volume(mask_path):
try:
# Load the NIfTI file
nifti_img = nib.load(mask_path)
data = nifti_img.get_fdata()
header = nifti_img.header
# Calculate voxel volume in mm³
... |
5d76f192d3f1c3a6c3e692200e77bf232a874b8b5d0c2010a7fcd3aaa3541202 | Python | 1,395 | 54 | from pytest import approx
from wonambi import Dataset
from wonambi.detect.slowwave import DetectSlowWave
from .paths import psg_file
d = Dataset(psg_file)
data = d.read_data(chan=('EEG Fpz-Cz', 'EEG Pz-Oz'), begtime=27930, endtime=27960)
def test_detect_slowwave_Massimini2004():
detsw = DetectSlowWave()
de... |
fb8819985b1cd993609e1010115f97c900bc2262bc890b89b07ba879a91a7990 | Python | 1,395 | 48 | """
Tests for plotting.
"""
import unittest
from os.path import abspath, curdir, join
from pathlib import Path
import pyensembl
from agfusion import database, model
data = pyensembl.EnsemblRelease(84, "mouse")
db = database.AGFusionDB(abspath(join(curdir, "agfusion.mus_musculus.84.db")))
db.build = "mus_musculus_84"... |
fd93cd4092e061827916e39a9f844660d1218885a992b247c624eedd23535635 | Python | 1,395 | 65 | import os
import pandas as pd
from calvados.cfg import Config, Job, Components
import subprocess
import numpy as np
from argparse import ArgumentParser
cwd = os.getcwd()
sysname = 'polyR30'
# set the side length of the cubic box
L = 30
# set the saving interval (number of integration steps)
N_save = 1000
# set fina... |
41cd864e72e1368352a5aab0b88a050f35367d3d6844ea31ba00e4454b8bc671 | Python | 1,396 | 43 | """Simulation parameters
------------------------
A dictionary with parameters defining the simulation.
"""
import os
sim_dict = {
# print the time progress. This should only be used when the simulation
# is run on a local machine.
'print_time': False,
# file name for node ids
'fname_nodeids': '... |
504f2d8b43cfc33dc57667a58d4137994e9b9782600e2edbc21983a4762067de | Python | 1,396 | 17 | """DCV_BLIND_TEST.py 2026-09-24. Unblinds 06-OUTPUT/dcv_blind_scores.csv with tmp/em/dcv_key_SEALED.csv and runs the
pre-registered paired test (04-NOTES/PREREG-2026-09-24c-DCV-BLIND.md). Output 06-OUTPUT/dcv_blind_test.txt"""
import pandas as pd, numpy as np
from scipy.stats import wilcoxon
R = 'D:/eucys'; L = []
def ... |
7a42135b771af720cae514517d33c9c2a38c13158bb5a4430e7e7bb4b30f4557 | Python | 1,396 | 38 | """Pint registry from SMART and related convenience function"""
__all__ = ["unit", "unit_to_quantity", "quantity_to_unit"]
import pint
unit = pint.UnitRegistry()
unit.define("molecule = mol/6.022140857e23")
unit.define("nM_10 = 10*nM")
unit.define("nM_100 = 100*nM")
unit.define("uM_10 = 10*uM")
unit.define("uM_100 = ... |
07a1e96464f287db7b04eb74c43e39a275aaa0142e1c38a648c0208c7e3ef3b1 | Python | 1,397 | 33 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
1eaedd77ce626f39e1d8c7c9097557b2b2498887305a78ee130c68e555aaa416 | Python | 1,397 | 38 | import numpy as np
from utils import dir_stats, pickle_dump
from joblib import Parallel, delayed
from joblib.externals.loky import set_loky_pickler
set_loky_pickler('pickle')
import os
os.environ['OPENBLAS_NUM_THREADS'] = "1"
os.environ['MKL_NUM_THREADS'] = "1"
NNULLS = 10000
drosophila = np.load('../../data/origi... |
91328a5cd9ef46f312f15e9cdcb2bfa2c9c68f28e8440749f935ddbcf1523fda | Python | 1,397 | 45 | #!/bin/env python
"""Quick Python script to process guest file names in the GDCC and Isaacs cases and generate IUPAC names for the compounds."""
from openeye.oechem import *
from openeye.oeiupac import *
import os
# Parameters for processing
dirnames = [ '../GDCC_and_guests', '../Isaacs_clip' ]
prefixes = [ 'GDCC', ... |
43595aece7959456aea65c5170f651968ab419e22c00230bd56e2fd0adfb2b43 | Python | 1,398 | 69 | toolBtn = """
QPushButton {
background-color: rgb(255,255,255);
border:1px solid rgb(0,32,87);
border-radius: 4px;
color: rgb(0,32,87);
height: 23px;
margin-left: 2px;
margin-right: 2px;
padding: 0 5px 0 5px;
font: bold;
}
QPushButton:hover{
background-color: rgb... |
b4f215c637facfd26be282bfa642809f78f4e3bf469308781d780bc964672530 | Python | 1,398 | 53 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward.suites import suite_satisficing_with_ipc11
from downward.configs import default_configs_satisficing
from downward.reports.scatter import ScatterPlotReport
import common_setup
REVS = ["issue214-base", "issue214-v2"]
CONFIGS = default_configs_satisficing()
... |
d7871502573bc473829b8285f1ce8d385e9be22cd09f9f3d0f355394a00acc39 | Python | 1,398 | 37 | import os
from pathlib import Path
import subprocess
import sys
import textwrap
import unittest
class TestUtilsImports(unittest.TestCase):
def run_fresh(self, body):
root = Path(__file__).resolve().parents[2]
result = subprocess.run(
[sys.executable, '-c', textwrap.dedent(body)], cwd=r... |
12626ab04b1ff88e77664afdbdf703cc2311fe4c08168e98b3000f6a9f30f0ce | Python | 1,399 | 34 | import os
import sys
import pandas as pd
kappa_num=pd.read_csv('kappa.txt')
n_jobs = len(kappa)
init = 0 #starts at 0
src = '/data/PNAI/Maximilia/scripts/pred_RMSD/trtrRnaseP'
workingdir = '/data/PNAI/Maximilia/CafeMol/Yun_Tzai/trtrRnaseP/cafemol/analysis'
base = '/data/PNAI/Maximilia/CafeMol/Yun_Tzai/trtrRnaseP/cafe... |
4ba80f655d3945a4e5542dfa89de18bc567bf137ef9201e2c8aa4b82fd55b02e | Python | 1,400 | 36 | ### adapted from Adriano Fonzino et al.
## (ENSG00000160710) ADAR
## (ENSG00000197381) ADARB1
## (ENSG00000185736) ADARB2
import sys, os
print('Sample\tGene\tTPM')
f=open('/media/Scratch_SSD_Voyager/sammi/RNA_editing/fc_v1/counts_all_tpm.txt')
tpm_list={}
for i in f:
if i.startswith('Geneid'):
h=i.strip().split... |
22296558f53caf1fb07a8b6460238f7bb0d69c7ba83b81b037843c80a9fbcf59 | Python | 1,401 | 17 | """posthoc_audit_where_2026-09-30.py (descriptive, post hoc). The brain audit found three igniting senses on the published
file: smell (DL5), hygrosensation and thermosensation. Do the stimulated hygro- and thermosensory neurons feed the same
circuit? Share of their output synapses onto antennal-lobe neurons (ALPN, ALL... |
3affa67a6a2d9d065d219d52d2c7fc1bbaaa891806f5e4c0e7ec700a75013a74 | Python | 1,401 | 50 | # coding=utf-8
# Copyright 2026 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
8e408224c7237aee44426c5da8cd2505faeb50a10590ebe32bb5b36058411ac4 | Python | 1,401 | 40 | import pandas as pd
import numpy as np
from tqdm import tqdm
import h5py
df = pd.read_csv('test_sequences.txt', delimiter = "\t", header=None)
df.head()
df.columns = ['sequences', 'expression']
df['sequences'] = df['sequences'].astype('str')
mask = (df['sequences'].str.len() == 110)
df = df.loc[mask]
df = df[~df["sequ... |
f8a48598385360b64563e7e72284207961c71d7fc9683d0c51d2ae8660c18aef | Python | 1,401 | 44 | import torch
from scipy.io import loadmat
from .base import AtomsData
from ..utils import progress_bar
from ase import Atoms
class QM7b(AtomsData):
def __init__(self, root:str, cutoff:float=4.0, device:str="cpu") -> None:
self.cutoff = cutoff
self.device = device
super().__init__(root)
... |
0b82fa94c900ba83c53eb691f3a2544367438828313aa92a1e1ed5bd90cb8b65 | Python | 1,403 | 51 | #!/usr/bin/python
# GK September 2023
# Scripts for running methyl decoupling DNNs
#
# note in methyl_decoup_funcs model paths need to be set
# requires nmrpipe to be installed to work
import methyl_decoup_funcs
import os
# first do nmrproc.com
# -> test.ft2 results
# then do first recon_3d
# -> dl_d... |
0fe41dc6a5e0d1dc58d4a57b3f93a96762d3fe923851b1c70f0b2140aae2f3ac | Python | 1,404 | 45 | import argparse
import pandas as pd
import dataset as module_dataset
import datasets_manager as module_datasets_manager
from parse_config import ConfigParser
from runner import Tester
from utils import set_random_seed
SEED = 1126
set_random_seed(SEED)
def main(config):
Datasets = {project_id: config.init_obj(
... |
aceeae3053bd2285cd4ca6796c9b59c43150d1337bcc62e6d27986ee5728dca0 | Python | 1,404 | 46 | """
Optuna example showcasing the new Optuna Terminator feature.
This code visualizes Optuna Terminator using the 'plot_terminator_improvement'
function. It graphically depicts cross-validation errors and terminator
improvement reported during optimization.
The example optimizes hyperparameters of a RandomForestClass... |
c02d1fe75bc3f4cf942bba3c69c92fb017fbcc482707c23950d23ade37d7b48a | Python | 1,404 | 30 | import pandas as pd
from typing import Tuple
from torch.utils.data import DataLoader
from src.dataloaders.semantic_transforms_dataset import STDataset
def get_dataloader(data_root: str,
labels: pd.DataFrame,
label_type: str,
batch_size: int,
... |
730273f24f3e021f87a747372adfe76828cab2267535ca32d4f387663995d539 | Python | 1,405 | 49 | # Node group ".map_bond_type" (GeometryNodeTree), dumped by nodebpy.assets.dump_library.
# Rebuild the library with nodebpy.assets.build_library (nodebpy build).
# Shared by several assets, which import it; not an asset itself.
# _build_group() is the source of truth: the docstring, __init__ and accessors are regenerat... |
77916ce172e088cd26be7f2fbf60d01e982337f329ab24c1cb5593c485bac079 | Python | 1,405 | 50 | import anndata
import numpy as np
import pandas as pd
import pytest
from anndata import AnnData
from scipy import sparse
import pertpy as pt
NUM_CELLS = 100
NUM_GENES = 100
NUM_CELLS_PER_ID = NUM_CELLS // 4
pt_moa = pt.md.Moa()
@pytest.fixture
def adata() -> AnnData:
rng = np.random.default_rng(1)
X = rng... |
7690cb36548f2c48d78875c890c28b4872ddf58c33aa7107cf1c0d722bb12bfb | Python | 1,406 | 41 | import os.path
from ckg.graphdb_builder import builder_utils
#########################################
# HUGO Gene Nomenclature #
#########################################
def parser(databases_directory, download=True):
config = builder_utils.get_config(config_name="hgncConfig.yml", data_type='datab... |
8207af708f4574338f0f9aad20569544baa07d9e068864838d3f92101fc04d5d | Python | 1,406 | 55 | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 5 08:35:26 2023
@author: danie
"""
import os
import sys
import cobra
from pathlib import Path
from dnngior.reaction_class import Reaction
from dnngior.MSEED_compounds import Compounds
from dnngior.MSEED_reactions import Reactions
path = os.path.dirname(os.path.abspath... |
bb506eeb93020fc1ba7ead7fecbf085f56482bccd059fad60c838bbdabb1779c | Python | 1,406 | 43 | from __future__ import print_function,division
from posixpath import split
import sys
import os
import pandas as pd
import numpy as np
import argparse
import topaz.utils.star as star
from topaz.utils.files import split_particle_file
name = 'split'
help = 'split particle file containing coordinates for multiple micro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.