sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d4b517df6612a5af8daddc47bbd0ddc04f64d0b48a40220111ce147bcfbfa101
Python
742
27
from setuptools import setup, find_packages setup(name='HD_BET', version='1.0', description='Tool for brain extraction', url='https://github.com/MIC-DKFZ/hd-bet', python_requires='>=3.5', author='Fabian Isensee', author_email='f.isensee@dkfz.de', license='Apache 2.0', zi...
1c1c06ef82c0fc9850ca39a11c0829ba4541c05be2b1654449eaa2654d395934
Python
743
24
import numpy as np from . import utils def trials_are_same_length(trial_data, ref_field=None): """ Check if all trials of a dataset have the same length Parameters ---------- trial_data : pd.DataFrame data in trial_data format ref_field : str (optional) time-varying field to us...
85cc6ec071f0b4d8bd8fb4eb95cb46ac821999eaa909e33d3a9d336fe40cae8f
Python
743
31
from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.neural_network import MLPClassifier from codecarbon import EmissionsTracker digits = datasets.load_digits() # flatten the images n_samples = len(digits.images) data = digits.images.reshape((n_samples, -1)) # Create a clas...
a5df8b87d598957d83dc5f6f2af99c65b10dd9f4094f275ee4444718d5feef4e
Python
743
29
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 82 msp.architecture["splicepoint_model_spec"] = dict( type="BothLSSIModels", acceptor="model/splicepoint-model-acceptor-1", donor="model/splicepoint-model-donor-1", ) msp.arch...
baf104c12ed010da15cca45238fa59da0e099a4b46976814faf803882c67dc72
Python
743
27
import sqlite3 from .db import DB class FatalitiesTable(DB): def __init__(self): self.table_name = 'KA_individual_fatalities' self.table_desc = 'Karnataka individual fatality diagnosis' self.cols = self.getcolumns() def getcolumns(self): cols = { 'date': 'DATE NOT...
e5062181f1ad86da2032cb2321d3b4a8f3bffdcbafa8e3b2ca4a7bfa0bca1ca5
Python
743
21
from mirp._data_import.dicom_multi_frame import ImageDicomMultiFrameStack, ImageDicomMultiFrameIndividual from mirp._data_import.dicom_file_mr import ImageDicomFileMR class ImageDicomFileMRDCE(ImageDicomFileMR): def __init__(self, **kwargs): super().__init__(**kwargs) class ImageDicomFileMRDCEMultiFrame...
2e166065b2f7a4c3e1941ce973ce5c9170c304f837a8e481b0c8143f1c6a85ab
Python
744
16
# Copyright 2019 Novartis Institutes for BioMedical Research Inc. 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 applicable law...
6ad234072ca967a32e71bc0dbf777138cf570f698ff983b30341cdbdaaa9a516
Python
744
28
import sqlite3 from .db import DB class DistrictCaseInformation(DB): def __init__(self): super().__init__() self.table_name = 'TG_district_cases_info' self.table_desc = 'Telangana daily new cases in districts' self.cols = self.getcolumns() def getcolumns(self): cols...
b742ec7e60b46feea80d62e68994db8e42237d6768c8259bdb7991d3ae0b2138
Python
744
20
# Copyright (c) OpenMMLab. All rights reserved. from .avgpool2d_neck import AvgPool2dNeck from .cae_neck import CAENeck from .densecl_neck import DenseCLNeck from .linear_neck import LinearNeck from .mae_neck import MAEPretrainDecoder from .mocov2_neck import MoCoV2Neck from .nonlinear_neck import NonLinearNeck from .o...
54a98f19f6a416d17c347255dac0482b8979c09c941b22c6aa358273328389a0
Python
745
26
import numpy as np from F01 import Feature class F08(Feature): def get_map_float32(self, img, roi): b, g, r = img[:, :, 0], img[:, :, 1], img[:, :, 2] # Prevent div by 0 b[b == 0] = 1 g[g == 0] = 1 # Prepare "redness" map red = np.minimum(r / (1.0 * b), r / (1.0 ...
bc8b861fde78a631d9f44adf1c7cc4487a514681e57acfb27efb30c050127668
Python
745
41
from .docs import deprecated # noqa: F401 from .mean import ( mean_covariance, mean_ale, mean_alm, mean_euclid, mean_harmonic, mean_identity, mean_kullback_sym, mean_logdet, mean_logeuclid, mean_power, mean_riemann, mean_wasserstein, maskedmean_riemann, nanmean_r...
bfe5af8b2e98aff20ebaad76b3f478d3c900bbb7efbfd9d2faf06481d9045b62
Python
745
24
import numpy as np from scipy import stats from sklearn.metrics import mean_squared_error def calculate_mse(y_true, y_score): vals = [] for class_index in range(y_true.shape[-1]): vals.append(mean_squared_error(y_true[:, class_index], y_score[:, class_index])) return np.array(vals) def calculate...
c3c5ae22592d0d4dae35e2206d6c08c02049113e9375914f323af99191d22969
Python
745
22
import sys import os homedir = sys.argv[1] tmpdir = sys.argv[2] network = sys.argv[3] phenotype_name = sys.argv[4] """ this makes the features and targets in tmpdir """ os.system('python /{0}/preprocess.py {1} {2}'.format(homedir,network,tmpdir)) working_dir = homedir + '/results_matchedsamples_null_081822/{0}_netwo...
cbbb50186b2f97ac48d23dbd81c136d751a5d8beb238910b5365766a204f6f6a
Python
745
30
""" Refactor the AP detection module to provide a clean interface. You can always refactor the core later. """ import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/") PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/") sys.path.insert(0...
f900da9b74ab2a792f9046154969965adc8b50852a21656c9f251bf7a0319ea1
Python
745
22
import sys import os homedir = sys.argv[1] tmpdir = sys.argv[2] network = sys.argv[3] phenotype_name = sys.argv[4] """ this makes the features and targets in tmpdir """ os.system('python /{0}/preprocess_SepSampPCA.py {1} {2}'.format(homedir,network,tmpdir)) working_dir = homedir + '/results_SepSampPCA_null/{0}_netwo...
362d0f16d761c712f3bb5504aa444988e39d9d525cd7ce0854588f3a89398447
Python
746
34
"""Short example for ``tl.debug`` helpers.""" from __future__ import annotations import torch from torch import nn import torchlens as tl class DebugModel(nn.Module): """Tiny model with one numerically unstable operation.""" def forward(self, x: torch.Tensor) -> torch.Tensor: """Create a non-finit...
77b3575916980df655651525890e6702f00994b23818bf3dcea90d41f7b9caec
Python
746
28
#!/usr/bin/python from distutils.core import setup classifiers=[ 'Development Status :: 4 - Beta', 'Environment :: X11 Applications', 'Intended Audience :: End Users/Desktop', 'License :: OSI Approved :: GNU General Public License (GPL)', 'Operating System :: POSIX :: Linux', 'Prog...
72f722d8fe24ff64ef94e5e4fe6e0b966b875b9e87b331dcc297599b48738ca9
Python
747
26
import sqlite3 from .db import DB class DailySummary(DB): def __init__(self): super().__init__() self.table_name = 'KL_daily_summary' self.table_desc = 'Summary of new COVID-19 cases (last 24 hours)' self.cols = self.getcolumns() def getcolumns(self): cols = { ...
20786cf2fb0a797d6d71a346c36b79484b8d2011500cddf0f4faaa78e331b54d
Python
748
21
"""Tests for specparam.algorithms.definitions.""" from specparam.algorithms.algorithm import Algorithm from specparam.algorithms.definitions import * ################################################################################################### ###################################################################...
362b15179020c5f630ad9eaa5e61fcc5861ac016bd649220ce6cba364d61d1d4
Python
748
28
import sqlite3 from .db import DB class ActiveCases(DB): def __init__(self): super().__init__() self.table_name = 'GA_active_cases' self.table_desc = 'BREAKUP OF ACTIVE POSITIVE CASES' self.cols = self.getcolumns() def getcolumns(self): cols = { 'date': '...
52d57fe271e9542a9ed7a06a1bee487e4d0feb119576a37196f274e58c4aea7a
Python
748
27
import numpy as np def rep(x, each=1, times=1, use_inversion=False): """"This functions replicates the R rep function for tiling and repeating vectors""" each = int(each) times = int(times) if each > 1: x = np.repeat(x, repeats=each) if times > 1: if use_inversion: le...
cb80626821d4c397357493ce48903abe09014253f14366dea4bee10d5d5eb395
Python
748
24
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in July 2022 @author: Thomas Bonald <thomas.bonald@telecom-paris.fr> """ import unittest import numpy as np from sknetwork.utils.membership import get_membership, from_membership class TestMembership(unittest.TestCase): def test_membership(self): ...
7ae6b9e28adcc799fa6380fab33bccfaa51c9b04e65d32a850089072bb631469
Python
749
23
import torch from collections import OrderedDict class script_pes(): def __init__(self,pes,name): self.pes=pes self.name=name def __call__(self,state_dict): new_state_dict = OrderedDict() for k, v in state_dict['reannparam'].items(): if k[0:7]=="module.": ...
d91bed40565ab3b30da0532930c2101195b7678f89f5058391138bd75b42ec05
Python
749
19
"""Specific tasks based on the same base task.""" import gymnasium as gym # using ngym.make would lead to circular import from neurogym import wrappers from neurogym.utils import scheduler def roitman02(**kwargs): env = gym.make("PerceptualDecisionMaking-v0", disable_env_checker=True, **kwargs) return wrap...
08223d2d789c3255a28d760676e96b7d4fdab72a1cc29d2ea2e9cb74f9dd8677
Python
750
22
import sys import os homedir = sys.argv[1] tmpdir = sys.argv[2] network = sys.argv[3] phenotype_name = sys.argv[4] """ this makes the features and targets in tmpdir """ os.system('python /{0}/preprocess.py {1} {2}'.format(homedir,network,tmpdir)) working_dir = homedir + '/results_matchedsamples_boot_081822/{0}_netwo...
442273be2282c5b3988f0f51fb87c909d6bfb6dd6991d71d983a9fc3bfad8a91
Python
750
27
import sys import pathlib import matplotlib.pyplot as plt import numpy as np from scipy import signal try: PATH_HERE = pathlib.Path(__file__).parent PATH_ABFS = PATH_HERE.joinpath("../../data/abfs/").resolve() PATH_SRC = PATH_HERE.joinpath("../../src/").resolve() print(PATH_SRC) sys.path.insert(0, ...
720b9d321dcd9f9273bf1b993ef0f333b5bd3a23523d4364debf584075fee3f6
Python
750
24
"""Base class for XLA SavedModel archive.""" class XLASavedModelArchive: def __init__(self): raise NotImplementedError( "XLASavedModelArchive is an abstract class. " "Use a subclass such as SavedModelExportArchive." ) def track(self, resource): raise NotImpleme...
b63d5fd94eb8051e3c6754a63d4fa76818ab12c699d2f75bd2060992badb4fb3
Python
751
27
import subprocess from subprocess import run import numpy as np # spring: 974 summer: 610 fall: 1015 winter: 506 sar2opt: 587/ 627 num_test = 627 if __name__ == '__main__': cmd = "bash Image_translation_codes/pytorch-CycleGAN-and-pix2pix/run_time.sh" results = subprocess.Popen(cmd, stdout=subpro...
28a825f5cdecaec0154611fb0aedb98df0ca6c8e0b8b08b5ab3169e6e756d173
Python
752
32
"""Convert coco to bdd100k format.""" import argparse from scalabel.common.parallel import NPROC from scalabel.label.from_coco import run def parse_arguments() -> argparse.Namespace: """Parse the arguments.""" parser = argparse.ArgumentParser(description="coco to bdd100k") parser.add_argument( "...
77b51bc849b9a5af79b8b1acec3fd7dcd5f6c7c770dc2931696493f3a15cea49
Python
752
25
import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np def plot_transition_matrix(hsmm, ordered_states, size, path): ordering = [hsmm.states.index(i) for i in ordered_states] trans_matr = hsmm.transition_matrix[ordering][:, ordering] first, second = np.where(trans_matr) plt.figure...
d7603bbfb9415cf5638de2de580de7134e25d9fa1e19dc9b1cd7e38dccd458e8
Python
752
20
from tensorflow.keras.layers import BatchNormalization import tensorflow as tf # https://stackoverflow.com/questions/65195956/keras-custom-batch-normalization-layer-with-an-extra-variable-that-can-be-change class AccumBatchNormalization(BatchNormalization): def __init__(self, **kwargs): super(AccumBatchNo...
037f6e4fce5bee7cbfd9f9f9fc379f3cee7382f22ec88e0cb8c8e2019e3a2640
Python
753
19
from datasets.basic import MultiSiteDataset from datasets.fundus import FundusDataset from datasets.mediastinum_tumor import MediastinumTumorDataset from datasets.midline import MidlineDataset __all__ = ['all_datasets', 'get_dataset'] all_datasets = { 'mediastinum-tumor': MediastinumTumorDataset, 'fundus': Fu...
060fb5ab92dbade2e9f1a3d56fef71630baa02b79e5d3a0f84d8174fba4cc2c8
Python
753
27
import torch from torch import nn class SEModule(nn.Module): def __init__(self, channels, reduction): super(SEModule, self).__init__() self.fc1 = nn.Conv3d(channels, channels // reduction, kernel_size=1) self.relu = nn.ReLU(inplace=True) self.fc2 = nn.Conv3d(channels // reduction, ...
15f1258395263d76fe13b7f31ced827553e827d4c839b5aa1ca324f8be7f3c60
Python
753
33
import numpy as np from .annotation import Annotation class Null(Annotation): """ Represents a site that should never be included in a transcript. """ @classmethod def find_patterns(cls, sites, usable, skippable): return super().find_patterns(sites, np.ones_like(usable), skippable) ...
78eaba3418a3d8744fb6e07630ca33a90fcf71bf07fdf14743979595579f9831
Python
753
13
"""Module defining various utilities.""" from bioseq2seq.utils.misc import split_corpus, aeq, use_gpu, set_random_seed from bioseq2seq.utils.alignment import make_batch_align_matrix from bioseq2seq.utils.report_manager import ReportMgr, build_report_manager #from bioseq2seq.utils.raytune_utils import RayTuneReportMgr f...
677cc5e2e849b295a7aabd6c03a1714a89667b87a957a81658fecfe752c46351
Python
754
30
from sys import argv from msp import MSP from msp_fly import fly_am msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) fly_am(msp) msp.architecture["final_processor_spec"].update( dict( bottleneck_spec=dict(type="ConvolutionalBottleneck", width=5), post_bottleneck_lsmrp_spec=dict(type="Early...
6b3904aad544e8629c69ccf83aa0ad56f63fcc1edc02dad45a29741fbf6544c2
Python
754
28
# Generated by Django 3.2.6 on 2022-05-19 15:05 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('biomedisa_app', '0087_processeddata_repository_specimen_tomographicdata'), ] operations = [ migrations.AddField( model_name='rep...
13b8dd964c54405e3da26d60ce4249dd3e50b405373ddf20ecb6dd1b589c4e24
Python
755
25
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import ast from typing import Set FLOAT_PATTERN = r"^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$" POS_FLOAT_PATTERN = r"^[+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$" INT_PATTERN = r"^-?\d+$" # matches float as well as NaN: FLOAT_NAN_PATTERN = r"^\s*(([Nn][Aa][Nn])|([-+]...
25b32c9a58323e4d69ccd022014025d874c49ffda80b50b6023c0e4fb18e6543
Python
755
19
from pyrho import VERSION from distutils.core import setup setup( name='pyrho', version=VERSION, description='Inference of fine-scale recombination maps using composite ' 'likelihoods and fused-LASSO.', author='Jeffrey P. Spence, Yun S. Song', author_email='spence.jeffrey@berkeley.ed...
5b7aa0115e8bc2bc68552a113f2318ef196a6fe5d829c2e1d95a4a4c4c9f3177
Python
755
27
import subprocess from subprocess import run import numpy as np # spring: 974 summer: 610 fall: 1015 winter: 506 sar2opt: 587/ 627 num_test = 627 if __name__ == '__main__': cmd = "bash Image_translation_codes/contrastive-unpaired-translation/run_time.sh" results = subprocess.Popen(cmd, stdout=su...
72affc8149becd43cdec8b4f9ed02013d7cf7fc686915f874592256e65ccbc7d
Python
755
26
import sys import collections from collections import Counter d = collections.defaultdict(list) def get_matrix(seq_fa): with open(seq_fa) as f: for line in f: line = line.strip() if line.startswith('>'): continue else: for i in range(len(line)): if i ==5: base = 'I' else: base...
bc34e18bfac0187c64f82798bbd37835193e9cedffcedd1f612920d2243329cb
Python
756
29
import sys import pathlib import matplotlib.pyplot as plt import numpy as np try: PATH_HERE = pathlib.Path(__file__).parent PATH_ABFS = PATH_HERE.joinpath("../../data/abfs/").resolve() PATH_SRC = PATH_HERE.joinpath("../../src/").resolve() print(PATH_SRC) sys.path.insert(0, str(PATH_SRC)) import...
e93b5fc0b083e3e63dedbc790795b0b8af8b1095183e206402131e1f1d192288
Python
756
30
import argparse import torch from src.datasets import util # obtain mean and std of dataset def main(args): dataset = util.get_dataset(args.root, name=args.dataset, split="train", ntau=args.ntau, idx=0, normalise=False) frames_list = [] for x, y in dataset: frames_list.append(x) movie_tens...
72abdc7404dc17e5d4077ac6121a5d7fefa917040df3393bc79b2720e0efcc33
Python
757
45
from typing import List, Tuple, Any, TypedDict class TimeSeries(TypedDict): data: List[Tuple] class TableSchema(TypedDict): title: str = None columns: Tuple[str] class DataTable(TypedDict): title: str = None columns: Tuple[str] data: TimeSeries class StateSchema(TypedDict)...
5fca23fa657679c5d7c621758ccb6502ab2f24fac5d433178ed4665754c63d37
Python
758
23
#### Modified from TAURUS Lee et al., Nat Methods 2019 (https://github.com/dixonlab/Taurus-MH) import pysam import sys import os os.system('sort -k1n '+sys.argv[1]+'_multi_split_aligned.txt_man_dedupped.txt > '+sys.argv[1]+'_multi_split_aligned.txt_man_dedupped_queryname_sorted.txt') bam=sys.argv[1] dfh=pysam.Alignm...
ebef1c95322db70862f020ebbd689e04c902462788b8e809f158dae3223e4019
Python
758
32
""" Distribution configuration for morphsynthesis """ import imp from setuptools import find_packages, setup VERSION = imp.load_source("tns.version", "tns/version.py").VERSION setup( version=VERSION, description='TNS= synthesis of artificial neurons using their topological profiles package', author='Li...
403442e166ded51df83ff6124097ee7778f8b64429a942ef437f021e7a504cfc
Python
759
29
from typing import Optional, Union from anndata import AnnData from matplotlib import pyplot as plt from pathlib import Path import os def convert_scanpy( adata: AnnData, use_quality: str = "hires", ) -> Optional[AnnData]: adata.var_names_make_unique() library_id = list(adata.uns["spatial"].keys())[...
a1b241a1cba43b01cfbeaac53d87a42444cc2dc8300ad90fdb01005455733461
Python
759
29
from setuptools import setup setup(name='Phys_Seg', version='0.1', description='Tool for physics-based MR segmentation', url='https://github.com/TBD', python_requires='>=3.6', author='Pedro Borges', author_email='p.borges.17@ucl.ac.uk', license='Apache 2.0', zip_safe=Fal...
e2693bdc2d69d8c362c68f1f2c34d3c0f6d67c76d837ba65d11f0c4b992de257
Python
759
24
"""Tests for specparam.plts.time.""" from pytest import raises from specparam import SpectralTimeModel from specparam.modutils.errors import NoModelError from specparam.tests.tutils import plot_test from specparam.tests.tsettings import TEST_PLOTS_PATH from specparam.plts.time import * ############################...
4dbfe1ad7d2fcb307d9418d589e75cf5da3fafcd83efe2aca72b19daaa650c9a
Python
760
22
import sys import os homedir = sys.argv[1] tmpdir = sys.argv[2] network = sys.argv[3] phenotype_name = sys.argv[4] """ this makes the features and targets in tmpdir """ os.system('python /{0}/preprocess.py {1} {2}'.format(homedir,network,tmpdir)) working_dir = homedir + '/results_matchedsamples_boot_null_081822/{0}_...
4e12358a4afd055dfe6e5cc4136dcab3e6f0353220ee6dd178afac4874bf0b48
Python
760
30
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="SpliceaiAsDownstream", motif_model_spec=dict( type="PSAMMotifModel", motif_spec=dict(type="rbns"), exclude_names=("3P", "5P"), ), spliceai_spec=dict(t...
a40b95552b72f6aca443f34e5099fcc7edd83abe5f6833a28ec6266f9d6550ee
Python
760
29
import sqlite3 from .db import DB class VaccinationCoverage(DB): def __init__(self): super().__init__() self.table_name = 'MP_vaccination_coverage' self.table_desc = 'Vaccination Coverage' self.cols = self.getcolumns() def getcolumns(self): cols = { 'date...
174167bc1b0468a81ede1392306ba05331de9b1c6e6a7936af27b2e642aad3a0
Python
761
24
"""Train Mask-RCNN end to end.""" import os # disable autotune os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0' os.environ['MXNET_GPU_MEM_POOL_TYPE'] = 'Round' os.environ['MXNET_GPU_MEM_POOL_ROUND_LINEAR_CUTOFF'] = '26' os.environ['MXNET_EXEC_BULK_EXEC_MAX_NODE_TRAIN_FWD'] = '999' os.environ['MXNET_EXEC_BULK_EXEC_MAX_...
1c29222d8726cd8094f6954eb72d8a66c49ebb09ed134c79cce689c69719752a
Python
761
26
#!/usr/bin/env python import sys,re, collections '''convert the provided example file to only have a single positive affinity for the best rmsd example''' #first identify best rmsd bestval = dict() bestlig = dict() for line in open(sys.argv[1]): # 0 1a30/1a30_rec.gninatypes 1a30/1a30_ligand_0.gninatypes # 8.46937 ...
d1cb297d90005ff6f24b1a2e9af4e643bd5b85870c442f7ddb4fb9b8f7bfb428
Python
761
25
from __future__ import annotations from typing import Dict, Callable import panel as pn def main() -> None: from .model_inspector import model_inspector_app from .module_inspector import module_inspector_app from .track_viewer import track_viewer_app from .experiment_viewer import experiment_viewer_a...
0ebfe4c0cfc5804a6e472fea7b1c4e333c103ce23500024cd876cda7033821f4
Python
762
16
""" VAE Template ============ This is a basic template for implementing a Variational Autoencoder in PyTorch Lightning. A default encoder and decoder have been provided but can easily be replaced by custom models. This template uses the CIFAR10 dataset but image data of any dimension can be fed in as long as the ima...
27f7ff7a1ff37d3c23a08938feb6f6d4572868b1bedbf5732b03db3a3c9b14ed
Python
762
28
""" Average visual model vectors over instances of the same concept """ import numpy as np import pandas as pd import unidecode from scipy.io import savemat labels = pd.read_csv("stimuli.csv") for layer in ["V1","V2","V4","IT","decoder"]: vectors = [] words = [] cornet = np.load(f"CORnet-S_{layer}_outp...
48acdbbc62c9b001e811ba527a3e279186ef7a2a2b6f96ec33102689ccbfc18c
Python
762
24
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """ Module providing constants for data proxy. Author: Mateusz Kruszyński <mateusz.kruszynski@gmail.com> """ import numpy SAMPLE_SIZES = {'DOUBLE': 8, 'FLOAT': 4} SAMPLE_STRUCT_TYPES = ...
61d9ca82b6b87eaa40638cf98b1b5df593d9117d4e6c7cecc4958e25b5b8e916
Python
762
20
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # 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 app...
cb68a4bd05a0efc8be9afd23a97bf4855b7e7830cefb1bf2a580872c7a7a2ccb
Python
762
26
""" Test ABF1 tags """ import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/") PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/") sys.path.insert(0, PATH_SRC) import pyabf import glob import numpy as np import matplotlib.pyplot as plt ...
28254a168163dab34c4bbc9aa67766bef97fe8e3a95e289f548f39bfea89f0e2
Python
763
28
import sqlite3 from .db import DB class BedCapacity(DB): def __init__(self): super().__init__() self.table_name = 'GA_bed_capacity' self.table_desc = 'BED CAPACITY IN COVID CARE CENTRES' self.cols = self.getcolumns() def getcolumns(self): cols = { 'date':...
50f6f3761394f88e34a454b62dfda50623e9c15ac7ffb2624f469afacb923623
Python
763
37
""" Perform coregistration for RSA. """ import sys sys.path.append('..') import mne from config import fname subject = 20 trans_tsss = fname.tsss(subject=subject, session=2, run=2) info = mne.io.read_info(trans_tsss) #%% coregister coreg = mne.gui.coregistration( subject=f'sub-{subject:02d}', subjects_dir=fna...
82ff0bf348f6d39c59ef39784df2e9ac0dbd8be55e86992a7238d77ed2ceef41
Python
763
29
import sys import pytest import datetime import inspect import numpy as np import glob try: # this ensures pyABF is imported from this specific path sys.path.insert(0, "src") import pyabf except: raise ImportError("couldn't import local pyABF") @pytest.mark.parametrize("atfPath", glob.glob("data/abfs...
83424eb3e3b57bdb59a16013095da8975b8e09a5a67363440ca804de9f5f621e
Python
763
1
import numpy as np import pandas as pd import time import random # [1] data preprocessing # df = pd.read_csv('./data/GSE72056_melanoma_single_cell_revised_v2.csv', index_col=0) # dimension = (genes x cells) #df1 = df.iloc[0:3,:] print("starting preprocessing:") n1 = df.shape[0] # row genes n2 = df.shape[1] # col ce...
dc82547b57c561a202b218dbbea7b822d9da003986226c6f2ce2a8046edba427
Python
763
25
""" Fixed bin size and fixed bin number algorithms are already fully covered in ibsi_1_test.py and elsewhere. """ import os from mirp import extract_features CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) def test_pyradiomics_fbs(): data = extract_features( write_features=False, export...
ef59fa514a0b45885b17493db3a402d281ecb776492490e6865667bf99cffc2c
Python
763
24
import os.path import json import numpy as np import pandas as pd from input_parameters import input_root_path, processed_metadata_filepath def summarize(df, class_col_name = "category"): table = df.groupby([class_col_name]).size().reset_index(name='counts') print(table) print(table.to_markdown()) ...
32d36df2ee5a25114fedc7774ead7de66308d4b86db4b1a0cadbc223e832c8ac
Python
764
27
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._dimension import Dimension from ._domain import Domain from ._labelfont import Labelfont from ._legendgrouptitle import Legendgrouptitle from ._line import Line from ._tickfont import Tickfont from . import legendgrouptitl...
5e4dd4924711ce3e98e74e62d96479295093f6f379c638f256588dc43c8cd174
Python
764
25
import os import joblib import yaml def preprocess_data(dataset, config): X = dataset[config['features']] y = dataset[[config['outcome']['time'], config['outcome']['event']]].values y[:, 1] = 1 - y[:, 1] # inverse to censored return X, y def save(save_dir, model, c_index, params, data): os.make...
7626c99c6b3722b522fe86c08280848e3ad4b19063032433b31348e58a154205
Python
764
32
__author__ = 'quentin' from ethoscope.tracking.roi_builders import ImgMaskROIBuilder from ethoscope.tracking.cameras import MovieVirtualCamera from ethoscope.tracking.monitor import Monitor from ethoscope.tracking.trackers import AdaptiveBGModel from ethoscope.tracking.interactors import SleepDepInteractor from ethos...
898b1813595af3709eb7d0a040277bbbb4e0628d3ff19d7de01f4d5d154cecad
Python
764
23
from PIL import Image from lightly.transforms.msn_transform import MSNTransform, MSNViewTransform from .. import helpers def test_view_on_pil_image() -> None: single_view_transform = MSNViewTransform(crop_size=32) sample = Image.new("RGB", (100, 100)) output = single_view_transform(sample) assert ou...
c64dd3e11469cfd7cdbb0bb8986a07fc8ba14275369782a4103aecbc661368b8
Python
764
30
'''Util functions useful for general purposes''' import numpy as np from numpy import sqrt def get_random_point(D=1.0): ''' Get 3-d coordinates of a new random point. The distance between the produced point and (0,0,0) is given by the value D. ''' # pylint: disable=assignment-from-no-return ...
b74da03f302192218a698c0a7f71a0fdb1f2af5554acb7f094e8d34c8fc1bc81
Python
765
29
"""The module describes the ``hostname`` job metrics plugin.""" import logging from . import InstrumentPlugin log = logging.getLogger(__name__) class HostnamePlugin(InstrumentPlugin): """Gather hostname""" plugin_type = "hostname" def __init__(self, **kwargs): pass def pre_execute_instru...
5ff9f111f07929d30115085d41317a0893dfec74594912cc51efb29d5d97a7f5
Python
766
26
from setuptools import setup def read_requirements(path): with open(path, "r") as f: return [line.strip() for line in f if not line.isspace()] with open("README.md", "r", encoding="UTF-8") as fh: long_description = fh.read() setup( name="spaco-release", version="0.2.0", python_requires...
07a8d712c17e5666287d42658552be71e9344437ac0a3cc54d1551c1592c67fa
Python
767
27
import os import tns def run(): # Cell to use as input for the diameter model dir_path = os.path.dirname(os.path.realpath(__file__)) input_cell = os.path.join(dir_path, '../test_data/bio/C220197A-P2.h5') # Outputcell to be saved output_cell_name = os.path.join(dir_path, './local/Neuron_diam') ...
92d813b8088d60beaaa888af11218478ef31c23af82a93cf69557c67aee4061f
Python
767
29
import sqlite3 from .db import DB class DBProperties(DB): def __init__(self): super().__init__() self.table_name = 'Metadata_DB_Properties' self.table_desc = 'Tracks key metadata for the database' self.cols = self.getcolumns() def getcolumns(self): cols = { ...
31ea1e6eee286a0f30069fc68c2a2d7de9add7bd66384be32eacf736b647002b
Python
768
26
""" This module is the main script to launch the training process """ import argparse import logging import torch from training_manager.training_factory import TrainingFactory from config_manager.config_manager import ConfigManager if torch.cuda.is_available(): logging.getLogger().setLevel(logging.INFO) else: ...
c6fe01f5944b78b06b46da4031b5f27f0b3123db118633f2f1be2bac79be5a11
Python
768
28
# Generated by Django 3.0.4 on 2020-03-24 15:27 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('biomedisa_app', '0066_auto_20200324_1626'), ] operations = [ migrations.AlterField( model_name='mushroomspot', name=...
f21e1c6d28e93e659a14b006b89e91d1149aab0ab5b63a56bd2cd17ca0c1b4d1
Python
768
25
import os import nibabel as nib import matplotlib.pyplot as plt import shutil from tqdm import tqdm dp = 'PATH_TO_KITS_DATA_FOLDER' # should be .../kits21/kits21/data tp = os.path.join(os.environ['OV_DATA_BASE'], 'raw_data', 'kits21') timp = os.path.join(tp, 'images') tlbp = os.path.join(tp, 'labels...
f6cd620b3a7a6e59999b3e6e548c0cbd7ff00630e27a994ef4f8252ad7d5a912
Python
768
35
"""Base class of classifier for the number detection """ import torch from torch import nn class Classifier(nn.Module): """Base classifier class """ def __init__(self, params): super().__init__() @staticmethod def getDataLoaders(): raise NotImplementedError() def forward(sel...
16b1b2846676a041e4e2262b3d2df7f440a6eea1e761671704f32d1a39601eba
Python
769
32
from shapely.geos import geos_version_string as shapely_geos_version from pygeos import geos_capi_version_string import warnings # shapely has something like: "3.6.2-CAPI-1.10.2 4d2925d6" # pygeos has something like: "3.6.2-CAPI-1.10.2" if not shapely_geos_version.startswith(geos_capi_version_string): PYGEOS_SHAPE...
19cf4e1339ce002c447ec138995d0cdc51fc52950c151bd5dd69c4360af276dc
Python
769
25
import os import random import pickle as pkl import imodelsx import json from typing import List import tqdm if __name__ == '__main__': distribution_pairs = json.load(open('benchmark.json')) all_h2score = [] for i, d in enumerate(tqdm.tqdm(distribution_pairs)): print('examples', len(d['positive_sa...
c315ae1afc0aec484abffa6c30454967a2dc27c382b3f4cc2459744255a0a7e8
Python
769
22
import lammps.PES as PES from collections import OrderedDict import torch def jit_pes(): init_pes=PES.PES() state_dict = torch.load("EANN.pth",map_location='cpu') new_state_dict = OrderedDict() for k, v in state_dict['eannparam'].items(): if k[0:7]=="module.": name = k[7:] # remove `...
faee2f62a4c51cb6a97055f92bc0f9816b3eb665ca3583d28d4226d564e1804c
Python
769
23
import torch.nn as nn import torch.nn.functional as F class BackwardsOnlyLeakyReLU(nn.Module): """ Acts like a ReLU in the forwards direction, but in the backwards direction, it acts like a leaky ReLU with a negative slope of `slope_on_negatives`. """ def __init__(self, slope_on_negatives): ...
002ea03f2e9c24c998454783e72e1182046f9bad58a51df4e0a70a5b20325921
Python
770
1
import numpy as np import pandas as pd import time import random # [1] data preprocessing # df = pd.read_csv('./data/GSE72056_melanoma_single_cell_revised_v2_gene_filtering.csv', index_col=0) # dimension = (genes x cells) print("starting preprocessing:") n1 = df.shape[0] # row genes n2 = df.shape[1] # col cells ce...
080b94ba584650b2e27d7d5f509adbad501f00233d4628941cd752efe7ebfb6a
Python
770
28
import unittest import numpy as np from scipy import integrate as scipy_integrate from spitfire.time.integrator import odesolve class TestComparisonToSciPyIntegrate(unittest.TestCase): def test_lotka_volterra(self): a = 1. b = 0.1 c = 1.5 d = 0.75 def rhs(t, x): ...
1ef7486dd9fdb8423ebe058a87a2284205d1f15da32978fcf10fd811d9e217e6
Python
770
37
import seaborn as sns from matplotlib import pyplot as plt sns.set_style('whitegrid') stimes = """27:09.25 23:05.32 15:00.63 13:05.17 11:26.52 12:06.25 11:37.36 11:35.57 11:38.39""" def to_secs(t): m, s = map(float, t.split(":")) return s + 60 * m times = [to_secs(t) / 60. for t in stimes.strip().split()] ...
8fde7468eeb2a415c298f4a29ceb4d9fe108019105878105edf358fbfb577ced
Python
770
24
"""Tests for specparam.modes.paramdef.""" from collections import OrderedDict from specparam.modes.paramdef import * ################################################################################################### ################################################################################################### ...
16c3b67376c8bc7844a41d0dc81039ee8513720f23f9f0365ac32d9067d30e02
Python
771
27
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._cells import Cells from ._domain import Domain from ._header import Header from ._hoverlabel import Hoverlabel from ._legendgrouptitle import Legendgrouptitle from . import cells from . import header from . import hove...
3cdfa13edb5506814a676709477a3cd9d2ce7456f75129ba230924ae1c248983
Python
772
27
"""Manipulate Python warnings.""" import logging import warnings _wlog = logging.getLogger('py.warnings') _wlog.addHandler(logging.NullHandler()) def _warn(message, category=None, stacklevel=1, source=None, **kwargs): """Redefine the warning function.""" if category is not None: category = type(cate...
2df9eadd42278907e3532cf0708d2c4ca3ecdc51bc731d55589ad9e38f45367b
Python
773
35
"""Private registry kernel package (architecture memo 6.1; never public API). One private kernel; many typed public domain doors; no public universal registry. Domain doors import from here; users import the doors. """ from __future__ import annotations from .kernel import ( TORCHLENS_PROVIDER, MissingProvid...
fdbd149ee5049422830e69359b44e7a5fafd73b15ec139744fabf4189cebefbb
Python
773
30
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) fraction_of_standard_epoch = 5509 / 162706 msp.decay_per_epoch = 0.9 ** fraction_of_standard_epoch msp.architecture["num_motifs"] = 82 msp.architecture["motif_model_spec"] = dict( type="PSAMMotifModel", motif_spe...
30b599ff9f2bff1410b4b4bd4db4efb566fc8dca9396470de13e3e2b7b104701
Python
774
28
import json def fix_ids(objs): objects_list = json.loads(objs.to_json().replace('\"_id\"', '\"id\"')) return objects_list def td_format(td_object): seconds = int(td_object.total_seconds()) periods = [ ('year', 60*60*24*365), ('month', 60*60*24*30), ('day', ...
3a5a704d99150927112c1df0de696f021c77ce05b0ef916b95c1e5df3a89e21f
Python
774
36
#!/usr/bin/env python """ Convert from pileup file to interval index file. usage: %prog <options> in_file out_file """ import optparse from bx.interval_index_file import Indexes def main(): # Read options, args. parser = optparse.OptionParser() options, args = parser.parse_args() input_fname, outp...
a73d4894df45bbcb6e5ca3518f04bd821195c82e678b7bf6f32c2093fe80d708
Python
774
24
"""Tests for specparam.plts.event.""" from pytest import raises from specparam import SpectralTimeEventModel from specparam.modutils.errors import NoModelError from specparam.tests.tutils import plot_test from specparam.tests.tsettings import TEST_PLOTS_PATH from specparam.plts.event import * #####################...
1d3d82676c8a075ca569205416d7349f2165a213f39a373f46e6af0e7dd473b2
Python
775
23
import argparse import pandas as pd from statsmodels.stats.multitest import fdrcorrection parser = argparse.ArgumentParser() parser.add_argument("--coords", action = "store", help = 'table with dapeak results') parser.add_argument("--out", action = "store", help = "output file") parser.add_argument("--alpha", action...
2745c1c6a1229aae06af2c2b9d56ba13af14e2aa621f61ef21cc3e751024354c
Python
775
30
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) fraction_of_standard_epoch = 64764 / 162706 msp.decay_per_epoch = 0.9 ** fraction_of_standard_epoch msp.architecture["num_motifs"] = 82 msp.architecture["motif_model_spec"] = dict( type="PSAMMotifModel", motif_sp...
5a3afe85bbc5fa143b0bd2e1c6c9300db34170d7a05d26c6f57501487453e9e3
Python
775
35
from modular_splicing.models_for_testing.models_for_testing import ( EndToEndModelsForTesting, ) def create_series(name, path, donor_seed, model_seeds, density): return EndToEndModelsForTesting( name=f"{name} d={donor_seed}", path_prefix=path, seeds=[x * 1000 + donor_seed for x in mode...
664f86e67d46bb8891f62a7af0f2466e7487be623861ada9fff66e603b3f6356
Python
775
26
import sqlite3 from .db import DB class TMinusOneCumulativeSummary(DB): def __init__(self): super().__init__() self.table_name = 'KL_cumulative_summary_t_minus_one' self.table_desc = 'Summary of COVID-19 cases till T Minus One' self.cols = self.getcolumns() def getcolumns(se...
ce1595da4cbbe325897146cbe831d799bcbad9e73e3e1b7bef062f9bda9cbf0a
Python
776
33
import sys import unittest sys.path.append("..") from llspy import parse class FilenameTests(unittest.TestCase): def setUp(self): self.example_name = ( "cell5_ch0_stack0006_488nm_" "0005280msec_0020936553msecAbs.tif" ) self.dict = { "abstime": 20936553, ...
fffeb716a5c5aa13534b24c6623e32631f190e87b0d3fb821c75a1265ac84680
Python
776
31
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in May 2023 """ import numpy as np from scipy import sparse from sknetwork.path.distances import get_distances def breadth_first_search(adjacency: sparse.csr_matrix, source: int): """Breadth-first ordering starting from some node. Parameters ---...