sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c38d21c6bd1227ddafb070c8bac94cc44de7ca6be76c302efb7f9ded1dbb4d5a
Python
1,010
15
from __future__ import absolute_import from . import utils from . import paths from . import setup_hd_glio print("\n########################") print("If you are using HD-GLIO, please cite the following papers:\n") print("Kickingereder P, Isensee F, Tursunova I, Petersen J, Neuberger U, Bonekamp D, Brugnara G, Schell M...
e8c4ef776244dc9a619693ac5b0c93fbdd28f3c40fb941ca3d2b36d2bcb09a85
Python
1,010
27
"""Test functions for specparam.params.converter.""" from specparam.params.converter import * ################################################################################################### ################################################################################################### def test_base_param_con...
a50b9e17ea7e47a5578479d28a78ec11dc3c1b702299b66c96930b262bd93745
Python
1,011
33
import os import argparse import ont_fast5_api.multi_fast5 as ml import sys def main(): parser = argparse.ArgumentParser(description="you should add those parameter") parser.add_argument('-i', required=True, type=str, help='fast5 data dir') parser.add_argument('-o', default=None, type=str, help='save id fi...
2cd0cec90e559e4dccbd4755da6e8e3f11fc8185c37ce3f3d2bc7f713a06f63f
Python
1,012
40
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import os.path import sys import pandas as pd import argparse DEFAULT_THRESHOLD = 12. def main(): parser = argparse.ArgumentParser(description='Selects transients based on amplitude criterium.') parser.add_argument('files', nargs='+',...
b097715b9c4c2f2e246ba4403363b90a33372543d7d3ed066eae5a0c226f02c3
Python
1,012
36
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["motif_model_spec"] = dict( type="PSAMMotifModel", motif_spec=dict(type="rbns"), exclude_names=("3P", "5P"), ) msp.architecture["sparse_spec"] = dict(type="S...
d087e502d776c3abad2cb42379f63cd12d69122dbbee8ff23e06863dacf0d81e
Python
1,012
26
from set_transformer_modules import * class SetTransformer(nn.Module): def __init__(self, dim_input, num_outputs, dim_output, num_inds=32, dim_hidden=128, num_heads=4, ln=False, num_sabs=2): super(SetTransformer, self).__init__() if num_sabs == 2: self.enc = nn.Sequential( ...
03ad6157a1bb897e6276202fe2e99a33880252ada1fa881c40d2babd9071ec41
Python
1,013
46
#!/usr/bin/env python import numpy as np import seaborn as sns import matplotlib.pyplot as plt from scipy.sparse import * from scipy.io import mmread import argparse parser = argparse.ArgumentParser(description='Plot weight histogram.') parser.add_argument('--input', type=str, default='lastrun/input_con.0.wmat', he...
ba7b53be42bcb7cce008a448e3cc3c45c7d86e614a24a2f3b757a2373f52a9d5
Python
1,013
43
#!/usr/bin/env python import sys from Bio import SeqIO def main(): input_file = open(sys.argv[1], "rU") output_file = open(sys.argv[2], "w") filtered_records = [] output_file.write("##gff-version 3\n") for record in SeqIO.parse(input_file, "fasta"): seq_start = 1 seq_id = recor...
ff22a628f1d95d52b0879028999b8ea9004fe0a324aa5f0a446d96f11364c76a
Python
1,013
26
''' Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands 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 requir...
034ddf8c7cd6e3b8732010b05dbe376c0a9472f85d822529a5ebf89effe1499a
Python
1,014
30
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ This script: Loads the labeled dataset from labels.pkl. Splits images into training and testing datasets. Moves one image per person (if at least 4 exist) to the testing dataset. """ import pickle import os # Load the labeled dataset with open('pickle_labels/labels....
0dea743f839d131f9788c916945546e65207ca9f9ee78acd02e957cbe7af0e41
Python
1,014
36
import glob import sys import os from setuptools import setup, find_packages, Extension from Cython.Distutils import build_ext import pysam test_module_suffix = os.path.dirname(os.path.abspath(__file__)).split(os.sep)[-1] test_module_name = "PysamTestModule_{}".format(test_module_suffix) pysam_libraries = pysam.get...
7a6ed64d893e71aecbe765327420ed75aef97a7d2b9195c3a6214d04b80247c8
Python
1,014
17
from .base_options import BaseOptions class TestOptions(BaseOptions): def initialize(self, parser): BaseOptions.initialize(self, parser) parser.add_argument('--results_dir', type=str, default='../results/', help='saves results here.') parser.add_argument('--phase', type=str, default='test'...
ba9403791ae763a49e195d81415f83c5f032277649f8014f20728caf4cab9ca9
Python
1,014
39
from os import path import setuptools path_to_repo = path.abspath(path.dirname(__file__)) with open(path.join(path_to_repo, "readme.md"), encoding="utf-8") as f: long_description = f.read() required_pypi = [ "numpy", "scikit-learn", "pandas", "tqdm", "dict_hash", # required for caching "...
f51c2234fb89f94edd67500f9f0d2bd84ab377e11a71254abde5f9fe6cde19c7
Python
1,014
28
import unittest from os.path import join, abspath from numpy.testing import assert_allclose from tests.tabulation.adiabatic_burke_schumann.rebless import run from spitfire.chemistry.library import Library from spitfire.chemistry.ctversion import check as cantera_version_check if cantera_version_check('atleast', 2, ...
e0c65f2b291461236b27e949f98e13e0522c772e7ccb8c5c37a4a21ec04a7dd7
Python
1,015
26
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from ultralytics.models.yolo.detect import DetectionValidator __all__ = ["NASValidator"] class NASValidator(DetectionValidator): """Ultralytics YOLO NAS Validator for object detection. Extends DetectionValidator from the Ultralytics models...
4c5d8aa26be804484965fc69b17f4146511d82fb9caba6ed19a035e94a64b752
Python
1,016
27
__author__ = 'cenwan' #-----Please download the 'GOTerm_List.txt' file via http://bioinfadmin.cs.ucl.ac.uk/downloads/FFPredGAN/ with open(".../GOTerm_List.txt") as ScriptFile: GOTermsRaw=ScriptFile.readlines() GOTerms=[] for index in range(0,len(GOTermsRaw)): GOTerms.append(GOTermsRaw[index].strip()) #-----...
4b02880032538f20f691530da8115d2543c48631d83dd024dc69ce93d27c3801
Python
1,017
27
# 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...
a541a81bcfecef58f33e02483b6a5355859b59413250d9bdc8c9362b3a4b2090
Python
1,017
38
import random def create_sublists(l, size: int): """ Divides list into sublists with given size, e.g. [1, 2, 3, 4, 5] --> [[1, 2], [3, 4], [5]] Last sublist might conatin less eleents, if len(l) not dividable by size. :param l: list :param size: size of sublists :return: list with sublists ...
c68da5bb2373bd7bdda14761fdf5a69800c3f26435976f5eca7ccee3bf483357
Python
1,017
29
import os from shutil import copy def check_dir_exists(path): if not os.path.exists(path): os.mkdir(path) def split_by_name(dir_path, real_save_path, fake_save_path): check_dir_exists(real_save_path) check_dir_exists(fake_save_path) if not os.path.exists(real_save_path): os.mkdir(real...
47b7e754933806ae0c08be0daa85b30c790af10e6b59ecbe9975fc08943c4c4f
Python
1,018
30
import argparse import os import torch import numpy as np from transformers import * from src.data.Batcher import Batcher from src.utils.Config import Config from src.utils.util import device from src.adapet import adapet from src.eval.eval_model import test_eval if __name__ == "__main__": parser = argparse.Argum...
91d44cd18032c3245113d641be22a1247020fafa9d067c683bed29fa4928cf66
Python
1,018
38
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="PreprocessedSpliceAI", preprocessor_spec=dict(type="Identity"), spliceai_spec=dict(type="SpliceAIModule", output_size=3), ) msp.data_spec = dict( type="H5Dataset", datapo...
e5a17b08843011d2f6ed4ee827d007c79ab2b1beaa0ad65eab28af4c482582d9
Python
1,018
29
import argparse import os import torch import numpy as np from transformers import * from src.data.Batcher import Batcher from src.utils.Config import Config from src.utils.util import device, ParseKwargs from src.adapet import adapet from src.eval.eval_model import dev_eval if __name__ == "__main__": parser = ar...
3d6d0c4b509c982e76439ec08f73fbaa6c58f099774cfd006681e0c9e8ba5359
Python
1,019
35
import pandas as pd def format_time(minutes): days = int(minutes // (24*60)) remainder = minutes % (24*60) hours = int(remainder // (60)) remainder2 = remainder % (60) minutes = int(round(remainder2)) return f'{days}D:{hours}Hr:{minutes}m' def estimate(test_ism_time,train_mdig_time): ...
5ba54932decd9288b9eb0ad91d04c1299d2537b753c226a93e87518869d6ac87
Python
1,021
35
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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature...
863268995a9b36770f63d02bfadfd501bbb94047e9ed8a2b522741b1b480733c
Python
1,021
30
# -*- coding: utf-8 -*- # # # RectiPy software framework for recurrent neural network training in # Python. See also: https://github.com/pyrates-neuroscience/RectiPy # # Copyright (C) 2022 Richard Gast. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pub...
b5caa82fe75d1a7d4e9a1006ded76afef405816e0c406c034d3d8a6b116e1743
Python
1,021
33
#!/usr/bin/env python import os import sys import pandas from deepspeech_training.util.downloader import maybe_download def _download_and_preprocess_data(data_dir): # Conditionally download data LDC93S1_BASE = "LDC93S1" LDC93S1_BASE_URL = "https://catalog.ldc.upenn.edu/desc/addenda/" local_file = ma...
ead446d4a870c580b9606cc1844a4f3bef4fef1122fb39dcfcaa6a0512a74570
Python
1,022
34
import numpy as np from .hsmm_model import HSMM def fill_gaps_in_probability(p): [nonzero_indices] = np.nonzero(p) starts, ends = nonzero_indices[:-1], nonzero_indices[1:] gap_size = ends - starts > 1 starts, ends = starts[gap_size], ends[gap_size] pnew = p.copy() for start, end in zip(starts...
136b509287874ae224181de418d1cd6b6f75a11a1587d08af3f19cb46362197d
Python
1,023
36
#!/usr/bin/env python """Tests for `stlearn` package.""" import unittest import numpy.testing as npt from stlearn.classes import Spatial from .utils import read_test_data adata = read_test_data() class TestSpatial(unittest.TestCase): """Tests for `stlearn` package.""" def test_setup_spatial(self): ...
d227cf7333b679aab714114ff05d7f06d2a64aafb9d8df64adaa6f859c54cc72
Python
1,023
29
# 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...
236d2c202af0c70b7b8a60f0b7b762eb5dafb941880474abe5e420967fa92355
Python
1,024
39
from celery import Celery from celery import Task from flask import Flask from flask import render_template def create_app() -> Flask: app = Flask(__name__) app.config.from_mapping( CELERY={ "broker_url": "redis://localhost", "result_backend": "redis://localhost", "...
51aaa0b9f496cb1e44c0c8e3e56c4375546f623b17a73224013161dd8e09aea9
Python
1,024
25
from setuptools import setup, find_packages from Cython.Build import cythonize import numpy as np with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( name='biss', version='1.0.0', author='Martin Weigl, Adrian Slowak, Emma Kiemeyer, Ines Langthallner, Daniel Ritzber...
d719f1354be6df49beea97fc2a2e924e5648949eab0b1b170243aec3f3f5730e
Python
1,024
52
# Create your tasks here from demoapp.models import Widget from celery import shared_task @shared_task def add(x, y): return x + y @shared_task def mul(x, y): return x * y @shared_task def xsum(numbers): return sum(numbers) @shared_task def count_widgets(): return Widget.objects.count() @sha...
edf42e96f2b317dc840652e27bb7cbe46d59772886e030056506782e2c7deaab
Python
1,024
32
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """tests for regression API""" import unittest from sknetwork.data.test_graphs import test_bigraph, test_graph, test_digraph from sknetwork.regression import * class TestAPI(unittest.TestCase): def test_basic(self): methods = [Diffusion(), Dirichlet()] ...
0fcb667d2b426a1eb187d38b847f6658bafbeeae1a921839f3460724c2a9ab76
Python
1,025
33
import codecs import locale import re import sys BOMS = [ (codecs.BOM_UTF8, 'utf8'), (codecs.BOM_UTF16, 'utf16'), (codecs.BOM_UTF16_BE, 'utf16-be'), (codecs.BOM_UTF16_LE, 'utf16-le'), (codecs.BOM_UTF32, 'utf32'), (codecs.BOM_UTF32_BE, 'utf32-be'), (codecs.BOM_UTF32_LE, 'utf32-le'), ] ENCOD...
1ff536341c06fc42c0f76af8580619b15d91a878c0d215d4565410bd5dc86837
Python
1,025
42
import logging from abc import ( ABCMeta, abstractmethod, ) from collections.abc import ( Iterable, Mapping, ) from typing import ( TYPE_CHECKING, Union, ) from galaxy import exceptions if TYPE_CHECKING: from galaxy.model import ( DatasetCollection, DatasetCollectionElement...
67909aaf02fc3f54f2b7cb2cadda33348cd2e71ccd5685454461114dd7164fa3
Python
1,025
24
import argparse from src import datasets def main(args): pc_builder = datasets.PCBuilder(args.root, args.model, args.layer, args.dataset, args.ntau, args.nlat, args.nspan, args.scale, args.n_pca) pc_builder.fit_and_transform(args.batch) if __name__ == "__main__": parser = argparse.ArgumentParser(descrip...
ca586bbcfb948e113a0b90add7d5242e8c4212972697eff23a0b13f45485c45f
Python
1,025
34
import sqlite3 from .db import DB class Overview(DB): def __init__(self): super().__init__() self.table_name = 'GA_overview' self.table_desc = 'CASE INFO' self.cols = self.getcolumns() def getcolumns(self): cols = { 'date': 'DATE NOT NULL PRIMARY KEY', ...
92c04076506fbc96f68e781c9c779982be5d38817b4a49c8f2ea3d14dd53b1c8
Python
1,026
31
from numpy.testing import assert_array_equal from pyriemann.channelselection import ElectrodeSelection, FlatChannelRemover def test_electrodeselection(get_covmats, get_labels): """Test transform of channelselection.""" n_matrices, n_channels, n_classes = 10, 30, 2 covmats = get_covmats(n_matrices, n_chann...
a6b2abcdf43965958e359e31bc5c373b22050fbf2e470efed72e6fd8677356aa
Python
1,026
29
import sys import os.path as op import mne import pandas as pd import scipy import numpy as np from zapline_iter import zapline_until_gone try: base_dir = sys.argv[1] pipeline = sys.argv[2] step_path = sys.argv[3] except: print("incorrect arguments") sys.exit() subjects=pd.read_csv(op.join(base_d...
ebb2ad0ba3624f7156a203da8602065008ce81a0a790fb79f21e3f1d7463176c
Python
1,026
43
"""Util functions.""" import cPickle import pandas as pd __author__ = "Gianluca Corrado" __copyright__ = "Copyright 2016, Gianluca Corrado" __license__ = "MIT" __maintainer__ = "Gianluca Corrado" __email__ = "gianluca.corrado@unitn.it" __status__ = "Production" def feature_size(store_name): """Number of featur...
c1a9dca168497c6b7d7f86f418aba3f34edc2113821abf05b47b3674b882eac6
Python
1,027
29
# -*- coding: utf-8 -*- ''' Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands 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/LI...
5021a8eba0fa4b388bc200f9449a1642dbd05d42d61fbe73fa232d6a435d3267
Python
1,028
29
# -*- coding: utf-8 -*- ''' Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands 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/LI...
259d63467a357aa67d187de050e3b2dffa02e7578cbeb223f0c6f933aa590343
Python
1,029
38
import json import os from caper.caper_labels import CaperLabels def test_create_file(tmp_path): cl = CaperLabels() backend = 'my_backend' custom_labels = tmp_path / 'my_custom_labels.json' custom_labels_dict = {'hello': 'world', 'good': {'bye': 'bro'}} custom_labels.write_text(json.dumps(custo...
3fb78644fe19faf05f4fe6c45ec39c41da14602937d5a927c4f4020bffeddf9f
Python
1,029
33
import sys sys.path.append("models_architectures/") from wrapper_prot_bert_BFD import WrapperProtBertBFD from transformers import AutoTokenizer, AutoModel import os import torch Model_name_on_hugging_face = "Rostlab/prot_bert" d_model = 1024 saving_directory = "data/models/pre_trained_models/" model_directory = "Prot...
4d2058d87b22bb430b1b968c8e09b972436db3514fd40b19e4ccf89d8ba0ba72
Python
1,029
40
import numpy as np def specificity_index(img_sem, img_syn, masker, threshold=4): """ Compute the sensitivity score which is the ratio: np.log10(x_sem/s_syn). Args: - img_sem: - img_syn: Returns: - sensitivity_score: float """ def f(a, b): a = max(a, 0) b = ma...
4d558d38ab70ae7bdbed669c5ce958d392da1952ae883d66d6332ed9731ae6a8
Python
1,029
27
"""Post-build smoke test run by cibuildwheel against each built wheel. Imports the installed wheel (cibuildwheel runs this from outside the source tree, so ``import pyrosm`` resolves to the wheel, not the repo) and parses the bundled ``test_pbf`` extract end to end, exercising the compiled Cython pipeline. Kept depend...
628f334b4cedd031510933613e5207a542d35961d5a543eb3183eaea4ed74144
Python
1,029
39
#!/usr/bin/env python """Tests for `stlearn` package.""" import unittest import stlearn as st import scanpy as sc from .utils import read_test_data import numpy as np global adata adata = read_test_data() class TestPSTS(unittest.TestCase): """Tests for `stlearn` package.""" def test_PSTS(self): ...
a77aed2374c736c5621f510c77feedf5b99d4b1b9ca8e2c4d5add9244a3aed7f
Python
1,030
29
import numpy as np import seqpro.rag as r from seqpro.rag import Ragged def test_concatenate_ragged_axis_prepend_regular(): # prepend a size-1 pad per group (the prepend_pad_itv use case) base = Ragged.from_offsets( np.array([10, 11, 12], np.int32), (2, None), np.array([0, 2, 3], np.int64) ) # [[...
e50dc47bef7536588523d40c6bba797bcc2b7a39a2c3e66efd42b478b3a4605d
Python
1,030
29
""" This module create TransformerClassifContact """ # pylint: disable=W0223 import torch.nn as nn class TransformerClassifContact(nn.Module): """ This class define a Transformer model that classify each couple of amino acid of a protein """ def __init__(self, transformer_embedder, dropout): ...
080941c8fc90430165d3fa204e83c00220cf4e60af6c7632e856dac072a490fc
Python
1,031
31
from setuptools import setup, find_packages import os setup( # Needed to silence warnings (and to be a worthwhile package) name='ovseg', url='https://https://github.com/ThomasBudd/ovseg', author='Thomas Buddenkotte', author_email='thomasbuddenkotte@googlemail.com', # Needed to actually package ...
221bece523e22572575b3451ea79ffcf4b81a6a8c863081ff2d1d26588b00a7d
Python
1,031
34
#!/usr/bin/env python import sys from zipfile import ZipFile from pathlib import Path suffix_out = '.contents' def create_contents(f): file_zip = Path(f) # remove suffix_out if present if len(file_zip.suffixes) > 0 and file_zip.suffixes[-1] == suffix_out: file_zip = Path(file_zip.stem) file_o...
5576a43ca545f5d24c54c007ab85379f17c489ef2183ff36e660ec39250009ef
Python
1,031
35
import sqlite3 from .db import DB class DistrictCasesTable(DB): def __init__(self): super().__init__() self.table_name = 'WB_district_cases' self.table_desc = 'West Bengal district wise case info' self.cols = self.getcolumns() def getcolumns(self): cols = { ...
63720f02cf0ea52da6917688bfc7e2601f486d4848374752c6c2f386c58676c9
Python
1,031
33
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> import wx import wx.html # wx.html2 causes ImportError on some Ubuntu installations from .frame import EelbrainFrame class TextFrame(EelbrainFrame): "Read-only text frame, shows itself" def __init__(self, parent, title, text, *args, **kwargs): ...
b6ce97d1213f389126e73f7402b1c58ac29e4dc19eca5048ed57b6e9ce1669df
Python
1,031
33
class Tokenizer(object): """A class to turn arbitrary inputs into integer classes.""" def __init__(self): # the default class for an unseen entry during test-time self._data = {"unk": 1} self.num_classes = 1 self.train = True self.unknown = [] def __call__(self, ite...
b75746ece5fea28a4b54b72005069d2c5d554549ddb2cae04177a452d07aa1e8
Python
1,031
36
# -*- coding: utf-8 -*- # @Author : Yue Liu # @Email : yueliu19990731@163.com # @Time : 2021/11/25 11:11 import torch import random import numpy as np from .kmeans_gpu import kmeans from sklearn.cluster import KMeans from .evaluation import evaluation def k_means(embedding, k, y_true, device="cpu"): """ ...
fa32257c97c1dfd009c74ee4b2e227df8f267b2038d7f482adc1838536a68b86
Python
1,031
28
import morphio, neurom, tmd from tns import extract_input from tns.generate import diametrizer k0 = neurom.load_neuron('../test_data/bio/C220197A-P2.h5') model0 = extract_input.from_diameter.model(k0) n0 = morphio.mut.Morphology('../test_data/bio/C220197A-P2.h5') diametrizer.build(n0, diam_method='M1') # Constant ...
94e1a9c21bba5f4d1dd9955dc1fbfa4ef3f300755b8999df8b6c3492eb4eb56c
Python
1,032
35
import sys from ij import IJ # Fiji Jython interpreter implements Python 2.5 which does not # provide support for argparse. input = sys.argv[-7] iterations = int(sys.argv[-6]) count = int(sys.argv[-5]) black_background = sys.argv[-4] == "yes" pad_edges_when_eroding = sys.argv[-3] == "yes" tmp_output_path = sys.argv[-...
c19f9062dbf24f0e831459022b29c086ef5922bb8f50ddd722efcb7aa335def3
Python
1,032
30
"""End-to-end Python-level benchmarks for the Rust tokenize/translate port. Run: pixi run -e dev pytest benches/bench_tokenize_translate.py --benchmark-only Measures the public API (including PyO3 marshalling), which Rust-only criterion misses and which decides the small-array regime. To compare against the Numba bas...
34c7037a53b9cbdb5e15fbd9e6091b449cdf7f308aced9533b43ead32f29f77a
Python
1,033
29
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import av def get_video_container(path_to_vid, multi_thread_decode=False, backend="pyav"): """ Given the path to the video, return the pyav video container. Args: path_to_vid (str): path to the video. ...
d2d326323bc74d2c6ec940df37858b26ad3a1c0fb5a3de041c338ead556c66cb
Python
1,033
40
import torch.nn as nn from modular_splicing.models.modules.sparsity.sparsity import SparseLayer class NoSparsity(SparseLayer, nn.Module): """ Acts like a sparse layer but does not actually enforce sparsity in any way. Pretends to have sparsity to keep code that interacts with it happy. """ def ...
27d2e1226f33c3b07fd98d0d919b64e4743cdaed791b9b78f094bfe3f5a72ab9
Python
1,034
28
# ruff: noqa -- harvest-time provenance script, committed as run (lint header added at import) import warnings p = "/tmp/eco_r3/art_v2.16.0_portable" import torchlens as tl print("reader", tl.__version__, end=" ") try: from torchlens.io import detect_tlspec_format print("| detect:", detect_tlspec_format(p)) ...
290952819b6b847b466514cd3c4ab63baa7e2078146dc1955383c6536a63b698
Python
1,034
34
import sqlite3 from .db import DB class DistrictMucormycosisCasesTable(DB): def __init__(self): super().__init__() self.table_name = 'UK_mucormycosis_cases' self.table_desc = 'Uttarakhand mucormycosis case info' self.cols = self.getcolumns() def getcolumns(self): col...
3b71ed4355020f86582c18b4449f02173dff7aa45d60979505df7409dad9af0d
Python
1,034
35
import sys from ij import IJ # Fiji Jython interpreter implements Python 2.5 which does not # provide support for argparse. input = sys.argv[-4] black_background = sys.argv[-3] == "yes" tmp_output_path = sys.argv[-2] output_datatype = sys.argv[-1] # Open the input image file. input_image_plus = IJ.openImage(input) ...
d5593a7d0f2f34a77beabb88fa3f09c87000d40ee808f46b95c6a44665cf9dba
Python
1,034
34
""" Barcode utils """ import logging import numpy as np from tmd.Topology.transformations import tmd_scale from tmd.Topology.statistics import get_lengths L = logging.getLogger(__name__) def scale_barcode(ph, target_distance): """ Given a target distance, scale the persistence homology in order to make sure...
02284951ae814ef9cc020d7282ca41bae400acef50b3366d7cab3f3764955d7f
Python
1,035
33
import torch.nn as nn from models.mn.model import get_model as get_mobilenet from models.dymn.model import get_model as get_dymn from helpers.utils import NAME_TO_WIDTH class EnsemblerModel(nn.Module): def __init__(self, models): super(EnsemblerModel, self).__init__() self.models = nn.ModuleList(...
34d9bde7916107adb4e92f04582f5e945e9b2a48600f10d39bcc8b0d9cc8ec44
Python
1,035
43
""" Widget for editing an arena's dimensions and geometry. """ from __future__ import annotations import param from .widget_base import ( collapsible_family_box, numeric_tuple_param_control, param_control, ) __all__ = ["build_area_widget"] def build_area_widget(area: param.Parameterized) -> object: ...
5b71f7d05bd19fb680b662565618a88d1cc94dd904f501040b96c468da8b33ed
Python
1,035
38
from functools import wraps import time import numpy as np _profilerDict = {} def timeit(func): @wraps(func) def timeit_wrapper(*args, **kwargs): start_time = time.perf_counter() result = func(*args, **kwargs) end_time = time.perf_counter() total_time = end_time - start_time ...
73df79e2727cfeca90c584fb72a4411ebeb7a9033c7734370f48f2f80f8046fd
Python
1,035
24
import subprocess import boto3 batch = boto3.client('batch', region_name='us-east-1') response = batch.describe_job_definitions(status='ACTIVE')['jobDefinitions'] instance_type_info = {} for res in response: jobDefinition = res['jobDefinitionName'] # example: gluon-cv-p2_8xlarge:1 instance = jobDefinition.spli...
a04572a9e47f3cfe0835fe8cb39b5ba415fd23c3bd415d7243c1b93010124a00
Python
1,035
37
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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.arch...
d6b3caca99e4037f9c351aa7814905f4a625ae435edd234a509a5297f75104e4
Python
1,035
31
import encodings.idna # noqa: F401 import os import socket import pytest from pyjibe.head import update with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: try: s.connect(("www.python.org", 80)) NET_AVAILABLE = True except socket.gaierror: # no internet NET_AVAILABLE...
2ded5b73f5446350cc18ba58fdb7a2352548a8340904e623626686e8b2193520
Python
1,036
29
# coding=utf-8 # Copyright 2022 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...
494aae6fe60814835bdbf82d2830159c0b6547ea6ebb1d1adaf6a7c6bcaef7bd
Python
1,036
31
from pyabf.abf2.section import Section class UserListSection(Section): """ Contains elements of the ABF2 user list. The user list allows custom values to be used as part of the epoch table. """ def __init__(self, fb): Section.__init__(self, fb, 172) self.nULEnable = [None]*self._...
a2b973f6c953910485fbf41543142b317e4c726289ac3f09d7fd42d4617e60d4
Python
1,036
33
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._domain import Domain from ._hoverlabel import Hoverlabel from ._insidetextfont import Insidetextfont from ._legendgrouptitle import Legendgrouptitle from ._marker import Marker from ._outsidetextfont import Outsidetextfont ...
acdef38ce17e04582842d2c01e13c875d1b14a92721aa46a128ad77d79922078
Python
1,036
31
import numpy as np import cv2 from tqdm import tqdm from glob import glob def main(): for f in tqdm(glob("/home/rassman/bone2gene/data/masks/unet/*/*.png")): if "vis" in f or "bone_age" in f: continue raw_prediction = cv2.imread(f, cv2.IMREAD_GRAYSCALE) binary = (raw_predictio...
5fcea8002ba9aa95cf782c235757040a7c0e5b4668652c47d8d2d7fb9306641b
Python
1,037
37
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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.arc...
6aed9e1803926eb27cb2dec1596846d164983cd9dcf2f583f03158326eb7eae7
Python
1,037
43
import torch def cindex_approx(labels, risk, sigma=1.e-3, reduction_fn=torch.sum): """ According to https://www.medrxiv.org/content/10.1101/2021.10.11.21264761v1.full.pdf section 3.4 """ t = labels[:, 0] e = labels[:, 1] n = len(t) # has the times as row vector repeated along rows ...
745446921b7bd55e93631e3fcc13a5651ec6348829d9f32b1293b01c750956e4
Python
1,037
42
from sys import argv from msp import MSP, rbnsp_split_90 msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.batch_size = msp.batch_size // 3 msp.lr = float(msp.lr) / 3 msp.architecture["num_motifs"] = 172 msp.architecture["channels"] = 200 psam_model = dict( type="PSAMMotifModel", motif_spec=dict(t...
cee2efc910660f5fe41aeabac0856b7e9ab30d42d8a2290e4309428cc61812a6
Python
1,037
43
#### over lap for sanple sites #### usage : python overlap_sites.py <sample 1> <sample 2> ...<sample n> > overlap.txt ### modify parameter : value to get minimal overlap times import sys import collections from collections import Counter value = 2 dict_c = collections.defaultdict(list) c = collections.defaultdict(lam...
e57c135cffc4708c9810ac33773e27144415f3ac867689fc68977d9c420427ab
Python
1,037
37
import setuptools with open('README.md', 'r') as fh: long_description = fh.read() setuptools.setup( name = "adpred", version="1.3.2", author="Ariel Erijman", author_email="aerijman@fredhutch.org, aerijman@neb.com", description="Prediction of Transcription Activation Domains from protein seque...
393c0c70f6aea3d02210a657c5ac9334c179fed27b69cb908a8e46a2d6ac5ff4
Python
1,039
18
# https://stackoverflow.com/questions/24100558/how-can-i-split-a-module-into-multiple-files-without-breaking-a-backwards-compa/24100645 from cvnn.layers.pooling import ComplexMaxPooling2D, ComplexAvgPooling2D, ComplexAvgPooling3D, ComplexPolarAvgPooling2D from cvnn.layers.pooling import ComplexUnPooling2D, ComplexMaxPo...
0bc931164b8176cb7780380e1da28493cf8c0d062735b5fe05648c6a14027706
Python
1,040
27
''' Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands 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 requir...
3a9e524ef20cdf9ed4918532e4d62bf698b776ed82d07688a7dec1288d7e5e17
Python
1,040
30
# -*- coding: utf-8 -*- # # # RectiPy software framework for recurrent neural network training in # Python. See also: https://github.com/pyrates-neuroscience/RectiPy # # Copyright (C) 2022 Richard Gast. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pub...
4940503277974ebaf008b08c3ada78c7d960e5ac4e89d8670a2207b6018fd8c6
Python
1,040
48
import adolc import numpy as np def tapeFunction(x, rowno): adolc.trace_on(rowno) ax = adolc.as_adouble(x) # marking the x variables as independent for item in iter(ax): item.declareIndependent() L = ax[0] Inp = ax[1] Out = ax[2] P = ax[3] ay = adolc.as_adouble(0) if rowno ==...
a2e42fef47b36b4b24dcbf3f20cf3f1b6dfd79b6d1d087d9b5c039afc861e273
Python
1,041
37
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) fraction_of_standard_epoch = 9241 / 162706 msp.decay_per_epoch = 0.9 ** fraction_of_standard_epoch msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.arch...
0a76c390612bec5d2188b771962968a616a546c1c2f8c6f8a97f34998733f53c
Python
1,042
39
from os import path import setuptools path_to_repo = path.abspath(path.dirname(__file__)) with open(path.join(path_to_repo, 'readme.md'), encoding='utf-8') as f: long_description = f.read() required_pypi = [ 'transformers[torch]', 'numpy', 'datasets', 'scikit-learn', 'pandas', 'spacy', ...
0d0619491863bd27434c06892cb0a90edc409f54bffafffc9e5363bf84f68f06
Python
1,042
40
"""Utilities for defining models """ import operator class KeyBasedCompareMixin(object): """Provides comparision capabilities that is based on a key """ def __init__(self, key, defining_class): self._compare_key = key self._defining_class = defining_class def __hash__(self): ...
11a48920d058d77113505f49e042dac6ca86cfe4410cae917f5209661eea4f56
Python
1,042
29
import sqlite3 from .db import Database from .UK_tables import UK_district_wise_cases, UK_district_wise_mucormycosis_cases, \ UK_district_wise_testing, UK_district_wise_vaccination, UK_hospital_wise_deaths, \ UK_case_info class UttarakhandDB(Database): def __init__(self, datadir): super().__...
70dba6d9510fe82886e37d72d2fb8edb6727c10a9f10325e4bc1aaa26af79daf
Python
1,042
26
from .plotting.gene_plot import gene_plot from .plotting.gene_plot import gene_plot_interactive from .plotting.feat_plot import feat_plot from .plotting.cluster_plot import cluster_plot from .plotting.cluster_plot import cluster_plot_interactive from .plotting.subcluster_plot import subcluster_plot from .plotting.non_s...
929bf081e70c87a64e299138d7e3553929545a5fd6fafa53e12821deff641d0d
Python
1,042
29
# -*- coding: utf-8 -*- ''' Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands 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/LI...
e126df5b5fa2fec0b2e7f488a5fc2cbcec33c6cb3022634c71246ff47344902e
Python
1,042
34
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._cluster import Cluster from ._hoverlabel import Hoverlabel from ._legendgrouptitle import Legendgrouptitle from ._line import Line from ._marker import Marker from ._selected import Selected from ._textfont import Textfont...
1e7970603dd18b2214f66e68e5adcc98ef288b188331212260cf5306465cd837
Python
1,043
25
import os import numpy as np import sqlite3 def read_db_atoms(atom_db_path): if os.path.exists(atom_db_path) and atom_db_path.endswith('db'): cursor = sqlite3.connect(atom_db_path).cursor() # need to create a txt compatable numpy array # channel, iteration, modulus, amplitude (not p2p), po...
228dfc8c7d94d330b484c6b0456735681eda3d2a1d37b7101ded2d693563192e
Python
1,043
30
# -*- coding: utf-8 -*- # # # RectiPy software framework for recurrent neural network training in # Python. See also: https://github.com/pyrates-neuroscience/RectiPy # # Copyright (C) 2022 Richard Gast. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pub...
56f6aea5063ac1289fed1ee2835398c4e66e233637cb5b1af340e03cf416a24c
Python
1,043
39
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.batch_size = 2 * msp.batch_size // 3 msp.lr = float(msp.lr) * 2 / 3 msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec...
6feacd73923571b48e8fdd61549b18f1dfc5f59b6f0077abc67c0b436bcec4b8
Python
1,043
30
# -*- coding: utf-8 -*- # # # RectiPy software framework for recurrent neural network training in # Python. See also: https://github.com/pyrates-neuroscience/RectiPy # # Copyright (C) 2022 Richard Gast. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pub...
80056ce4eecfc54412f49af2557558c3799affe57cacd6dc2c89ae9ddcc88835
Python
1,043
38
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._colorbar import ColorBar from ._hoverlabel import Hoverlabel from ._legendgrouptitle import Legendgrouptitle from ._marker import Marker from ._selected import Selected from ._unselected import Unselected from . import col...
a7dc729e90091203c8713afae79d5ea112ac06a9215f51b24063fb5a0292a305
Python
1,043
33
import json import os from matplotlib import pyplot as plt from angorapy.common.const import PATH_TO_EXPERIMENTS, QUALITATIVE_COLOR_PALETTE experiment_ids = ['1653053413', '1655284851', '1654708464'] reward_developments = {} for id in experiment_ids: with open(os.path.join("../../../", PATH_TO_EXPERIMENTS, str(...
abe961eaf3b877aec9d6c11dc0a91174819c7ea31a0aed8e877f6fa3c286e399
Python
1,043
31
import unittest import numpy as np import torch from parameterized import parameterized from modular_splicing.models.modules.activations.backward_only_leaky_relu import ( BackwardsOnlyLeakyReLU, ) class TestDensityForSameEntropy(unittest.TestCase): @parameterized.expand([(seed,) for seed in range(100)]) ...
c5e06e7cae0c3f0f111735e0ce469b7c93abdd4fec85feaf90105c8b7ae853fc
Python
1,043
36
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["propagate_sparsity_spec"] = dict( type="OnlyAllowInfluenceOnSplicesites" ) msp.architecture["final_processor_spec"].update( dict( bottleneck_spec=...
e55aa5a19958d431629f100dcafb10f92ee1ada9932c52a1ba2600593e910379
Python
1,043
42
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 28 10:57:11 2022 @author: fcheng """ import numpy as np def cal_orientation_index(theta, R): """ calculate OI of unit for theta, using unit responses to orientations R (larger OI, higher selectivity) 1st dimension of R and the leng...
f472f07da2d6758d405ffafda411403313e6ba74c82d0c252fe9f5568b009c3d
Python
1,043
39
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.batch_size = 2 * msp.batch_size // 3 msp.lr = float(msp.lr) * 2 / 3 msp.architecture["num_motifs"] = 82 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec...