sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ee134b662e192e13553707d9fc884d689813016741a805d52ab2644d3e8f7def
Python
324
9
"""initialize pyprep.""" import pyprep.ransac as ransac # noqa: F401 from pyprep.find_noisy_channels import NoisyChannels # noqa: F401 from pyprep.prep_pipeline import PrepPipeline # noqa: F401 from pyprep.reference import Reference # noqa: F401 from . import _version __version__ = _version.get_versions()["versio...
81cb617e8502f7a06a707145b60d58a1f9e56ef271aedf9399ceb56e9c24595a
Python
325
20
def predict_mc_dropout(test_data, model, passes): predictive_posterior_mean = None variance = None return predictive_posterior_mean, variance if __name__=="__main__: ": # load test preprocessing # load pretrained model # specify number of passes through the network predict_mc_drop...
a91dcc83c38c6ee5e297eabbf8d76b800d5b42c308f3698aaace78e56cff8bdd
Python
325
8
try: import torch_geometric except ImportError as e: raise ImportError( "To run the torcheeg with graph neural networks and related transforms, you need to install `torch_geometric`. Please refer to `https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html`." ) from e from .to imp...
e922cd57347d8d2d246137cc432271568084e37a0f7c2c00907cafe941f30840
Python
325
16
#!/bin/env python3 ''' Verify Feynman-like diagram ''' import yaml import sys import pdlfeynman as fy yp = lambda *x: print(yaml.safe_dump(x, allow_unicode=True)) assert len(sys.argv) == 2 diagram = yaml.safe_load(open(sys.argv[1])) is_valid, message = fy.diagram.is_valid(diagram) print(message) assert is_valid, mes...
e3c4c492a1c5c9710702016d899f185c2fc037cc99b7e1f6351f3c2e592e592e
Python
326
15
class AverageMeter: def __init__(self): self.reset() def reset(self): self.val = 0 self.avg = 0 self.sum = 0 self.count = 0 def update(self, val, num): self.val = val self.sum += val * num self.count += num self.avg = self.sum / self....
42e782520a853db7b5f0fd55b3355ff1d3854ab00e1a4f2589afa6e032195437
Python
327
17
import scanpy as sc # Data reading input_file = "Dementia/SEA_AD_MTG.h5ad" adata = sc.read_h5ad(input_file) # Get highly variable genes sc.pp.highly_variable_genes(adata, n_top_genes=2000, inplace=True, subset=True) # Scale sc.pp.scale(adata) # Write the output file adata.write_h5ad("Dementia/Dementia_processed....
d63abde795e48962495c62921442930035cc3cafc6d7b463b4e0bda9626a3d58
Python
327
20
from topaz.model.classifier import LinearClassifier class TestLinearClassifier(): def test_init(self): pass def test_width(self): pass def test_latent_dim(self): pass def test_fill(self): pass def test_unfill(self): pass def test_forward(self): ...
a9ff1e305b9fb17bd767792a89897ab7c5926ce2e1ac8e4e3ae0473a7ff21d15
Python
328
9
# Copyright 2023 The Xron Authors. All Rights Reserved. # #This Source Code Form is subject to the terms of the Mozilla Public #License, v. 2.0. If a copy of the MPL was not distributed with this #file, You can obtain one at http://mozilla.org/MPL/2.0/. """Initial file for the package""" from xron._version import __v...
d0cc7887baddd22cdd6b7a3bbf5ef10a4ff65ac96d93259cd46f07b4b0552214
Python
328
10
def get_vhdl_templates(padding_len, layer_name): if padding_len == 0: suffix = "_not_padding" else: suffix = "_zero_padding" template_file_name = f"{layer_name}{suffix}.tpl.vhd" test_template_file_name = f"{layer_name}{suffix}_tb.tpl.vhd" return template_file_name, test_template_fi...
77bbb0ff6bc4cb716f595d576f89e43f22597efc6d0a96acf2619b4bd3e4f0b2
Python
329
8
# Copyright 2017 The Chiron Authors. All Rights Reserved. # #This Source Code Form is subject to the terms of the Mozilla Public #License, v. 2.0. If a copy of the MPL was not distributed with this #file, You can obtain one at http://mozilla.org/MPL/2.0/. """Initial file for the package""" from xron._version import __...
5fb7ff30d4f8be64cfff9a2021324cf229960433533b024b8d268b0d93cef57e
Python
330
11
#!/usr/bin/python # -*- coding:utf-8 -*- # -*-mode:python ; tab-width:4 -*- ex:set tabstop=4 shiftwidth=4 expandtab: -*- from control.gxipy.gxiapi import * from control.gxipy.gxidef import * from control.gxipy.gxwrapper import * __all__ = ["gxwrapper", "dxwrapper", "gxiapi", "gxidef"] __version__ = '1.0.18...
c2851c4b645bdded4a91e36905229e37d7ac87c8f7418c0b04bd50471d49fc28
Python
330
14
from .band import * from .band_pyeeg import * from .coefficient import * from .concatenate import * from .correlation import * from .downsample import * from .flatten import * from .normalize import * from .pick import * from .rearrange import * from .reshape import * from .spectrum import * from .to import * from .fli...
eaa7d12f9eefd8358105076abfec3f4fbd0ac4ad22a3066208b5611127e3dfa6
Python
330
12
import sys import shutil def shutil_rmtree(path, ignore_errors=False, onexc=None): if sys.version_info >= (3, 12): return shutil.rmtree(path, ignore_errors, onexc=onexc) def _handler(fn, path, excinfo): return onexc(fn, path, excinfo[1]) return shutil.rmtree(path, ignore_errors, onerror=...
5aa14fdcd35522cd6163dd3705dbe9e4f079306f1480f46a6d5736d937bd2d99
Python
331
15
from . import patch from .data.constant import * import sys import logging logger = logging.getLogger("") logger.setLevel(logging.INFO) format = logging.Formatter("%(asctime)-10s %(message)s", "%H:%M:%S") handler = logging.StreamHandler(sys.stdout) handler.setFormatter(format) logger.addHandler(handler) __version__...
8423b3012340622aa5252a83c1e7b977bbf42280bf60394110c04d16040b62f2
Python
331
9
"""assemblyfire""" from assemblyfire.version import __version__ from assemblyfire.config import Config from assemblyfire.spikes import SpikeMatrixGroup from assemblyfire.assemblies import Assembly, AssemblyGroup, ConsensusAssembly from assemblyfire.topology import AssemblyTopology from assemblyfire.syn_nnd import SynN...
f907b49322b6bd02a2e4c3da5351dab8fbbd3c128cad48caafad2d6405818c55
Python
331
11
from neuron import h from nrn import * load_hoc_obj=h #self.hoc_obj.execute('load_file("'+str(self.model)+'")') #self.hoc_obj.execute('load_file("stdrun.hoc")') load_hoc_obj.load_file(str("hh_pas.hoc")) load_hoc_obj.load_file("stdrun.hoc") #self.vec=h.Vector load_vec=load_hoc_ob...
680c2034f4a7a9078da400d387f64e5c150406b35e6c03c75c4c9cee99b832b7
Python
332
5
from deeplabcut.create_project.new import create_new_project from deeplabcut.create_project.new_3d import create_new_project_3d from deeplabcut.create_project.add import add_new_videos from deeplabcut.create_project.demo_data import load_demo_data from deeplabcut.create_project.human_dataset import create_pretrained_hu...
6fd3bac315e13e9b7992aecfdab01a86954238c667649c3179ac91742a13bfcc
Python
332
10
#! /usr/bin/env python from lab.parser import Parser print 'Running axiom evaluation time parser' parser = Parser() parser.add_pattern('axiom_time_inner', r'AxiomEvaluator time in inner evaluate: (.+)', type=float) parser.add_pattern('axiom_time_outer', r'AxiomEvaluator time in outer evaluate: (.+)', type=float) par...
fdd8e4802a5829d0f7049aabbac9a5b548d92732994a6377e1e3408c82450bee
Python
332
15
from cog import BaseModel, BaseRunner, Input class Output(BaseModel): text: str score: float tags: list[str] class Runner(BaseRunner): def run( self, prompt: str = Input(description="Input prompt"), ) -> Output: return Output(text=f"generated: {prompt}", score=0.95, tags=...
1a959bef57ab4d207f0382e01fa2ab2435591e551a29085621bb2b96852d6e66
Python
333
16
import os def main(*args, **kwargs): i = 0 while os.path.exists("results{}".format(i)): i += 1 os.mkdir("results{}".format(i)) os.system("mv allpara.yaml log.txt *err* *out* results{}".format(i)) os.system("cp input.yaml results{}".format(i)) print("Done!") if __name__ == "__main__":...
2baa608a07b6c82aaacf3a03ac5ed6bd61272b7e138053d41cb9107ed7c6a5b1
Python
333
8
# regtools/gui - Shared GUI components # # Constants, widgets, and viewers used across all GUI tabs. # # Import directly from submodules: # from regtools.gui.gui_constants import APP_STYLESHEET, ... # from regtools.gui.widgets import MultiLineButton, DropButton # from regtools.gui.gui_shared import auto_co...
7c15e29b3d06022f7203f0c26b66dee467452b9f2f302b20c83382c128fb0670
Python
334
8
#from deeplabcut.utils.make_labeled_video import * from deeplabcut.utils.auxiliaryfunctions import * from deeplabcut.utils.video_processor import * from deeplabcut.utils.plotting import * from deeplabcut.utils.conversioncode import * #from deeplabcut.utils.frameselectiontools import * # from deeplabcut.utils.auxfun_vi...
88ccf3ac418cde7edcf61cc3c575ada6f67620f7f7586e79c139a9f9b75a7622
Python
334
10
from .constants import BINARY_MODE, MULTICLASS_MODE, MULTILABEL_MODE from .jaccard import JaccardLoss from .dice import DiceLoss from .focal import FocalLoss from .lovasz import LovaszLoss from .soft_bce import SoftBCEWithLogitsLoss from .soft_ce import SoftCrossEntropyLoss from .tversky import TverskyLoss from .mcc i...
a7fd2941ebe389d5b401cd3bdfbc74e0ea438554b61a29f82b03e5877d457b2a
Python
334
8
import inspect from regtools.ccf_boundary_editor.viewer import CCFContourViewer def test_dispatch_2d_atlas_uses_section_browse_not_section_prompt(): src = inspect.getsource(CCFContourViewer._dispatch_2d_atlas) assert "load_2d_section_browse" in src assert "getInt" not in src # no up-front section-...
8ca2cda7423f5c34ab446423d807356c834e44231cfb0e7225cdc3a9b676f403
Python
335
8
from pertpy.metadata._cell_line import CellLine from pertpy.metadata._compound import Compound from pertpy.metadata._cytokine import Cytokine from pertpy.metadata._drug import Drug from pertpy.metadata._look_up import LookUp from pertpy.metadata._moa import Moa __all__ = ["CellLine", "Compound", "Cytokine", "Drug", "M...
dd56b3d1d3049b024623f63937a34fd2fbefc0b37941c213672f4d73750c4aa7
Python
335
11
import warnings from cog import ExperimentalFeatureWarning, Input, current_scope warnings.filterwarnings(action="ignore", category=ExperimentalFeatureWarning) def run( text: str = Input(description="Example text input"), ) -> dict[str, dict[str, str]]: return {"inputs": {"text": text}, "context": current_sc...
0d086da3a5edbbcba2f86002032680dd06264af16a525886a973d1c570ec59b9
Python
336
3
from data.ClinicalDatasets import PreopClassificationDataset, PreopSurvivalDataset, PostopSurvivalDataset, PostopClassificationDataset from data.ImageDatasets import ImageClassificationDataset, ImageSurvivalDataset, ImageSegmentationDataset from data.RadiomicsDatasets import RadiomicsClassificationDataset, RadiomicsS...
74dba7ce86f686d284f59c31560ceaf1edf07381ab1ba1f379c8d945f4f0497a
Python
336
13
import dataclasses import pytest from elasticai.creator_plugins.quantized_grads.fixed_point import ( FixedPointConfigV2, ) def test_two_complement_fixed_point_config_is_frozen(): config = FixedPointConfigV2(total_bits=8, frac_bits=2) with pytest.raises(dataclasses.FrozenInstanceError): # config...
ebc699cd592aa5778369c6596c5ab597490171827a0cd7079a80677394bfc996
Python
336
21
from memory_profiler import profile f=open('hi.txt','w+') @profile(stream=f) def my_func(): a = [1] * (10 ** 6) b = [2] * (2 * 10 ** 7) del b return a @profile(stream=f) def my_func1(): a = [2] * (10 ** 6) b = [3] * (2 * 10 ** 7) del b return a if __name__ == '__main__': my_func(...
f764da40a6e77c406b4cba6f4c4429b41e421e898cea3a5d963baeadb962fc2f
Python
336
7
# -*- coding: utf-8 -*- from .biaffine import BiaffineSemanticDependencyModel, BiaffineSemanticDependencyParser from .vi import VISemanticDependencyModel, VISemanticDependencyParser __all__ = ['BiaffineSemanticDependencyModel', 'BiaffineSemanticDependencyParser', 'VISemanticDependencyModel', 'VISemanticDep...
6bd0ea7e7facf6caa574d8f754fe14c4583882534a58966e6109509213cb1866
Python
337
17
""" Logging utilities. """ import logging LOGGER = logging.getLogger("qupat_processing") def setup_logging(level): """Setup application logger.""" logging.basicConfig( format="%(asctime)s;%(levelname)s;%(message)s", datefmt="%Y-%m-%dT%H:%M:%S", level=logging.WARNING, ) LOGGER...
22724ce21a06dfe08a04185d800741dce4b486989f03dc97bbdd7fbd457ac968
Python
338
15
# Libraries import os import sys code_path = os.path.split(os.path.split(os.getcwd())[0])[0] sys.path.append(code_path) from setting import * from download_data import * # Download data_path = os.path.join(set_path(), "tcga") database = "ttg" cancers = ["all", ] for cancer in cancers: download_dataset(data_path, ...
b0bdbf5b1f38a32b25a0b824056df4bcd1f730307212249c518cc53f09f8d305
Python
338
9
__author__ = 'martinez' __version__ = "$Revision: 001 $" from .filters import vtkSurfBorderAlgorithm from .filters import vtkClosestCellAlgorithm from .filters import vtkAddAttributesAlgorithm from .filters import vtkFilterSurfBorderAlgorithm from .filters import vtkClosestPointAlgorithm from .filters import vtkFilter...
9ae19315fa2bdf3573921444162469132bad9ca7f08b961da30ad00d85494e89
Python
339
12
import logging def get_logger(): logger = logging.getLogger(name='DPS') logger.setLevel(logging.INFO) formatter = logging.Formatter("%(asctime)s [%(name)s] >> %(message)s") stream_handler = logging.StreamHandler() stream_handler.setFormatter(formatter) logger.addHandler(stream_handler) ...
6d1573a2cc0d762aa773165eab2116f53c17bc1cebdc6e28f2a9347b002be215
Python
340
9
import pickle, sys file = sys.argv[1] trials = pickle.load(open(file, "rb")) alldicts = trials.trials loss = trials.losses() for i in range(len(loss)): print(str(int(alldicts[i]['misc']['vals']['leftpos'][0]))+'\t'+str(int(alldicts[i]['misc']['vals']['rightpos'][0]))+'\t'+str(loss[i])+'\t'+str(alldicts[i]...
8ba35f10ffae3a93d2f8a94b394977d9a662c49ef9a8f2cdc425beab8b59aa07
Python
340
11
"""Geometry Registration - 2D slice-to-CCF registration via Agarwal's edge/contour geometry-processing engine. See README.md for architecture and attribution. """ from .types import RunParams, RunResult from .pipeline import run from .damage_aware import damage_mask __all__ = ["RunParams", "RunResult", "ru...
afe52751ef072e8e57149cfc8a74dc38e4e2bbfb313618076fa57094652594e2
Python
340
12
from typing import List, Optional def main(args: Optional[List[str]] = None) -> int: """This is preserved for old console scripts that may still be referencing it. For additional details, see https://github.com/pypa/pip/issues/7498. """ from pip._internal.utils.entrypoints import _wrapper re...
576aae5ae48a99803a8b65acbd00ab8e25823123432de63dbb353a46371159f0
Python
342
18
from elasticai.creator.ir import attribute from .default_handlers import dgraph_handlers as default_handlers from .ir2torch import ( DataGraph, Ir2Torch, IrFactory, get_default_converter, ) __all__ = [ "DataGraph", "Ir2Torch", "get_default_converter", "default_handlers", "IrFactory...
68c7b704b22d54e4d5a74e07b044d8b56b3c4d395a9addee33f9b3789ca5d3cb
Python
343
11
from pyntbci.tests.test_classifiers import * from pyntbci.tests.test_eeg import * from pyntbci.tests.test_gates import * from pyntbci.tests.test_stimulus import * from pyntbci.tests.test_stopping import * from pyntbci.tests.test_transformers import * from pyntbci.tests.test_utilities import * if __name__ == "__main__...
fbcac05f17bf4c43cd6fcb041b8193408022b0f716ddec84faf9b94aa635dfe0
Python
343
8
from herdingspikes import probe # from herdingspikes.parameter_optimisation import OptimiseParameters from herdingspikes.hs2 import HSDetection, HSClustering, HSDetectionLightning from herdingspikes.version import __version__, __commit__, base_version __all__ = ["probe", "OptimiseParameters", "HSDetection", "HSClust...
55ab625350072a1730666968402077acdd18f876e25b6ca9770937afab8fa9be
Python
344
12
from setuptools import setup setup( name="viper_clustering", version="0.3", description="Package to cluster ViPER triple assembly output.", author="Lander De Coninck", author_email="lander.deconinck@kuleuven.be", url="https://github.com/Matthijnssenslab/ViPER", packages=["viper_clustering"]...
6e409c63793bcd6f6804bd7b5ec6466316083fca27ad66834e1896629e0bcfed
Python
344
13
from .model import MoleculeModel from .mpn import MPN, MPNEncoder from .attention import MultiBondAttention, MultiBondFastAttention, MultiAtomAttention, SublayerConnection __all__ = [ 'MoleculeModel', 'MPN', 'MPNEncoder', 'MultiBondAttention', 'MultiBondFastAttention', 'MultiAtomAttention', ...
d550c96be7753ecede38c4cf162c793d6dd5ac0d3b5332ddd7ad7629935ba40f
Python
344
17
import pandas as pd area = "output_and_income" # "consumption_and_orders", "prices", "output_and_income" n_evaluate_targets = 19 past_horizon = 24 forecast_horizon = 3 train_test_split_period = pd.Period("2011-01-01", freq="M") # Model Training batch_size = 32 n_epochs = 50 patience = 10 # Model Parameters n_featu...
2c82c7c0c2ef8fd58170698a5401d6b32c446858aff49e8407db410cb0f6c3ff
Python
345
26
"""" Catalog example for testing analysis.catalog # Author: Vladan Lucic # $Id$ """ #from __future__ import unicode_literals __version__ = "$Revision$" identifier = u'exp_3' results_file = u'results_3.dat' results_obj = u'results_3.pkl' cleft_columns_obj = u'cleft_columns_3.pkl' category = u'first' feature = ...
8756c43251aa341db61f2412c5b494a0bf7af3c1af7e39a209c8dac061efd0ec
Python
345
8
try: import torch_geometric except ImportError as e: raise ImportError( "To run the torcheeg with graph neural networks and related transforms, you need to install `torch_geometric`. Please refer to `https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html`." ) from e from .vi...
0d841affc0f7fe7985fe524135ddffd6c50ae3b32fc05e08d0a075c3bf11d8b1
Python
346
17
# Module to simulate quantal data from pyclamp.qnp.qsim import binoqsim from pyclamp.dsp.iofunc import writeDTFile outpath = '/tmp/bqa_test.tab' e = 10. n = 6 q = 100. u = 0.1 v = 0.2 s = [0.2, 0.5, 0.8] usegamma = [True, True] num = 128 binom = binoqsim(e, n, q, u, v, 0.5, usegamma) data = binom.simulate(num, s) wri...
0f4358a54016ddb44b962dbecc79b3505d91143a4e448103567551c42092f71f
Python
346
10
import sys assert len(sys.argv) == 4, "Must have two input lists and one output list" first = open(sys.argv[1], 'r').readlines() first = [x.strip() for x in first] second = open(sys.argv[2], 'r').readlines() second = [x.strip() for x in second] diff = list(set(first).difference(set(second))) open(sys.argv[3], 'w').wr...
a1cb422fdd26414ad18702705c4c461d2195f538cd0fb6481fa16f3848cdce3f
Python
346
17
from itertools import count import os def _try_remove(f): try: os.remove(f) except OSError: return False return True def cleanup_temporary_files(args): _try_remove(args.sas_file) _try_remove(args.plan_file) for i in count(1): if not _try_remove("%s.%s" % (args.plan_fil...
d68b5390a9b04b833fd8a2acd61077e5addd725e49936b460f13ccf69724b685
Python
346
17
import json from helpers import network def main(): import sys with open(sys.argv[1], "r") as fid: cfg = json.load(fid) M = network.load_network(cfg["connectome"]["loading"]) network.override_connectivity(M, cfg["connectome"]["override"]) M.to_h5(cfg["connectome"]["save"]) if __name__ ...
ef4a3683ffbd4adbe511fa3474e60100c19d1878b938f2cc95ff75ee385d8b38
Python
346
20
# built-in from math import isclose # external import pytest # project import textdistance ALG = textdistance.bz2_ncd @pytest.mark.parametrize('left, right, expected', [ ('test', 'test', 0.08), ('test', 'nani', 0.16), ]) def test_similarity(left, right, expected): actual = ALG(left, right) assert ...
19ef9eb73d6aa648b70840c0bcb3dd25969ba36161e9b5d36f3c9c0138e349fb
Python
347
16
# -*- coding: utf-8 -*- import os import subprocess import sys ROOT_DIR = os.path.dirname(__file__) def _program(name, args): return subprocess.call([os.path.join(ROOT_DIR, "bin", name)] + args, close_fds=False) def obabel(): suffix = '.exe' if os.name == 'nt' else '' raise SystemExit(_program('obabel...
74e940a5547d54d1ddf075a3ffd49359f4e631ce76eb7b3f3b8b91795ffc97af
Python
347
17
import keras from .models_factory import ModelsFactory class KerasModelsFactory(ModelsFactory): @staticmethod def get_kwargs(): return { 'backend': keras.backend, 'layers': keras.layers, 'models': keras.models, 'utils': keras.utils, } Classifi...
ed59e3863d08aa6a83f2a14a1b051a8fa2af0b04ff668357d00ee1bf8270b16b
Python
347
20
# built-in from math import isclose # external import pytest # project import textdistance ALG = textdistance.bwtrle_ncd @pytest.mark.parametrize('left, right, expected', [ ('test', 'test', 0.6), ('test', 'nani', 0.8), ]) def test_similarity(left, right, expected): actual = ALG(left, right) assert...
82161c9b4e67b41ac079304e8b0a348c194717eb9e3130b8b0c42fe08ea606e6
Python
350
14
"""Init file.""" import logging def get_logger() -> logging.Logger: return logging.getLogger("ISMRMRD") from .write_acquisition_to_mrd import write_acquisition_to_mrd from .mrd_helper import get_nexus_acquisition_system, set_mrd_counters __all__ = [ "write_acquisition_to_mrd", "get_nexus_acquisition_sys...
7dd79d7ef6184201c8df58fcf4fdab4b339a06f06592d8c8e6eb4f541d9ea05b
Python
351
9
try: import torch_geometric except ImportError as e: raise ImportError( "To run the torcheeg with graph neural networks and related transforms, you need to install `torch_geometric`. Please refer to `https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html`." ) from e from .rgnn i...
92af44386e7012eb114ac01866d16e3ea8ad97473098c28d42e8a26619fb2eb8
Python
351
8
from trainer import Trainer if __name__ == "__main__": wandb_api_key = "" train_class = Trainer(wandb_api_key, "config-128.yaml", "EMMA_Ferret_3M_shifted", 0, False) train_class.run_model_pipeline(layer = 1, stream = 2) #train_class.run_model_pipeline(layer = 1, stream = 2) #train_class.run_model_p...
e9f204f2a34c8d01d76da826a89f5b73678c616b47561b14337e95c950245342
Python
351
16
from enum import Enum, auto class OrbitalOccupationType(Enum): '''Enum class for the different types of orbital occupancy in the data.''' # general NATURAL_ELECTRON_CONFIGURATION = auto() LONE_PAIR = auto() LONE_VACANCY = auto() BOND_ORBITAL = auto() ANTIBOND_ORBITAL = auto() DONOR ...
3076b430f0754548f6d962a824db405989e6512918440675d27535018734ec55
Python
353
9
# """A collections of pre-defined VGG models.""" from .vgg_cifar10 import VGG_CIFAR10 from .vgg_cifar10_spike import VGG_CIFAR10_spike from .cnn1_cifar10 import CNN1_CIFAR10 from .cnn1_cifar10 import WQ_CNN1_CIFAR10 from .cnn2_cifar10 import CNN2_CIFAR10 from .cnn1_cifar10_full import CNN1_CIFAR10_FULL from .cnn2_cifa...
375b7ebdb9029a75bd56dab2ff9d4d6c313fd6867361c5f60b3c270f7b0f4ff9
Python
353
15
#! /usr/bin/env python from lab.parser import Parser class RawMemoryParser(Parser): def __init__(self): Parser.__init__(self) self.add_pattern('raw_memory', r'Peak memory: (.+) KB', type=int, required=False) if __name__ == '__main__': parser = RawMemoryParser() print 'Running RawMemoryPa...
79a626e815aa0907d9711516ebf038e86b7b26450a6606d8bb70d88713285c31
Python
353
15
import cv2 cv2.TrackerCSRT_create try: OPENCV_OBJECT_TRACKERS = { "csrt": cv2.TrackerCSRT_create, "kcf": cv2.TrackerKCF_create, "boosting": cv2.TrackerBoosting_create, "mil": cv2.TrackerMIL_create, "tld": cv2.TrackerTLD_create, "medianflow": cv2.TrackerMedianFlow_create, "mosse": cv2.TrackerMOSSE_create } exc...
7acf0428cbd78f9c93a087d0fa97f70efe539c879e33ab0c1342d6fa7e1e707a
Python
353
17
""" pygments.__main__ ~~~~~~~~~~~~~~~~~ Main entry point for ``python -m pygments``. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys from pip._vendor.pygments.cmdline import main try: sys.exit(main(sys.argv)) except Ke...
3165dd87eaf5970e13ee9289a33d672b306538370d0b97ec04afa73bfc825ac7
Python
355
9
import pytest from main import commands @pytest.mark.parametrize("cmd", commands.values(), ids=list(commands.keys())) def test_scripts_dry_run(cmd): """Just make sure all scripts work with dry run""" # Just add some dummy arguments args = {k:"" for k in cmd.script.__code__.co_varnames if k != "dry_run"} ...
69bb72686e9080da9bc104ecffcab5ac95123ebefc6a410e2d88090d71e0b4b3
Python
355
20
""" TextDistance. Compute distance between sequences. 30+ algorithms, pure python implementation, common interface. """ # main package info __title__ = 'TextDistance' __version__ = '4.6.2' __author__ = 'Gram (@orsinium)' __license__ = 'MIT' # version synonym VERSION = __version__ # app from .algorithms import * #...
63e421eb391076edea4587cc179ae22cf4837da977b6037fcb40ff42bb627739
Python
356
15
from language import load_input_language def test_language(): lang1 = load_input_language("B1") assert isinstance(lang1.get_word_by_id(2), str) scene = lang1.get_scene_by_id(2) assert isinstance(scene, tuple) shape, angle = scene print(shape) print(angle) assert isinstance(shape, int...
7c954e8b5219834dcf04fa771388f9a3335754bc5d636a1d730daf90bf7b022c
Python
356
11
import protonets.data.geometry def load(opt, splits): # if opt['data.dataset'] == 'omniglot': # ds = protonets.data.omniglot.load(opt, splits) if opt['data.dataset'] == 'geometry': ds = protonets.data.geometry.load(opt, splits) else: raise ValueError("Unknown dataset: {:s}".format(o...
84b8671172248b63ac84ac7854a70f24e2d1ab7b34facfd9161e06047eed18c3
Python
356
13
"""Top-level package for m6A-calling.""" __author__ = """Mitchell Robert Vollger""" __email__ = "mrvollger@gmail.com" __version__ = "0.1.0" from .m6a_cnn import * from .m6a_supervised_cnn import * from .m6a_semi_supervised_cnn import * from .m6a_semi_supervised_cnn_predict import * from .m6a_cnn_gen import * from .m...
1eba0a65914e01d428988ae6bb5e7eb54d01585aa3a0cd5f4ac0a502a6d05ac8
Python
357
16
import logging as _logger logging = _logger.getLogger('tensorlayer') logging.setLevel(_logger.INFO) _hander = _logger.StreamHandler() formatter = _logger.Formatter('[TL] %(message)s') _hander.setFormatter(formatter) logging.addHandler(_hander) def info(fmt, *args): logging.info(fmt, *args) def warning(fmt, *ar...
8442d61f750dda29419ed7336e7d4124e233244a2213cc3d1fe82c4794deb849
Python
357
13
from typing import List, Optional __version__ = "23.2.1" def main(args: Optional[List[str]] = None) -> int: """This is an internal API only meant for use by pip's own console scripts. For additional details, see https://github.com/pypa/pip/issues/7498. """ from pip._internal.utils.entrypoints import...
a7a87711b08b780d03f60e05d2c7e704b0d1c0e7a20725d4760a81670d8cc712
Python
358
10
from collections.abc import Iterable, Iterator from importlib import import_module as _import_module from typing import Any def import_symbols(module: str, names: Iterable[str]) -> Iterator[Any]: """import names from a module and yield the resulting objects.""" m = _import_module(module) for name in set(n...
1fd2f7df954998dc129b3ecb88e53b6d99e88d8f851bc4936c271de11ae2d03a
Python
359
16
""" Tests for geometry # Author: Vladan Lucic (Max Planck Institute for Biochemistry) # $Id$ """ from __future__ import unicode_literals from __future__ import absolute_import __version__ = "$Revision$" from .test_vector import TestVector from .test_affine import TestAffine from .test_affine_2d import TestAffine2D f...
2ffb70f8ab6cc6f65b29f9b1e0be39dac6896f15828f1b0d4d2345e8ccbbaaf4
Python
359
24
""" Global variables for the package """ __author__ = 'martinez' import numpy as np MAX_FLOAT = np.finfo(float).max NO_CONNECTION = -1 STR_2GT_EL = 'edge_length' STR_CELL = 'cell_id' STR_2FIL_LEN = 'fil_len' STR_2FIL_CT = 'fil_ct' STR_2FIL_SIN = 'fil_sin' STR_2FIL_SMO = 'fil_smooth' STR_2FIL_MC = 'fil_mc' WR...
b30a94ea39b6f4b6c7e2c9466b7513c5801a31408b3b33d8d6a4cc6b8b6fecf1
Python
359
14
import sys import importlib __version__, _, _ = sys.version.partition(' ') try: # Allow Debian and pkgsrc (only) to customize system # behavior. Ref pypa/distutils#2 and pypa/distutils#16. # This hook is deprecated and no other environments # should use it. importlib.import_module('_distutils_sys...
bc473126b18ecfa6675cb3547dd995c117f1740ae0219cfe185055bc30095f48
Python
359
13
from .copula_graphic import CopulaGraphic from .kaplan_meier import KaplanMeier, KaplanMeierArea from .nelson_aalen import NelsonAalen from .turnbull import TurnbullEstimator, TurnbullEstimatorLifelines __all__ = [ "CopulaGraphic", "KaplanMeier", "KaplanMeierArea", "NelsonAalen", "TurnbullEstimator...
f1f58b98e9665584f907fffc9ff3c8d98be9b30495917ff7f05878c1fcbd6d7a
Python
360
8
from .src.adder_range_violation import adder_range_violation as adder_range_violation from .src.adder_ripple_carry_signed import ( adder_ripple_carry_signed as adder_ripple_carry_signed, ) from .src.adder_ripple_carry_unsigned import ( adder_ripple_carry_unsigned as adder_ripple_carry_unsigned, ) from .utils im...
f8a7fdd3058faffdb4913ece2c2ec977755aa6e1d3362c2aafea2f7c158da9d7
Python
360
14
MODEL_REGISTRY = {} def register_model(model_name): def decorator(f): MODEL_REGISTRY[model_name] = f return f return decorator def get_model(model_name, model_opt): if model_name in MODEL_REGISTRY: return MODEL_REGISTRY[model_name](**model_opt) else: raise ValueError("...
a49e42e5d022b9468d2bc1a78da48671fea8cfb8f19ee5b89876d71d099f1ec2
Python
361
10
import keras_applications as ka from .__version__ import __version__ def get_submodules_from_kwargs(kwargs): backend = kwargs.get('backend', ka._KERAS_BACKEND) layers = kwargs.get('layers', ka._KERAS_LAYERS) models = kwargs.get('models', ka._KERAS_MODELS) utils = kwargs.get('utils', ka._KERAS_UTILS) ...
61f66c7471951ecc0260153e3ba6e04ac89957d06cb70e953fc31b98b78f5c94
Python
362
9
import pandas as pd import pickle data = pd.read_pickle("/Users/bguillouet/These/trajectory_review/data/extracted/starting_from/Caltrain_city_center_v3.pkl") traj_list = [group[["lons","lats"]].values for _,group in data.groupby("id_traj")] pickle.dump(traj_list, open("/Users/bguillouet/These/trajectory_distance/da...
74c73692c5a3757493c344f36f35f715d4df4393ff8400a6dbf8dcc0a5af9b93
Python
362
8
class BaseModel: def __repr__(self): """A mixin implementing a simple __repr__.""" return "<{klass} @{id:x} {attrs}>".format( # pylint: disable=consider-using-f-string klass=self.__class__.__name__, id=id(self) & 0xFFFFFF, attrs=" ".join(f"{k}={v!r}" for k,...
33ca4f64928097535782dc3e352cd3fb50443401c98405857decadeb3aaef576
Python
363
10
from napari_bil_data_viewer import napari_experimental_provide_dock_widget from napari_bil_data_viewer.dataset_info import get_datasets # Test that datasets return a dict assert isinstance(get_datasets(), dict) # Test whether dock widget is accessable def test_provide_dock_widget(): assert [callable(x) for x in ...
6fa39f21a4a8de42e41d2cb6260d52092251c6f9ad25127478875fd38c0c890a
Python
363
14
from __future__ import print_function from openbabel import openbabel as ob # Initialize the OBConversion object conv = ob.OBConversion() if not conv.SetInFormat('smi'): print('could not find smiles format') # Read the smiles string mol = ob.OBMol() if not conv.ReadString(mol, 'CCCC'): print('could not read the s...
badd4c7d51b3bb8195a2f9fc8746dac2fe6a3fdf92d74a30f88c4d0fbad01795
Python
363
14
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 5 09:39:37 2021 @author: leupinv """ # Participants code G_N = ['g01', 'g03', 'g08', 'g10', 'g11', 'g12', 'g15', 'g16', 'g17', 'g19', 'g23', 'g24', 'g25', 'g28', 'g32', 'g33', 'g34', 'g37', 'g38', 'g39', 'g40', 'g41', 'g42', 'g44', 'g45', ...
41f2be0c48ac6fad092eedd206d6bfabbbe3be87fb5b6243a7d25d2d833aa4d1
Python
364
13
from ._int_arithmetic import int_arithmetic from ._int_converter import int_converter from .fxp_arithmetic import FxpArithmetic as FxpArithmetic from .fxp_converter import FxpConverter as FxpConverter from .fxp_params import FxpParams as FxpParams __all__ = [ "FxpParams", "FxpArithmetic", "FxpConverter", ...
c6dd073e3dedb8001e62eac83138add8ef206d2ebc49025a05437bd41867c9c7
Python
365
9
from .dist import get_rank from .diff_config import find_config_diff from .env_info import get_env_info from .logger import create_logger from .metric_logger import AverageMeter from .metrics import compute_accuracy from .op_count import count_op from .tensorboard import DummyWriter, create_tensorboard_writer from .uti...
d8bad97f486df28ce34e90582d2c1eba230db76f17a8c198bdd1c44c8fef1ea9
Python
365
13
#!/usr/bin/env python #================================================================ # Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : __init__.py # Author : Yufeng Liu # Date : 2022-04-01 # Description : # #======================...
3a429bc2f94760426189c986d07ef336548386c609d62c93e30f5e2020c85d34
Python
367
15
"""Sequence constructor init file.""" from . import system_settings from .calibration import fid_tx_adjust, se_tx_adjust from .spectrometry import se_projection, se_spectrum, t2_relaxation from .tse import tse_3d __all__ = [ "fid_tx_adjust", "se_tx_adjust", "tse_3d", "se_projection", "se_spectrum",...
81e3dc712e41477c6c04cb5869feb1919aa6e15f7a9298b832c232a3538174ae
Python
367
7
#!/usr/bin/env python import sys, wget, os for line in open(sys.argv[1]): pdb,lig = line.rstrip().split() print(pdb,lig) fname = wget.download('https://www.rcsb.org/pdb/download/downloadLigandFiles.do?ligandIdList=%s&structIdList=%s&instanceType=all&excludeUnobserved=false&includeHydrogens=false'%(lig,pdb),bar=No...
c7f524dfc0d2916e361e6b650747524c5b323374342dce70e4e514ea4005d8df
Python
367
13
#!/usr/bin/env python # ================================================================ # Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : __init__.py # Author : Yufeng Liu # Date : 2022-04-01 # Description : # # ====================...
ec96e26a887ce59e80a97fbf714e63af6a4abc84f489e3b423ffa7df169db895
Python
367
12
from __future__ import absolute_import, print_function, division import torch def set_num_threads(num_threads): if num_threads < 0: # use all cores from multiprocessing import cpu_count num_threads = cpu_count() if num_threads > 0: # set number of threads in pytorch torch.set_n...
fb01e216d278a26682745055ac0cafb751e71c0eb446b46976d3cfc5a7fac08c
Python
367
16
""" Set of utilities for segmentation and analysis of n-dimensional images. # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 02.04.14 """ __author__ = 'martinez' __version__ = "$Revision: 001 $" from . import globals from . import pexceptions from . import disperse_io from . import ...
6563c63e9e4cdeaad43fc7092f14d0730e584996f5f325143348fb485a5221ce
Python
368
14
#!/usr/bin/env python #================================================================ # Copyright (C) 2021 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : tree_utils.py # Author : Yufeng Liu # Date : 2021-07-15 # Description : # #====================...
562b5ec3c2e46d90e6abc11da2919c5e16c3eb47c5a218d4be2de46e9c74d0ce
Python
369
14
from wonambi import Dataset from .paths import micromed_file def test_dataset_events(): d = Dataset(micromed_file) events = [ev['start'] for ev in d.read_markers()][::30] data = d.read_data(events=events) assert data.time[0].shape[0] == 512 assert data.time[0].shape[0] == data.data[0].shape[1] ...
a3fe7e08dc188803fb67bea4fdde0a516beff878e423acaedd4cf7d9e9a06de8
Python
369
17
#!/usr/bin/env python #================================================================ # Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : __init__.py # Author : Yufeng Liu # Date : 2022-11-10 # Description : # #======================...
fce25abc86ce8e997646cef435b7b609cfa98fa727886bab601c94445ab3d0e3
Python
369
19
# read starting PDB, add unknown atoms, and fix up covalent geom, write out # resulting PDB inputPDB="rna_ini-allatom.pdb" import protocol protocol.loadPDB(inputPDB) import regularize regularize.addUnknownAtoms_new() from regularize import fixupCovalentGeom fixupCovalentGeom() import os base,ext = os.path.splitex...
08fee60f0e6e69cbd7de3f06a8395f2b30557691882e7f56e5d98b1bb3f627ac
Python
370
18
from config import MODEL_PATH from watcher import Watcher from restore_predict import restore # adapt such that it works for all formats ('one-per-item', ...) # restore commit in result.txt to ensure loading model parameters works models = [] for i in range(10): models.append(restore(MODEL_PATH + "model_fold{}....
17176d527de0d4bb5adf164e6457d90063d4d4c07e459cf0044772a66b900f3b
Python
370
20
""" Get expected value of loss of model before training """ NUM_OUTPUT_LOCS = 140 NUM_WF_PROBS = [0.6, 0.24, 0.12, 0.04] ####################################### import torch bce = torch.nn.BCEWithLogitsLoss() y_hat = [0] * 10 y = [1, 0] * 5 y_hat = torch.tensor(y_hat, dtype=torch.float32) y = torch.tensor(y, dtype...
ace77733e1fd25b16675e6e415ce9d8e88c16deb0d98396cb31b0c4353ce451d
Python
371
20
""" Util directory module # Author: Vladan Lucic (Max Planck Institute for Biochemistry) # $Id$ """ from __future__ import unicode_literals from __future__ import absolute_import __version__ = "$Revision$" from . import nested from . import attributes from . import numpy_plus from . import scipy_plus from . import p...
52110509d101fcf61f71273b8dcb71ae005e89dcbdb6de03693cc1d88e78f879
Python
372
13
# Settings for base synapse parameters params = {} params["syn"] = {} params["syn"]["AMPA"] = {"tau1": 0.5, "tau2": 2.4, "gpeak": 0.1, "e": 0} params["syn"]["NMDA"] = {"tau1": 4, "tau2": 40, "gpeak": 0.1, "e": 0} params["syn"]["GABAA"] = {"tau1": 1, "tau2": 7, "gpeak": 0.33, "e": -70} params["syn"]["GABAB"] = {"t...
48283e708f763cd17ccea9ec9e25e9cb9b8d553c08b64d958082309b52f3dff7
Python
373
12
import torch from torch import tensor def generate_input_tensor_1d(in_channels, kernel_size, groups=1): length = in_channels // groups * kernel_size elements = tuple(tensor([-1.0, 1.0]) for _ in range(length)) return ( torch.cartesian_prod(*elements) .reshape(2**length, in_channels // grou...
b2f514b0fec3f3d6103d10e008e2a180d37d4aec89bdfd7326bad746872e831f
Python
374
10
from .amigos import AMIGOSDataset from .bci2022 import BCI2022Dataset from .deap import DEAPDataset from .dreamer import DREAMERDataset from .mahnob import MAHNOBDataset from .seed import SEEDDataset from .seed_feature import SEEDFeatureDataset from .seed_iv import SEEDIVDataset from .seed_iv_feature import SEEDIVFeatu...
04ca2f2f96d59eb0f95b1b343a89cb2e5f64234fd939a367469951acbe05c4b5
Python
375
22
import pytest import jax import time @pytest.mark.parametrize( "n_samples", [ 2, 4, ], ) def test_jax_rng_generation(n_samples): rng_key = jax.random.PRNGKey(time.time_ns()) rng_key, rng_subkey = jax.random.split(rng_key) param = jax.random.uniform( key=rng_key, ...