sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
df96f2bcb802c422a4a82f62666f0e7e0472c2cf3ea4de816520947dceca17b7
Python
376
14
#!/usr/bin/env python import sys from setuptools import setup import versioneer SETUP_REQUIRES = ['setuptools >= 30.3.0'] SETUP_REQUIRES += ['wheel'] if 'bdist_wheel' in sys.argv else [] if __name__ == "__main__": setup(name='phys2bids', setup_requires=SETUP_REQUIRES, version=versioneer.get_v...
0f87f1570ee2b3bce0ace9d535b30e11970b5554e059374e14c1c1fc03fd090f
Python
377
15
from torch.utils.ffi import _wrap_function from ._nms import lib as _lib, ffi as _ffi __all__ = [] def _import_symbols(locals): for symbol in dir(_lib): fn = getattr(_lib, symbol) if callable(fn): locals[symbol] = _wrap_function(fn, _ffi) else: locals[symbol] = fn ...
77dc92f3ecf2cad249c0f106fcb046acd2b4b54c7481fe4d8167634609cc720b
Python
377
16
import numpy from Cython.Build import cythonize from setuptools import Extension, setup # Define Cython extensions ext_modules = [ Extension( "polychrom._polymer_math", ["polychrom/_polymer_math.pyx", "polychrom/__polymer_math.cpp"], include_dirs=[numpy.get_include()], ) ] setup( e...
b12616be01603e4452c272c6e169d836d6ea490dd38dbd44ecb7aecdcec7d6e2
Python
377
16
""" https://stackoverflow.com/questions/40748687/python-api-rate-limiting-how-to-limit-api-calls-globally """ from ratelimit import limits, sleep_and_retry # calls per minute CALLS = 300 RATE_LIMIT = 60 #CALLS = 1 #RATE_LIMIT = 10 @sleep_and_retry @limits(calls=CALLS, period=RATE_LIMIT) def check_limit(): """ Emp...
21b0d65aecd46f0cb710efc244dd8f6d7afd40f5ef0259f2f7e9391c01bb6be5
Python
378
17
from dataclasses import dataclass from ontoportal_client import EcoPortalClient from oaklib.implementations.ontoportal.ontoportal_implementation_base import ( OntoPortalImplementationBase, ) @dataclass class EcoPortalImplementation(OntoPortalImplementationBase): """ Implementation over ecoportal endpoin...
c42232cb0427418a5c5d1fe39896cd2a5b870c7d61475da66b76bc978a8f9b91
Python
378
14
""" © 2022, ETH Zurich """ from rescoss_logp_ml.utils import PROC_DATA_PATH, FOLDER_NAMES import pickle import os def load_dataset(dataset, feature_type): savepath = os.path.join(PROC_DATA_PATH, FOLDER_NAMES[dataset], f"{dataset}_{feature_type}.pkl",) with open(savepath, "rb") as handle: df, features_...
caf18dd9a8e0d4e8afeeb51a029b176ac39d0d399fc6ac24c0516df29106e607
Python
378
17
from dataclasses import dataclass from ontoportal_client import MatPortalClient from oaklib.implementations.ontoportal.ontoportal_implementation_base import ( OntoPortalImplementationBase, ) @dataclass class MatPortalImplementation(OntoPortalImplementationBase): """ Implementation over matportal endpoin...
38b0a6c38cd1eb5e0ee4e3340c449525f2067c1eefea92ea28474f5283610db5
Python
379
10
from .base_bbox_coder import BaseBBoxCoder from .delta_xywh_bbox_coder import DeltaXYWHBBoxCoder from .legacy_delta_xywh_bbox_coder import LegacyDeltaXYWHBBoxCoder from .pseudo_bbox_coder import PseudoBBoxCoder from .tblr_bbox_coder import TBLRBBoxCoder __all__ = [ 'BaseBBoxCoder', 'PseudoBBoxCoder', 'DeltaXYWHBBo...
65d3568b8df58cb044402a7461216f4bd564884c09ff7e938fd6c14a00a98d5e
Python
379
7
from .er import erdos_renyi_test, erdos_renyi_test_paired from .fisher_exact_nonunity import fisher_exact_nonunity from .sbm import fit_sbm, stochastic_block_test, stochastic_block_test_paired from .degree import degree_test from .binomial import binom_2samp, binom_2samp_paired from .combine import combine_pvalues from...
1ac85d818d646d122f7888a3b596cab9e582c1b19ac3c65c3180719a6c02f233
Python
380
17
from setuptools import setup setup( name='dni-pytorch', version='0.1.0', author='Piotr Kozakowski', author_email='kozak000@gmail.com', url='https://github.com/koz4k/dni-pytorch', description=( 'Decoupled Neural Interfaces using Synthetic Gradients for PyTorch' ), py_modules=['d...
560dbe92721fb034a9511233730e8b09f8cdd8aa6587dce931f18a4f833cfa1e
Python
380
10
try: from .fused_act import FusedLeakyReLU, fused_leaky_relu from .upfirdn2d import upfirdn2d # print('Using custom CUDA kernels') except Exception as e: # print(str(e)) # print('There was something wrong with the CUDA kernels') # print('Reverting to native PyTorch implementation') from .na...
b29f1b6d87131917999ba1e7fde15a725a0a61c30205e4ee4ef7e67fe9b96c2a
Python
380
18
""" https://stackoverflow.com/questions/40748687/python-api-rate-limiting-how-to-limit-api-calls-globally """ from ratelimit import limits, sleep_and_retry # calls per minute CALLS = 300 RATE_LIMIT = 60 # CALLS = 1 # RATE_LIMIT = 10 @sleep_and_retry @limits(calls=CALLS, period=RATE_LIMIT) def check_limit(): """...
ea643edd9b5b7775494461837031ad420aaeba8e380610ef53809da51e3c142b
Python
380
19
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Main script to run the AxoID GUI. Created on Wed Jun 19 11:39:58 2019 @author: nicolas """ import os.path import sys # Add parent folder to path in order to access `axoid` sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from axoid....
55a2a1b502a1dab6c180dbf636c81640fc8cdbf240c245d667b021e291a0ac3e
Python
381
7
#### MODIFY THESE 2 LINES #### motion_compensation_path = "/home/user/talabot/motion_compensation/run_motion_compensation.sh" # path to run_motion_computation.sh matlab_path = "/usr/local/MATLAB/R2019a" # path to a MATLAB release ############################# # Command imported by run_axoid.py script. Do not modify....
7a26af14cf1b955c193af1827866b2e1d003cf4dd7ff38175b088fdec3b05d52
Python
381
16
from .fno import TFNO, FNO, ConditionalFNO # only import SFNO if torch_harmonics is built locally try: from .sfno import SFNO from .local_no import LocalNO except: pass from .uno import UNO from .uqno import UQNO from .fnogno import FNOGNO from .gino import GINO from .codano import CODANO from .rno import ...
aaeed4002ac7de2cd783089523540b08c5ea9a29d690caf14f059444a5abbfbc
Python
381
16
# Copyright (c) Open-MMLab. All rights reserved. import json from .base import BaseFileHandler class JsonHandler(BaseFileHandler): def load_from_fileobj(self, file): return json.load(file) def dump_to_fileobj(self, obj, file, **kwargs): json.dump(obj, file, **kwargs) def dump_to_str(se...
fe6f06b28e187b5e28f31fdd0fcfbe305e8b6c10e80c49c56efaff68800da416
Python
381
11
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from numpy.testing import assert_array_equal from eelbrain import load from eelbrain.testing import requires_pyarrow, file_path @requires_pyarrow def test_feather_io(): ds = load.feather(file_path('mini.feather')) assert_array_equal(ds['participant'], [...
1e4b7aee89728ba9b26a99abb93a680bd69539c028a3bec78d9f072798c02e00
Python
382
15
from torch.utils.ffi import _wrap_function from ._roi_crop import lib as _lib, ffi as _ffi __all__ = [] def _import_symbols(locals): for symbol in dir(_lib): fn = getattr(_lib, symbol) if callable(fn): locals[symbol] = _wrap_function(fn, _ffi) else: locals[symbol] =...
62c50c1a06dbb66dbab0d38f1a8c866fa7d898c1be5f3cac0a6a392ef9543ecc
Python
382
8
custom_params = {} custom_params['cache_dir'] = 'nn_models/sc05/cache/' custom_params['model_dir'] = 'nn_models/sc05/all_feat/model_data/' custom_params['desc_dir'] = 'output/sc05/all_feat/model_data/' custom_params['gif_eval_out'] = 'nn_models/sc05/gif_eval/' custom_params['min_sc_filt'] = 0.5 custom_params['max_sc_fi...
b8b2cd3130fe50845585a3ecb27d2d8062081d495f1022fa240ee06bdc61a3c0
Python
382
21
"""Local adapter""" import os def get_device_id(): device_id = os.getenv('DEVICE_ID', '0') return int(device_id) def get_device_num(): device_num = os.getenv('RANK_SIZE', '1') return int(device_num) def get_rank_id(): global_rank_id = os.getenv('RANK_ID', '0') return int(gl...
c8a6fd2f38cd3bd9dde411556c11b56cf655240e26eca2284094f51b667f623c
Python
382
17
from dataclasses import dataclass from ontoportal_client import AgroPortalClient from oaklib.implementations.ontoportal.ontoportal_implementation_base import ( OntoPortalImplementationBase, ) @dataclass class AgroPortalImplementation(OntoPortalImplementationBase): """ Implementation over agroportal endp...
31dc6cfb74ca979e64e2e4af5d0d94e52490cb36134eba22755d0b96d04ffe7e
Python
383
15
from torch.utils.ffi import _wrap_function from ._roi_align import lib as _lib, ffi as _ffi __all__ = [] def _import_symbols(locals): for symbol in dir(_lib): fn = getattr(_lib, symbol) if callable(fn): locals[symbol] = _wrap_function(fn, _ffi) else: locals[symbol] ...
345a707b987fdb9b060bb5549e58040bedf6b937e5262f3bf6195c9b2dc26064
Python
383
16
default_graph_info = { "edges_per_point": 10, "scale_types": ["step_std"], "edge_method": "geom_causal", "data_type": "no_features", } default_ds_params = { "dim":2, "noise_range": (0.02, 0.05), "RW_types": ["fBM", "LW", "sBM", "OU", "CTRW"], "length_range": (7, 35), "logdiffusion_r...
04d9314d791e2c7bf28e62a20df1242f7894804d57f906d5cc97767b3a986b66
Python
385
16
#!/usr/bin/env python import sys from setuptools import setup import versioneer SETUP_REQUIRES = ["setuptools >= 30.3.0"] SETUP_REQUIRES += ["wheel"] if "bdist_wheel" in sys.argv else [] if __name__ == "__main__": setup( name="phys2bids", setup_requires=SETUP_REQUIRES, version=versioneer....
1e68f5c65293aec9cf26bbcd5b4f09ba5bca035793362725fa2a7cf4b88c1c16
Python
385
15
from torch.utils.ffi import _wrap_function from ._roi_pooling import lib as _lib, ffi as _ffi __all__ = [] def _import_symbols(locals): for symbol in dir(_lib): fn = getattr(_lib, symbol) if callable(fn): locals[symbol] = _wrap_function(fn, _ffi) else: locals[symbol...
f175de40371d37d54a56f3bf5f5b94223a3aa277e31576ebb30a7c987c54a1b1
Python
385
17
#!/usr/bin/env python import sys from setuptools import setup import versioneer SETUP_REQUIRES = ["setuptools >= 65.5.1"] SETUP_REQUIRES += ["wheel"] if "bdist_wheel" in sys.argv else [] if __name__ == "__main__": setup( name="phys2cvr", setup_requires=SETUP_REQUIRES, version=versioneer....
35a2489b4ef80312725b12d33145203c2682fd6706db0fdbd8a29503ebc80883
Python
386
17
# physical constants and unit convertion accepted_units = [ "ev", "kcalmol", ] calories_to_joule = 4.184 hartree_to_ev = 27.211386245988 hartree_to_kcalmol = 627.5094740631 ev_to_kcalmol = hartree_to_kcalmol / hartree_to_ev kcalmol_to_ev = hartree_to_ev / hartree_to_kcalmol # Physical constants k_kcalmolkel...
232d8d8ebea927287c6c0b846ddf4cb89c5eb04a372b02578ad2a9d51c2cf72a
Python
387
17
#!/usr/bin/env python3 import glob import os import sys if len(sys.argv) != 2: print ("Usage: {} <noises-dir>".format(sys.argv[0])) raise SystemExit(1) for line in glob.glob("{}/*.wav".format(sys.argv[1])): fname = os.path.basename(line.strip()) print ("--noise-id {} --noise-type point-source " ...
2e8ac96ccfbdc3174f7e961966482e89107688ffc16324af0b5050692dfccf45
Python
389
15
import torch from src.dataset import LargeRandomSampler class TestLargeRandomSampler: test_data_path = "data/test_data/" def test_initilization(self): dataset = range(1000) generator = torch.Generator() generator.manual_seed(14) sampler = LargeRandomSampler( datas...
be1767b32c2c75dae8121368003ec3757f553f695d4d232356e04713d4cdd8dc
Python
390
12
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import os def get_config_root_path(): ''' Path to configs for unit tests ''' # cur_file_dir is root/tests/env_tests cur_file_dir = os.path.dirname(os.path.abspath(os.path.realpath(__file__))) ret = os.path.dirname(os.path.dirname...
d3372b39f78062beb346ab9c9263a61c1b898b6c67be4b4ec28030c7860d860f
Python
390
11
"""Weighted Matthews correlation coefficient — vendored component. Vendored from https://github.com/fabiom91/MCC_Weighted at tag v1.0.0 (commit ed55752f5af1bf704d11b7159904fa7a55857227). See README.md in this directory for provenance and licence. """ from .weighted_metrics import Weighted_metrics, weights # noqa: F4...
e2b2282cb679e09a8074ea88cdd72eb0bc3828ca8723fc2aecc924983082b023
Python
390
18
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" def Color(color, sel_name): """PyMOL color a chain""" from pymol import cmd cmd.color(color=color, selection=sel_name) # c...
6f13318c6a4bad6f81e30874849b1d7f5c9aede57ffb6561a027859e1a865bfb
Python
391
18
"""A recipe with a faulty regexp for testing preprocessor functionality.""" UNACCEPTED_CHARS = r"[^a-zåäöA-ZÅÄÖ \n]" REGEXPS = [ # Remove punctuation (r"[.,!?':]", r""), # Faulty regexp with an unmatched parenthesis (r"(the", r""), # Strip any remaining extra spaces (r"^\s+", r""), (r"\s+"...
7f6a3b21f47b60dee48da6b8175c8d1868e62a14d7302cba816320593659ac1a
Python
391
14
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Variational Animal Motion Embedding 0.1 Toolbox © K. Luxem & P. Bauer, Department of Cellular Neuroscience Leibniz Institute for Neurobiology, Magdeburg, Germany https://github.com/LINCellularNeuroscience/VAME Licensed under GNU General Public License v3.0 """ import ...
04ad17082ccbe9ee80e92d9855e5e02f1ce95972e7b437287ebd3a359728109a
Python
393
16
import PyQt5 from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * class PopupMessage(QMessageBox): def __init__(self, parent=None): QMessageBox.__init__(self) self.setWindowTitle("Caution!") self.setText('Histological image: is oversized.') button = ...
e3fdb9e74d67ea948f648b7d3938bd8dc6fd57058ab2e1b595acec198c4f15a1
Python
393
18
project = 'QUIT' copyright = '2018-, Tobias Wood' author = 'Tobias Wood' language = 'en' version = '' release = '' extensions = [ 'sphinx.ext.mathjax', ] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' exclude_patterns = ['_build', 'External', 'Thumbs.db', '.DS_Store'] pygments_style =...
1d6b1e7deecedb426fc23a9821f45c7a6df758505dff14fc97ba36eef1283040
Python
395
21
""" __init__.py Created by: Martin Sicho On: 06.04.22, 16:51 """ import torch from rdkit import rdBase from .about import VERSION rdBase.DisableLog('rdApp.error') rdBase.DisableLog('rdApp.info') rdBase.DisableLog('rdApp.warning') torch.set_num_threads(1) DEFAULT_DEVICE = torch.device('cuda') if torch.cuda.is_avail...
362f4cf0144e45efbd814d9807fdcb16a82b1aa0bf12fc9c963989ea1b760a06
Python
395
14
import vedo verts = [(50,50,50), (70,40,50), (50,40,80), (80,70,50)] faces = [(0,1,2), (2,1,3), (1,0,3)] # (the first triangle face is formed by vertex 0, 1 and 2) # Build the polygonal Mesh object: mesh = vedo.Mesh([verts, faces]) mesh.backColor('violet').lineColor('tomato').lineWidth(2) labs = mesh.labels('id') p...
081df935aeb5a60a2ea42d1d5c9d48729543bc4b0568ff64ca75ea239259840f
Python
397
18
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import os from eelbrain import * import mne PATH = 'test-ica.fif' ds = datasets.get_mne_sample() ds['epochs'] = ds['epochs'].pick_types('mag') if os.path.exists(PATH): ica = mne.preprocessing.read_ica(PATH) else: ica = mne.preprocessing.ICA(0.95) ...
4a2317fea80fbfc5d43fb12962d0cd5999c09254271a0c2ab6185b5bd42d5dd5
Python
398
19
import sys class Logger(object): def __init__(self, filename="logfile.txt"): super().__init__() self.terminal = sys.stdout self.log = open(filename, "a") def write(self, message): self.terminal.write(message) self.log.write(message) def flush(self): """"""...
4e803adc89da604caa02bf950eb1f65eafc3d2666145319f6b4f1858135fce8f
Python
399
17
__author__ = "Johannes Köster" __copyright__ = "Copyright 2016, Johannes Köster" __email__ = "johannes.koester@protonmail.com" __license__ = "MIT" from snakemake.shell import shell log = snakemake.log_fmt_shell() shell( "picard CollectInsertSizeMetrics {snakemake.params} " "INPUT={snakemake.input} OUTPUT=...
7422287728056aa8388a1ccc5dd810d8d7914dae43642efbe86a774fdec8e4d3
Python
399
19
__author__ = "Jan Forster" __copyright__ = "Copyright 2019, Jan Forster" __email__ = "j.forster@dkfz.de" __license__ = "MIT" from snakemake.shell import shell ## Extract arguments extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=True, stderr=True) shell( "( bedtools merge" " {e...
d31f9e5f90f2e49ca7ef564ec519c5422bcceecd8a86397d81f069e35a68b286
Python
399
12
# Copyright (c) Open-MMLab. All rights reserved. from .base import LoggerHook from .mlflow import MlflowLoggerHook from .pavi import PaviLoggerHook from .tensorboard import TensorboardLoggerHook from .text import TextLoggerHook from .wandb import WandbLoggerHook __all__ = [ 'LoggerHook', 'MlflowLoggerHook', 'PaviL...
06e3d47f61d9959270e9082d5364bc8d4d1d6d9c657abb953663a606487a329e
Python
400
17
import unittest from deeprank_gnn.DataSet import HDF5DataSet, DivideDataSet, PreCluster from deeprank_gnn.tools.BSA import BSA class TestBSA(unittest.TestCase): def setUp(self): self.bsa = BSA('tests/data/pdb/1ATN/1ATN_1w.pdb') def test_structure(self): self.bsa.get_structure() self....
b07e7bf1a4f1315306343bb8e472bfeaf0ad42b153f56e74fa2375b5c0e4a6eb
Python
400
16
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """ Miscellaneous utility functions """ import torch def cat(tensors, dim=0): """ Efficient version of torch.cat that avoids a copy if there is only a single element in a list """ assert isinstance(tensors, (list, tuple)) if ...
f5160fa77b5419012ffd0e182edef847d4e5356aa6e735b10b7f1f3d778613d2
Python
400
12
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from maskrcnn_benchmark.utils.registry import Registry BACKBONES = Registry() RPN_HEADS = Registry() ROI_BOX_FEATURE_EXTRACTORS = Registry() ROI_BOX_PREDICTOR = Registry() ROI_KEYPOINT_FEATURE_EXTRACTORS = Registry() ROI_KEYPOINT_PREDICTOR = Regi...
0b4a7f864865595f37280adb9395487eb2602e7185bc687b0553e504507462fd
Python
401
18
config = { 'EXP_NAME': "PCovNet_phase2_covid", 'EXP_PHASE': "phase2", 'EXP_GROUP': "covid", 'AUGMENT_DATA': True, 'ONLY_NIGHT_DATA': False, 'MODEL_DIR': None, 'TRAIN_VAE': True, 'TRAIN_LSTM': True, 'LEN_WIN': 8, 'N_WIN': 2, 'LATENT_DIM': 16, 'BATCH_SIZE': 64, 'VAL_SPL...
5b42c5ae1258e679ab05ee9d3505ae9e95c1bfa8d224241ed0efdf3ff0cc4415
Python
402
21
import gzip import sys ## converts SNPMappings.txt.gz to bed infile = sys.argv[1] # SNPMappings.txt.gz file outfile = sys.argv[2] # bed out fh = gzip.open(infile,'rt') fho = open(outfile,'w') for line in fh: # dostuff # 1_10497_C_T_b37 line = line.rstrip() elems = line.split("\t") fho.write("chr"+elems[0]+"\t...
80e712d13b385116ec444a5974ecce68e5321fa142107fc4241d3a476cf3f8d6
Python
402
15
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" class Select: def chain(self, chain_name, chains="A+B+C+D+E+F+G+H+I+J+K"): """PyMOL select a chain""" from pymol import ...
b483d2df3d16e000cdfbd1ccdd37668ec6e9e31b7d715d8efd46bd5f77b935e9
Python
402
20
from .segment import ( SegmentationStrategy, CircularityFilter, PlaneWiseSegmentation, ROIFilter, PostProcessingStep, SmoothROIBoundaries, MergeOverlapping, SparseROIsFromMasks, ) from .stica import STICA from .ca1pc import ( PlaneCA1PC, AffinityMatrixCA1PC, ) from .normcut impor...
298613c846a8c47f340dab6e73fe2f3fab18b705f553764276ed9329637831a1
Python
403
12
import torchvision.transforms.functional as tvf def differentiable_clip_preprocess_from_stylegan(img, clip_visual_size): img = tvf.resize( img, size=clip_visual_size, interpolation=tvf.InterpolationMode.BICUBIC ) img = (img + 1) / 2 # -1~1 to 0~1 img = tvf.normalize( img, (0.48145466,...
bea82bfa2d876af5105cb02e392b6517ddfa7b2a4b1ea824c15f90e562089eaf
Python
403
15
from .bfp import BFP from .fpn import FPN from .fpn_carafe import FPN_CARAFE from .hrfpn import HRFPN from .nas_fpn import NASFPN from .nasfcos_fpn import NASFCOS_FPN from .pafpn import PAFPN from .rfp import RFP from .caps_pafpn import CAPS_PAFPN from .Caps_fpn import Caps_FPN __all__ = [ 'FPN', 'BFP', 'HRFPN', '...
ab10dea23daf31272905e66f460ed6e1c7777af044b810efb9bef4485214ec43
Python
404
18
import mesh import FBEM radii = list(range(1, 5)) def run_simulation(folder, size): sphere = mesh.sphere_create('sphere', radius=size, velocity=(1, 0, 0), grid=3) FBEM.run(sphere, folder, cnd_path='input2018.cnd') def run_sequential(radii): for radius in radii: folder = 'spheres/expected/radius...
14f103f956a3bc21a620684c2d726b3317e68cbf414d360d3108f6216f89e939
Python
407
15
from snakemake.shell import shell import os.path from os import path log = snakemake.log_fmt_shell(stdout=True, stderr=True) extra = snakemake.params.get("extra", "") family = snakemake.wildcards.family dir = os.path.dirname(snakemake.output[0]) prefix = path.join(dir, family) # qc/peddy/412 shell( "peddy {sna...
27e79cae63c95ce9ef11981a71485acdb0f4e4cf97d4e8827e17194d30588823
Python
407
15
import numpy as np import numpy.testing as npt import AFQ.data.fetch as afd import nibabel as nib def test_read_roi(): aff1 = np.eye(4) template = nib.Nifti1Image(np.ones((10, 10, 10)), aff1) aff2 = aff1[:] aff2[0, 0] = -1 roi = nib.Nifti1Image(np.zeros((10, 10, 10)), aff2) img = afd.read_res...
c9f6efcd89b4163524996ce2e3b6fa3f7fa7db08fe1d76dae799bafccc2a5e65
Python
407
16
"""Build fast_coco_eval library""" import sys from setuptools import setup from pybind11.setup_helpers import Pybind11Extension args = ["-O2"] if sys.platform == "win32" else ["-O3", "-std=c++14", "-g", "-Wno-reorder"] ext_modules = [ Pybind11Extension( name="fast_coco_eval", sources=['cocoeval/co...
c873e8683031dbbc7db357d755404f045fc16368a5d2549b85b7c9c7f078a3b5
Python
409
12
from .base import * # from .default_localizer import DefaultLocalizer from .drift_corrector import CorrelationDriftCorrector, BeadDriftCorrector from .trackpy_tracker import ConservativeTracker from .window_percentile import WindowPercentileFilter from .quot_localizer import ( MaxLikelihoodLocalizer, BaseDetec...
cae1136f9faa7acebaedcefa639503ea43670008066ff65a97ef7b508a5d31fc
Python
409
12
# optimizer #optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001) optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001) #weihgt_decay L2 正则化的权重衰减系数 optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='linear', warmup_iter...
13aa87ad1777342f020924189dec4d359a4e67c6b74c38bb764b0b7cf5ba9432
Python
410
12
"""Device adapter for ModelArts""" from src.model_utils.config import config if config.enable_modelarts: from src.model_utils.moxing_adapter import get_device_id, get_device_num, get_rank_id, get_job_id else: from src.model_utils.local_adapter import get_device_id, get_device_num, get_rank_id, get_job_...
b73f7bee9689dc24688a1890aed6a06d18bfb031d361d318c499b3724001f64a
Python
411
18
__author__ = "David Laehnemann, Victoria Sack" __copyright__ = "Copyright 2018, David Laehnemann, Victoria Sack" __email__ = "david.laehnemann@hhu.de" __license__ = "MIT" import os from snakemake.shell import shell prefix = os.path.splitext(snakemake.output[0])[0] shell( "samtools bam2fq {snakemake.params} " ...
f6cc60e7c6fc884b9d424a895e3a15f1de79bc69af68b6ed1096736fbe222aa9
Python
411
17
__author__ = "Johannes Köster" __copyright__ = "Copyright 2016, Johannes Köster" __email__ = "johannes.koester@protonmail.com" __license__ = "MIT" from snakemake.shell import shell log = snakemake.log_fmt_shell() shell( "picard CollectAlignmentSummaryMetrics {snakemake.params} " "INPUT={snakemake.input.ba...
ffd10b17ebf944e9aaecc8b6d1a770a15e425f5e312a3f5bf3d8bff9e2b7c0e6
Python
413
24
# -*- coding: utf-8 -*- #!/usr/bin/env python3 # -*- coding: utf-8 -*- import .boxer @click.command() def boxer(): pass @boxer.command("create") def create(): boxer = boxer.BoxerModel(); boxer.save("boxer.h5") @boxer.command("train") def train(): boxer = boxer.BoxerModel(); boxer.load("boxer...
e9e484b6b00b5fad6ca81a49a9281cb65951f0da4312203454625e4a8fa03a8d
Python
414
14
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Variational Animal Motion Embedding 0.1 Toolbox © K. Luxem & P. Bauer, Department of Cellular Neuroscience Leibniz Institute for Neurobiology, Magdeburg, Germany https://github.com/LINCellularNeuroscience/VAME Licensed under GNU General Public License v3.0 """ import ...
2151d73f88e26e2ae57a7040ca0d7ae157e2779dd19c4bfa34cbf6fb23454932
Python
417
24
""" collectors Created by: Martin Sicho On: 14.07.22, 10:58 """ from drugex.parallel.interfaces import ListCollector class ListExtend(ListCollector): def __init__(self): self.items = [] def __call__(self, result): self.items.extend(result) def getList(self): return self.items ...
13f1e4634cfc53140bdee03a87f6c15352fb04d6727ff076e3a534139b5953b3
Python
418
18
import cv2 import numpy as np import paddle def cv2paddle(img): img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img = np.transpose(img, (2, 0, 1)) img = paddle.to_tensor(img, dtype='float32').unsqueeze(axis=0) img = img / 255.0 return img def paddle2cv(img): img = img.numpy()[0] img = np.trans...
57ef4e876066b8315094a4c2625ee4f83d9f133a448d1a1b94918972a08f111f
Python
418
12
from snakemake.shell import shell log = snakemake.log_fmt_shell(stdout=True, stderr=True, append=True) family = snakemake.wildcards.family outdir = snakemake.params.outdir tool = snakemake.params.tool pythonpath = tool.replace("bin", "") python = " export PYTHONPATH={pythonpath}; " mity = " {tool}/mity call --prefix...
0c98f8b36ca119256a58325df9dd284167f913f36a90233e5617d7fb45c87eb1
Python
419
12
from .explanation import Explanation, EnclosingSubgraph from .nx_conversion import khop_subgraph_nx, to_networkx_conv from .random import check_random_state from .misc import make_node_ref, distance, node_mask_from_edge_mask, top_k_mask from .misc import threshold_mask, match_edge_presence, edge_mask_from_node_mask...
0d91adf7add7d3a59f24af9f4ff2fd25f6a47544838eac702ebd1f9d4c94258e
Python
419
12
import os from nilearn import plotting from brainNetwork.util.path import get_data_dir # Load example surface from the left hemisphere f_name = "lh.gray_surface.rsl.gii" example_surface = os.path.join(get_data_dir(), "template_surfaces", f_name) view = plotting.plot_surf_contours(surf_mesh = example_surface, ...
565a990a99db7aeed512c4ad331249411f6cbb0e2c159f8e8fc5fa00b9af6990
Python
419
17
import os import pickle def pkl_save(path, obj, **kwargs): """Saves a serializable obj to a pickle (.pkl) file.""" path = os.path.splitext(path)[0] + '.pkl' with open(path, 'wb') as outfile: pickle.dump(obj, outfile, **kwargs) def pkl_load(path, **kwargs): """Loads a pickled obj from path...
a315084ebbb54b2a9b677d97992d493bdada70c2d00c94399feb90a62082e22a
Python
419
18
import gzip import glob import sys f=sys.argv[1] outfile=sys.argv[2] with gzip.open(f,'rt') as input_file, gzip.open(outfile,'wt') as out: x = 0 out.write(input_file.readline()) for line in input_file: x += 1 if x % 1000000 == 0: print(x) fdr...
427315ad5af6d07c4585f5b2ea0271c13abdd21f82719c8e43b3eaddace8bc14
Python
422
17
import pandas as pd import sys def add_new_cluster_information(input, cluster, output): pdf = pd.read_csv(input, header=0, index_col=0) cdf = pd.read_csv(cluster, header=0) df = pdf.merge(cdf, how='left', left_index=True, right_index=True) if __name__ == "__main__": assert len(sys.argv) >= 5 i...
27b9fc48f42e97f81b5676ba67657f53e918eff1462df594ac5c797f7ef8a608
Python
423
17
import os def create_dirs(dirs): """ dirs - a list of directories to create if these directories are not found :param dirs: :return exit_code: 0:success -1:failed """ try: for dir_ in dirs: if not os.path.exists(dir_): os.makedirs(dir_) return 0 ...
f1e82556931ca76cec54ef8e9ac06842c67d6baed07f4acd8a3601ea7ce0b72d
Python
423
18
import sys class Logger(object): """ This class enables logging to both stdout and text file """ def __init__(self, logfile_name, terminal=sys.stdout): self.terminal = terminal self.log = open(logfile_name, "w") def write(self, message): self.terminal.write(message) ...
a38ed4e02bd0c2bf96ed6db75048e0633bd4a6a0baf2195350b9eb1f05310ab4
Python
424
21
import os import sys f = open('log/parameters.txt', 'r') lines = f.readlines() bestf1 = 0 dicts = {} for line in lines: conts = line.strip().split(',') k = int(conts[0].split(':')[1][1:]) p = float(conts[1].split(':')[1][1:]) alpha = float(conts[2].split(':')[1][1:]) f1 = float(conts[3].split(':')[1][1:]) dict...
31f2773df4fcf1a061f1bf9ae7f0a954d7e851a471631fa8b44c66486834d767
Python
425
24
from dataclasses import dataclass from oaklib.implementations.sparql.abstract_sparql_implementation import AbstractSparqlImplementation from oaklib.interfaces.owl_interface import OwlInterface @dataclass class OwleryImplementation(OwlInterface, AbstractSparqlImplementation): """ Wraps an owlery endpoint ...
5ae2f9866ae8c7c5d645e284cd37575a296b19ce6ea5c70ad184baa1fb76a792
Python
427
21
import os import json class Predictor: def __init__(self): self.batch_size = 128 os.system("chmod +x work") def predict(self, content): f = open("input.txt", "w") print(json.dumps(content, ensure_ascii=True), file=f) f.close() os.system("./work") f = ...
d0c9f634ee3f80302253cee7209a2d36a21d139b609da2e2d589f2cbc1137221
Python
427
19
from dataclasses import dataclass from oaklib.implementations.sparql.abstract_sparql_implementation import ( AbstractSparqlImplementation, ) from oaklib.interfaces.owl_interface import OwlInterface @dataclass class OwleryImplementation(OwlInterface, AbstractSparqlImplementation): """ Wraps an owlery endp...
967beca2c376b7fcf477a042e5b96e878e9469622d11f5c5307e4e41c4e93b42
Python
428
16
#!/usr/bin/env python2.7 #coding:utf-8 from __future__ import print_function import sys from mmseg import seg_txt for line in sys.stdin: blks = str.split(line) out_line = blks[0] for i in range(1, len(blks)): if blks[i] == "[VOCALIZED-NOISE]" or blks[i] == "[NOISE]" or blks[i] == "[LAUGHTER]": out_line...
3c82a4f156a2dddd26c89e858088da795b7bccc88ab2cf4ecec453c57b4a2fca
Python
430
20
__author__ = "Johannes Köster" __copyright__ = "Copyright 2018, Johannes Köster" __email__ = "johannes.koester@protonmail.com" __license__ = "MIT" from snakemake.shell import shell extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=False, stderr=True) shell( "picard " "CreateSeq...
08bf8abc77f4bb782759c8e2c1de24eea3bdc3f073d18e1407549cea0cf0407d
Python
431
30
from collections import namedtuple Genotype = namedtuple('Genotype', 'backbone rpn') OP_NAMES = [ 'sep_conv_3x3', 'sep_conv_3x3_dil3', 'sep_conv_5x5_dil6', 'skip_connect', 'def_conv_3x3', ] AGG_NAMES = [ 'psum', 'cat' ] HEAD_OP_NAMES = [ 'conv1x1', 'conv3x3', 'sep_conv_3x3', ...
dc5e9214b0cf89f4b4c7f6e71297c3329e375b806f50555cedc7a33412186285
Python
431
13
import os import gdown os.makedirs('./saved_models/u2net', exist_ok=True) os.makedirs('./saved_models/u2net_portrait', exist_ok=True) gdown.download('https://drive.google.com/uc?id=1ao1ovG1Qtx4b7EoskHXmi2E9rp5CHLcZ', './saved_models/u2net/u2net.pth', quiet=False) gdown.download('https://drive.google.com/uc?i...
a8cc15c6b7fbed43fc1504ff1b26218deb71c9dea2b277d73951f590fe072480
Python
432
17
from snakemake.shell import shell import os log = snakemake.log_fmt_shell(stdout=True, stderr=True) prefix = os.path.splitext(snakemake.output.json)[0].split(".") shell( "sex={snakemake.params.sex} && " "( ExpansionHunter" " --reference {snakemake.params.ref}" " --reads {snakemake.input.bam}" " -...
2bc6fa0763d10a258e82cc8e2167a3d733664a8df723028a3381fcd19353004b
Python
433
11
from .volumes import Volume from .neurons import Neuron, BaseNeuron, TreeNeuron, MeshNeuron, Dotprops from .neuronlist import NeuronList from .core_utils import make_dotprops, to_neuron_space, NeuronProcessor from typing import Union NeuronObject = Union[NeuronList, TreeNeuron, BaseNeuron, MeshNeuron] __all__ = ['Vo...
6fc1521e73326932d876d7b51ed9c0c530bee7c64b40b7957b76a54cbaef7b0d
Python
433
19
"""Utility module""" def get_data_dir(): """ Get the main directory for data """ return "/Users/karimia/data/brainnet_data/Figures_Tables/Fig_1" def get_fig_dir(): """ This is where we save the figures """ return "/Users/karimia/code/Brain_Network/python/figures" def get_local_datadir...
15a5a775f51b43ab32be4011fdf977b99c59f97c35a2fa393d18797a037dfb32
Python
434
20
import torch import networkx as nx import matplotlib.pyplot as plt from torch_geometric.utils import to_networkx from graphxai.datasets.real_world.MUTAG import MUTAG mutag = MUTAG(root = '.') g1 = mutag.graphs[109] print(torch.sum(g1.x, dim = 0)) node_c = [g1.x[i,1].item() for i in range(g1.x.shape[0])] print(node...
71e89ddd3fa718fc88c8f2755e7568298ebc3a07eba3f8052a2d3109e4ef3073
Python
434
14
''' Extract data: velocities, forces, etc. [Folder sphere_presaved contains output expected after step00 in case the user is not able to run step00] ''' import FBEM folder = 'data/sphere_presaved/' res = FBEM.extract_all_data(folder) # output ResultsData class coords = res.coordinates velocities = res.velocities # ...
7228c8c42f01dc13e40dd461850f92546dc5e99ae0a9915c9a8e888c999254ca
Python
436
20
__author__ = "Jan Forster" __copyright__ = "Copyright 2019, Jan Forster" __email__ = "j.forster@dkfz.de" __license__ = "MIT" from snakemake.shell import shell ## Extract arguments extra = snakemake.params.get("extra", "") log = snakemake.log_fmt_shell(stdout=True, stderr=True) shell( "(bedtools slop" " {ext...
7d840b575bf31bf63fcffb125165317bab7ef733b9cf7b7426b1246da2768f78
Python
436
12
from .subgraphx import SubgraphX from .cam import CAM, GradCAM from .guidedbp import GuidedBP from .gnn_lrp import GNN_LRP from .random import RandomExplainer from .grad import GradExplainer from .integrated_grad import IntegratedGradExplainer from .graphlime import GraphLIME #from .gnn_explainer import GNNExplainer fr...
927e79fdd3ff3407340b83c87dff7ba32e0b4e274bcbc84605e4e25dcde1010f
Python
437
17
import sys, os import torch import networkx as nx from graphxai.datasets.load_synthetic import Owen_root from graphxai.datasets.utils.shapes import house from graphxai.datasets.utils.verify import verify_motifs assert len(sys.argv) == 2, 'usage: python3 check_graph.py <filename>' file = sys.argv[1] bah = torch.load(...
18140f02b151db60cd475b91865b181efd2241972d54d51b485d638a17d9fa6c
Python
438
17
from .core import TrajectoryDataset, LabelFunction, Augmentations from .fly_v1 import FlyV1Dataset from .mouse_v1 import MouseV1Dataset dataset_dict = { 'fly_v1' : FlyV1Dataset, 'mouse_v1' : MouseV1Dataset } def load_dataset(data_config): dataset_name = data_config['name'].lower() if dataset_nam...
27806dad448cc7a69b3233c91298ec7bc2223dfa71f0288e99457c571c8679e2
Python
438
13
import numpy as np def softmax(x): """Compute softmax values for each sets of scores in x.""" e_x = np.exp(x - np.max(x)) return e_x / e_x.sum() def uniform_vector(length): return np.ones((length))/length def make_initial_prior(initial_image_prior,initial_rationality_prior,initial_speaker_prior): ret...
8ed672f5dfb327489b8f1593d98ea5ac19739cda6bdd46bf0857191b50aa80a1
Python
438
14
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. from . import SmokeTest class TestClient(SmokeTest): def test_version(self): print("T...
e229505bb8820c1078872f8a98d95bfb23e0712e611fdbfd7f6331d2b1b8dc03
Python
438
15
import json def readConfig(path): with open(path,'r') as cf: nodelocaltionstr = cf.read() nodelocaltioninf = json.loads(nodelocaltionstr) if isinstance(nodelocaltioninf,str): nodelocaltioninf = json.loads(nodelocaltioninf) return nodelocaltioninf def writeConfig(path, inf...
666497063842b91ee875d10688a6663fd7e9501e901c933b0b7457178429bf93
Python
439
14
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import pytest pytest.register_assert_rewrite('eelbrain.testing._testing') from ..datasets._simple import get_ndvar from ._testing import ( gui_test, requires_mne_sample_data, requires_pyarrow, requires_r_ez, skip_on_windows, TempDir, working_dir...
74f4e4b4f436d5f5a42b8b0ca2cc621df2c7cceeb049400465602bf0970ae993
Python
439
19
#!/usr/bin/env python lexicon = open("data/local/tmp/lexicon.1") lexicon_ext = open("data/local/tmp/lexicon.2", "w") for line in lexicon: line = line.strip() if "//" not in line: lexicon_ext.write(line + "\n") continue lineComp = line.split("\t") prons = lineComp[1].split("//") for...
8d8f3a014e341f863c2c0ceb262d117321a3a1316b7f76fce0480a87ae0a001e
Python
439
10
from __future__ import absolute_import from . import utils from . import paths from . import setup_hd_gliomouse print("\n########################") print("If you are using hd-bet, please cite the following papers:\n") print("UPCOMING\n") print("Isensee, Fabian, et al. \"Automated Design of Deep Learning Methods for Bi...
b82361620273332651e2f3b5ee10a8b4ed51ae14e14300a56bb2ff6514808905
Python
439
10
from .anchor_generator import AnchorGenerator, LegacyAnchorGenerator from .builder import ANCHOR_GENERATORS, build_anchor_generator from .point_generator import PointGenerator from .utils import anchor_inside_flags, calc_region, images_to_levels __all__ = [ 'AnchorGenerator', 'LegacyAnchorGenerator', 'anchor_insid...
3dd9e92d39ab5341affa44c13ae80812ab49d607a7963ebec8d95a4ddff47a08
Python
440
18
from setuptools import setup setup( name="PaiNN", version="1.0.0", description="Library for implementation of message passing neural networks in Pytorch", author="xinyang", author_email="xinyang@dtu.dk", url = "https://github.com/Yangxinsix/PaiNN-model", packages=["PaiNN"], install_requ...
418f5a0cd1866bf9f34717c598c3f96770b0fa3886a09b8f38961a3526d3c002
Python
441
21
import torch.nn as nn from .registry import ACTIVATION_LAYERS @ACTIVATION_LAYERS.register_module() class HSigmoid(nn.Module): """Hard Sigmoid Module. Apply the hard sigmoid function: Hsigmoid(x) = min(max((x + 1) / 2, 0), 1) Returns: Tensor: The output tensor. """ def __init__(self): ...
252f44926ff6b5fe3af38989feb86abfaf79526f0fc3114661d5d18fc6582e90
Python
442
16
"""Pipeline class implements functionality that is common to all processing pipelines.""" from logging import Logger from typing import List class Pipeline: """Pipeline template for different workflows.""" def __init__(self, log: Logger) -> None: """Initialize parameters common to all pipelines. ...