sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3c51303cd4c9cfbe71b5725841053bdccc17efe4e31694a8be5b7f59a773ea37
Python
1,389
45
"""Dynamic graph coverage for repeated fastlog recording.""" from __future__ import annotations from collections import Counter import pytest import torch import torch.nn.functional as F from torch import nn import torchlens as tl class DynamicMLP(nn.Module): """MLP with input-dependent control flow.""" ...
4c223044fcb43bb6f1f9c536c31fb865afd83948e912f0b79a7976625ac2dfd9
Python
1,389
44
from __future__ import annotations from typing import Dict import torch from .core import Domain _FeatureType = Dict[str, torch.Tensor] def _lnd2nld(feature: torch.Tensor) -> torch.Tensor: """Convert features having the shape of (L, N, D) to (N, L, D).""" return feature.permute(1, 0, 2) def _nld2lnd(feat...
7c2c0fdc2d5f69360ca0cb03dd766ffe7ccb647446641417fb80fd2bcb680f44
Python
1,389
49
import numpy as np from sklearn import linear_model, svm, metrics class OrdinalRidge(linear_model.Ridge): """ Overwrite Ridge from scikit-learn to use the (minus) squared error as score function. (see https://github.com/scikit-learn/scikit-learn/issues/3848 on why this cannot be accomplished usin...
eb03c2fa27bc887d117f58ac718e9289b86f5201e82fd5f6c01bf1926d86bb78
Python
1,390
57
import pytest import rpy2.rinterface as ri ri.initr() def test_init(): rgetattr = ri.baseenv.find('::') formula = rgetattr('stats', 'formula') f = formula(ri.StrSexpVector(['y ~ x', ])) assert f.typeof == ri.RTYPES.LANGSXP def test_init_invalid(): seq = True with pytest.raises(TypeError): ...
fda7dcd907bbfd44c1e358f4265d77eee278e88e4ade3e4e2ad24319683611f7
Python
1,390
49
#!/usr/bin/env python from Bio import Seq from Bio.Alphabet import generic_dna def check_gff(gff_iterator): """ Check GFF files before feeding to SeqIO to be sure they have sequences. """ for rec in gff_iterator: if isinstance(rec.seq, Seq.UnknownSeq): print("Warning: FASTA sequen...
1c3af236aa30f68cfdeb062ee8ba3ff19262ae1b2ba49e2f2c205921d75fab65
Python
1,391
30
from unittest import result import pandas as pd import matplotlib.pyplot as plt import utils from prodict import Prodict import numpy as np from scipy import stats def explore_encondings(cfg: Prodict): encodings_path = f"{cfg.DATA.OUTPUT_DIR}/{cfg.TEST.RUN_ID}/e{cfg.TEST.EPOCH_TO_TEST}/tables/encodings/epoch-{cf...
56d3a8ae148ed90b9882051e62c65269ba09e430d64ce18ceeb55a38501fb997
Python
1,391
36
"""Test model with expression parameters""" import numpy as np import pyjibe.head from helpers import MockModelModuleExpr, make_directory_with_data def test_model_expr_base(qtbot): """Expressions sanity check This test is just to make sure that parameters that have an expression are not overridden by t...
c42a3f3fd11842e121df90bf80f240dbde651431cc3036a1c92302175324d93d
Python
1,391
46
# coding=utf-8 # Copyright 2023 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...
e803c446fea13b8a916ebdeaeb1c89758edaac2608b85baf635bc751c650102e
Python
1,391
43
import tensorflow as tf from tensorflow import keras import os import numpy as np import nibabel as nib import matplotlib.pyplot as plt # Jayse Weaver, weaverjaysem@gmail.com # Evaluating CNN described in https://doi.org/10.1162/imag_a_00023 # Below example processes two individual diffusion directions # For a 4D NIf...
e9910633d76738accf887c8df0364d94e80496b3af25eb568feea707abc1279f
Python
1,391
48
import os import utils import yaml import joblib from sklearn.feature_selection import SelectKBest from sklearn.pipeline import Pipeline from sksurv.datasets import get_x_y from sksurv.ensemble import RandomSurvivalForest from skopt.space import Real, Categorical, Integer def preprocess_data(dataset, config): X =...
1ecbc65630b35474b775657e361a792604de83b6d8e1ec1194d4e651791e47b1
Python
1,392
40
"""Tests for specparam.algorthms.settings.""" from specparam.algorithms.settings import * ################################################################################################### ################################################################################################### def test_settings_values():...
16aeca1c35597f3e9b1c3142a28acfb7e1125633dd8449247a1037f48dbbc8e6
Python
1,393
32
''' Forming the features vector with the fukui indices. ''' import numpy as np def add_fukuis(df_row, h, longest_molecule): ''' Adding in the fukui indices for each atom in features vector. ''' h = np.array(h).reshape([longest_molecule, -1]) padded_electro_fukuis, padded_nucleo_fukuis, padded_rad_f...
3a1cbabf245e1920d740acfb92acdacc1af03dd6a9c59cfefaffeb1ba6adf750
Python
1,393
57
import numpy as np import scanpy as sc from anndata import AnnData from scipy import sparse as sp from sklearn.neighbors import kneighbors_graph from utils import dopca def get_adj(count, k=160, pca=30, mode="connectivity"): if pca: countp = dopca(count, dim=pca) else: countp = count A = ...
70e66fad135156dd2bfe7c3fe15ecdd4fa10bc36979b1faae6dcc8732dd4ac74
Python
1,393
48
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["splicepoint_model_spec"] = dict( type="BothLSSIModels", acceptor="model/splicepoint-model-acceptor-1", donor="model/splicepoint-model-donor-1", ) msp.architecture["motif_model_spec"]["motif_...
b29311f345d42c1220a86d389c97448bcece07c05296282f5b0208d235a7d6b9
Python
1,393
39
# copyright (c) 2024 PaddleHelix Authors. All Rights Reserve. # # Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 # International License (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://creativecommons.o...
bab8d87a8f0b745e3513e2ac3abc53133faf0f2bff29e352500f6946b06e2674
Python
1,393
48
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["splicepoint_model_spec"] = dict( type="BothLSSIModels", acceptor="model/splicepoint-model-acceptor-1", donor="model/splicepoint-model-donor-1", ) msp.architecture["motif_model_spec"]["motif_...
cff6a4e928fdab59d7b4b44c8d21e7178512284c82589de5895164d14c5a97d2
Python
1,393
47
#!/usr/bin/env python """ A generic wrapper to access nmodl binaries from a python installation Please create a softlink with the binary name to be called. """ import os import stat import sys if sys.version_info >= (3, 9): from importlib.metadata import metadata, PackageNotFoundError from importlib.resources ...
303a09cc790b1fb556bf64e6dbea5e1a1daaac9ba3069ca89c18faba4127203f
Python
1,394
48
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["splicepoint_model_spec"] = dict( type="BothLSSIModels", acceptor="model/splicepoint-model-acceptor-1", donor="model/splicepoint-model-donor-1", ) msp.architecture["motif_model_spec"]["motif_...
3aabe36567e2d0878b99dd025ea468540a3ad82f4e3fe22a5c65f2e07b595279
Python
1,394
46
#!/usr/bin/env python #========================================================================= # # Copyright NumFOCUS # # 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://...
78579f218695bf779610b5f0cf020ccc0916704a59cba4d6d2170980d2dc719c
Python
1,394
32
import setuptools from setuptools.command.install import install from io import open import os install_requires = ["numpy", "matplotlib", "biom-format", "rpy2"] setuptools.setup( name='lefse', version='1.1.2', author='Nicola Segata', author_email='nicola.segata@unitn.it', url='http://github.com/Seg...
ce30dcace32c7146526079c4cd2314de9417f2cfd6d4a414d4e1e5b3c4b70917
Python
1,394
44
from celery.contrib.abortable import AbortableAsyncResult, AbortableTask class test_AbortableTask: def setup_method(self): @self.app.task(base=AbortableTask, shared=False) def abortable(): return True self.abortable = abortable def test_async_result_is_abortable(self): ...
26a398d6505419c1af2728e87835bc105ff8c0c116c7b93f555258eb52f7a8ca
Python
1,395
49
#!/usr/bin/env python import os import sys from xml.sax.saxutils import escape def make_table(directory): ret = ['<table class="fileList">\n'] for root, dirs, files in os.walk(directory): root = root.rstrip("/") ret.append( ' <tr><td class="directory">%s</td></tr>\n' ...
337f5913843ffe1b72eb233114b16a0bfb9f631f1b32878652794935efd8ee25
Python
1,395
81
from datetime import datetime import numpy as np import torch import os import time from constants import get_args from spliceai_torch import ( SpliceAI, load_model, save_model, SpliceAIDataset, evaluate_model, ) from load_psam_motif import read_motifs from map_protein_name import get_map_protei...
cf74bbda37eaff872a853d652aea026e6e42824a7ff2f536004c182f4ae763db
Python
1,395
48
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"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
2acf628ba41383ac7ddfa7276300c7a08440313598b6ac77399539b5ddfdd82b
Python
1,396
40
#!/usr/bin/env python from distutils.core import setup import wyrm setup( name='Wyrm', version=wyrm.__version__, description='Toolbox for Brain Computer Interfacing Experiments.', long_description='A Python toolbox for on-line BCI experiments and off-line BCI data analysis.', author='Bastian Ve...
d12336492c8cdde0788c8acdc9face30072273ba225b847357301ada2620d674
Python
1,396
37
from __future__ import annotations import os import unittest import warnings from coco_froc_analysis.count import count_point class TestFrocCurve(unittest.TestCase): def setUp(self): self.gt_ann_path = f'{os.getcwd()}/tests/example_coco_data/face-mask.json' self.pr_prefect = ( f'{os....
8456f079ddea0f9e2142815669994be24b380a8f4c18a333dfcf235b7f04734a
Python
1,397
43
from typing import List, Optional, Tuple, Union class Field: """Object to specify requirements for a field provided in configuration file.""" def __init__(self, name: str, types: List, default = None, requirements: Optional[List] = None, key: Optional[str] = None): """ Class constructor. ...
d45b777761c22719d5206b18d1da3a5227860999ed24e797c79269240fcdab39
Python
1,397
54
#!/usr/bin/env python """ Input: Molecule file Output: Molecule file with hydrogen atoms added at the target pH. """ import argparse import sys from openbabel import openbabel, pybel openbabel.obErrorLog.StopLogging() def parse_command_line(argv): parser = argparse.ArgumentParser() parser.add_argum...
0b27981f691f0ca48649446805f5adc7eb137196503fe6cad7bd0d98a6259ac8
Python
1,398
41
import logging from pip._internal.cli.base_command import Command from pip._internal.operations.check import ( check_package_set, create_package_set_from_installed, ) logger = logging.getLogger(__name__) class CheckCommand(Command): """Verify installed packages have compatible dependencies.""" name = 'c...
5c6dfe2584fac9f86277d071ea9a26d2fa458ca1c92411b177ba627c5eab86e0
Python
1,398
32
from angorapy.analysis.investigators import Predictability import tensorflow as tf from angorapy.common.policies import BasePolicyDistribution import tensorflow_probability as tfp class Correlation(Predictability): def __init__(self, network: tf.keras.Model, distribution: BasePolicyDistribution): super...
1cb057d8db31de0a45cc6a9d9733f6c6779bd1cc3f5ec67412f5ac5b7596c785
Python
1,399
47
import pytest from pytest_celery import CeleryTestSetup, CeleryTestWorker from t.smoke.tests.stamping.workers.legacy import * # noqa from t.smoke.tests.stamping.workers.legacy import LegacyWorkerContainer from t.smoke.workers.dev import SmokeWorkerContainer @pytest.fixture def default_rabbitmq_broker_image() -> str...
4bd9ed89de3550d23930be75ca1189ce2b6d1a102fde897e2db74e5c0022d251
Python
1,399
47
# Copyright 2022 Deepfold Team # # 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 or agreed to in writin...
7a78bca864c67949a1be74eb7731c29112051af4d42af0c1b0ab0defb46f81da
Python
1,399
44
"""GluonCV Utility functions.""" # pylint: disable=wildcard-import,exec-used,wrong-import-position from __future__ import absolute_import import types def import_dummy_module(code, name): # create blank module module = types.ModuleType(name) # populate the module with code exec(code, module.__dict__) ...
9dcf78a752d1bb6ba6f16499673c1028749ccf9b8445858144f0899c7cba6a18
Python
1,399
25
from __future__ import annotations from .bootstrap_froc_curve import generate_bootstrap_froc_curves # noqa: F401, E501 from .froc_curve import froc_point # noqa: F401 from .froc_curve import generate_froc_curve # noqa: F401 documentation = None """ This submodule provides functionality for evaluating Free-Response...
cf28e480c140d85bc9992f31cba7d1b9655280a3902b9b23bcc4f75bcca42866
Python
1,400
60
import os import hydra import hydra.experimental import numpy as np import pytest import torch pytest_plugins = ["helpers_namespace"] hydra.experimental.initialize( os.path.join(os.path.dirname(__file__), "../pointnet2/config") ) @pytest.helpers.register def build_cfg(overrides=[]): return hydra.experiment...
d18a3e8c097f13d8dda6279153d40f203dfe6ceff001b8029d3764f62f54e083
Python
1,401
46
"""Phase 4 miscellaneous capture tests.""" from __future__ import annotations import json from pathlib import Path import torch import torchlens as tl import torchlens.utils as utils def test_register_op_rule_affects_flops() -> None: """Custom op rules are accepted by the utility registry.""" utils.regis...
f0745c9c725c68d49f83f6fe0e0f752910230d70b1fb2ed91e063c203d16cdef
Python
1,401
68
#!/usr/bin/env python import sys import pysam import numpy as np import collections from collections import Counter values = 12 def get_site_arround(sites_path, fasta_path, values): fasta = pysam.FastaFile(fasta_path) sequences = [] with open(sites_path) as f: for line in f: line = line.strip().split('\t') ...
1d6ee2cc29cf7ea393664415923bd4e462207d58ecd48d9b6af5e69befd5d611
Python
1,402
82
from ._alphabets import DNA, AminoAlphabet, NucleotideAlphabet # NOTE the "*" character is termination i.e. STOP codon canonical_codons_to_aas = { "TTT": "F", "TTC": "F", "TTA": "L", "TTG": "L", "CTT": "L", "CTC": "L", "CTA": "L", "CTG": "L", "ATT": "I", "ATC": "I", "ATA": "...
2bf180ded399ca05ae29a99076353c50ebfa22adbc0fe4b73952ac47e03aa2c0
Python
1,402
40
""" core.feature_spec — Canonical feature pool definitions. The classifier consumes 15 features in a fixed order: - 5D state-geometry channels (`CHANNELS_5D`): I_A, org, I_M, I_R, rel_alpha - 10 established / candidate EEG-AD markers (`FEATURES = AP_TOPO + CONN_ALPHA`): AP_TOPO (7): iaf, dfa, fooo...
393fc60cd399cb650c7a872094864e629307abb3de09b1bcd20dd8ec0df9ef5d
Python
1,402
42
import pytest from rpy2.robjects import packages try: from rpy2.robjects.lib import tidyr has_tidyr = True msg = '' except packages.PackageNotInstalledError as error: has_tidyr = False msg = str(error) from rpy2 import rinterface from rpy2.robjects import vectors datasets = packages.importr('data...
56ecc2ee32e11d6f5eef4266b838f14a669b8a6ad3eb79fe534c92a4dd198505
Python
1,402
41
#!/usr/bin/env python3 import sys import os import argparse def read_params(args): parser = argparse.ArgumentParser(description='Convert LEfSe output to ' 'Circlader input') parser.add_argument( 'inp_f', metavar='INPUT_FILE', nargs='?', default=None, typ...
9c697e33b67cdac5607df0ccbdc9ac53aeb9cd3dec3d50826f96bb9ac37381da
Python
1,402
47
# Directional sensory input and synaptic weights from os.path import join import numpy as np import os import pandas as pd from library.comput_utils import cal_hd_np from library.params import ParamsHolder from library.shared_vars import sim_results_dir from library.utils import save_pickle from library.simulation impo...
146f82a410382723a22da94ba93cfc8f0d055fdb93e8db6a1eb5b51a0192e979
Python
1,403
36
"""Test model with expression parameters""" import numpy as np import pyjibe.head from helpers import MockModelModuleExpr, make_directory_with_data def test_model_expr_base(qtbot): """Expressions sanity check This test is just to make sure that parameters that have an expression are not overridden by t...
3ae53296c06c7b53f5d9d715a39f2ff32884c477ee353aa9f67b2f06d400196f
Python
1,403
44
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Simple volume-preserving MAF on cartesian coordinates. """ # =================================================...
9991be52f839e65342bfc82f8b684afa3a7291e2b7e729665e7e0e5ca82ee40d
Python
1,403
45
import attr import numpy as np from working.synthetic_data.mutation.codon_mutation import CodonMutation @attr.s class CodonAddress: unchangable_positions_mask = attr.ib() all_codon_indices = attr.ib() is_exon = attr.ib() index_map = attr.ib() @classmethod def of(cls, eci, ici, unchangable_p...
1cfe67750570ad16b36ba812d6bc775e2d7953893e58724f414dc527c4631f00
Python
1,404
39
import pycistarget import pyranges as pr import pandas as pd from scenicplus.wrappers.run_pycistarget import run_pycistarget import glob import os from pyscistarget.utils import region_names_to_coordinates import pyprojroot proj_dir = str(pyprojroot.here()) nvolp_peak_fnm = os.path.join(proj_dir, "18.snap2_peakcalli...
4fe0985a6a808fa7260b38ed1b2d1db82c9efbbb8a49c97d90070cef4a5b2ee2
Python
1,404
53
from os import path from threading import Thread import traceback import logging import time try: import picamera except: logging.warning("Could not load picamera module") class RecordVideo(Thread): def __init__(self, data=None, name="myvideo", ETHOSCOPE_DIR = "/ethoscope_data/results"): #TOD...
2585fbb837849710930694e1e327c44240fb3ded3f119f6495e6e49646f5ec0b
Python
1,405
42
import pandas as pd import glob import os from statsmodels.stats.multitest import fdrcorrection import seaborn as sns import matplotlib.pyplot as plt import argparse parser = argparse.ArgumentParser() parser.add_argument("--sample", action = "store", help = "name of sample") parser.add_argument("--results", action = ...
83d0ba13a9cc4bd47e3a1bbc5c1f15c5fc024f14c16cedc4a642ce02911ea4db
Python
1,405
33
import numpy as np from sklearn import metrics class Metrics(object): """Define metrics to be use when training/evaluating models. """ @classmethod def flat_accuracy(cls, y_true, y_pred): """ Function to calculate the accuracy of our predictions vs labels """ return np.sum(y_pr...
a8aa7b7c678c58220d399610aff5a9443b4da28cbe169efd11704c779e8882b6
Python
1,405
46
import pymc as pm from pmsurv.models import weibull_linear import numpy as np import time def main(): model = weibull_linear.WeibullModelLinear() model.load('data/model.yaml') print(model.trace) x_predict = np.asarray([[2 * 10, 2, 3, 4, 0, 0, 0]]) start = time.time() cached_model = model.cre...
cc44165ea4444bc114aedba76cf2f15451f182df97629317589d46902742f118
Python
1,406
48
import os from flask import Flask def create_app(test_config=None): """Create and configure an instance of the Flask application.""" app = Flask(__name__, instance_relative_config=True) app.config.from_mapping( # a default secret that should be overridden by instance config SECRET_KEY="de...
d7f0aae4fd4b23f310dcdd9af2c1c29e9f57c96e5793da0af4fc9845750cefb5
Python
1,407
40
import pytest import contextlib import os import tempfile from rpy2.robjects.conversion import localconverter import rpy2.robjects as robjects from rpy2.robjects.lib import grid from rpy2.robjects.vectors import FloatVector, StrVector @pytest.mark.parametrize( 'constructor,args,kwargs,res_cls', ((grid.unit, ...
fe43ecbda424db27383d1961e35604df431b5e4954f1e0610fe3982ddec09c03
Python
1,407
52
import numpy as np from neuron import gui from neuron import h from neuron.units import ms def test_cvode(rtol): nseg = 1 mech = "scalar" s = h.Section() cvode = h.CVode() cvode.active(True) cvode.atol(1e-10) s.insert(mech) s.nseg = nseg t_hoc = h.Vector().record(h._ref_t) va...
825085e96b03a166006a835cb8754003525edb60b4a627d4b60dc9f2351fbee4
Python
1,408
48
"""Benchmarking module for AlignedSegment functionality""" import os import array import pysam from TestUtils import BAM_DATADIR def set_binary_tag(): read = pysam.AlignedSegment() read.set_tag('FZ', array.array('H', range(1000))) return len(read.get_tag('FZ')) def read_binary_tag(fn): with pysam....
d839834724983ccc2928ce7e2842f6d3a0ba56fae6d19a339af43e92262d86b6
Python
1,408
45
# code from berak taken from https://answers.opencv.org/question/134248/how-to-define-the-lower-and-upper-range-of-a-color/ import cv2 import numpy as np image_hsv = None # global ;( pixel = (20,60,80) # some stupid default # mouse callback function def pick_color(event,x,y,flags,param): if event == cv2.EVENT_L...
dc07bde268ed38ed4902695a8d1475e066dee6710da5425aa45b5da31efdd115
Python
1,408
38
import json import pandas as pd from tqdm import tqdm def levenshteinDistance(s1, s2): if len(s1) > len(s2): s1, s2 = s2, s1 distances = range(len(s1) + 1) for i2, c2 in enumerate(s2): distances_ = [i2+1] for i1, c1 in enumerate(s1): if c1 == c2: distan...
4829f27323af65a5653c810bac2404141b307c6adaa1a1f039a2b4647b547043
Python
1,409
49
import numpy as np import pandas as pd from nfp.preprocessing.mol_preprocessor import SmilesPreprocessor from tensorflow.keras.utils import get_file from tqdm.auto import tqdm from spektral.data import Dataset, Graph from spektral.utils import sparse # Load the YSI dataset and split into train and validation sets ysi...
638495e9d3d3c8b48e533f5a9861f050d746d19d78ff8ef7a498ca7cd49b9a26
Python
1,409
28
import os import slicer from slicer.ScriptedLoadableModule import * # Source: https://github.com/lassoan/SlicerSegmentEditorExtraEffects class SegmentEditorBiomedisaPrediction(ScriptedLoadableModule): """Uses ScriptedLoadableModule base class, available at: https://github.com/Slicer/Slicer/blob/main/Base/Pytho...
6fb1cbb463aba283c1b84ccf5027671808497ea0836c81e7eade7764a0a10b9c
Python
1,409
50
import numpy as np from .conf_ranker import ConfRanker from rdkit import Chem from rdkit.Chem.rdFreeSASA import CalcSASA, classifyAtoms from rdkit.Chem import Mol from typing import List, Any, Sequence class SASARanker(ConfRanker): """Rank conformers using the Solvent Accessible Surface Area (SASA) :param n...
c967e7dccc035a3b80382a061a16da81bc38bb9bb81aa292dff596c3a6a6c87e
Python
1,409
48
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"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
795f4b8505c159e2eada20bd9dfef6357b8acac5ddd1922c2d8f07c94ad214b9
Python
1,410
52
import os from pathlib import Path import sys import traceback from typing import Dict import snapatac2 as sa2 import pyprojroot code_root_dir = str(pyprojroot.here()) pack_dir = f"{code_root_dir}/package/python" sys.path.insert(0, pack_dir) import utils #pyright: ignore # noqa: E402 # * log logger = utils.set_file_...
493a90cdf8782d53508b4ae219f3e6ab4e9579287934bc8ce70e734e7c6a5d03
Python
1,412
40
import numpy as np from pyrates import CircuitTemplate, NodeTemplate, clear_frontend_caches clear_frontend_caches() # node definition li = NodeTemplate.from_yaml("model_templates.base_templates.tanh_node") N = 5 nodes = [f"p{i+1}" for i in range(N)] net = CircuitTemplate(name="li_coupled", nodes={key: li for key in no...
dfc59da4750225a74f37586637579fc7ada3cc3b4dd7aa5606fe8df4bed9d6b9
Python
1,412
47
# -*- coding: utf-8 -*- # @Author: gviejo # @Date: 2022-01-17 13:34:41 # @Last Modified by: gviejo # @Last Modified time: 2022-01-17 22:56:34 from setuptools import setup, find_packages #with open('README.md') as readme_file: # readme = readme_file.read() requirements = [ 'pynapple', 'scikit-learn', 'seabo...
adf607ad7bc2d7e2e0f86331d248890a8ac5223786b9c6dfa53943133ddd77b4
Python
1,413
52
"""Email column unique constraint Revision ID: 1cf595475b58 Revises: d619fdfa6168 Create Date: 2024-07-03 19:53:22.443016 """ from alembic import op from galaxy.model.database_object_names import build_index_name from galaxy.model.migrations.data_fixes.user_table_fixer import EmailDeduplicator from galaxy.model.migr...
b08c119f6ffe388ded28572c32e58211d215a97dc94ee59db789b9ecd565d05a
Python
1,414
36
def fly_am(msp): fraction_of_standard_epoch = 15294 / 162706 msp.decay_per_epoch = 0.9 ** fraction_of_standard_epoch msp.architecture["num_motifs"] = 53 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"] = dict( type="AdjustedMo...
cbe6cfe86f4d17e52aca17a7344132b8f769b0b6484801c241746afd4fb68b7f
Python
1,414
38
import argparse import glob import os from tqdm import tqdm def main(): parser = argparse.ArgumentParser(description="Compare tags") parser.add_argument('folder_tags', metavar='file', help="folder with human marked tags") parser.add_argument('-s', '--snr', action='store', type=str, default=None, help="sn...
cc3f084a7ece7bb4d609b1690992763acb91115f24387afed6f3b08f6e2152f8
Python
1,414
50
# ruff: noqa -- harvest-time provenance script, committed as run (lint header added at import) """Write a genuine artifact using whatever torchlens is on PYTHONPATH. Usage: write_artifact.py <outdir> <level> Real model: torchvision resnet18 IMAGENET1K_V1 (cached), 32x32 input (small artifact). """ import json import o...
41e506f037d33defa1944ae67541e23af95f29337dc4a8ecb9b7b6edd5a434ff
Python
1,415
46
""" Utility functions used for classic control environments. """ from typing import Optional, SupportsFloat, Tuple def verify_number_and_cast(x: SupportsFloat) -> float: """Verify parameter is a single number and cast to a float.""" try: x = float(x) except (ValueError, TypeError): raise ...
6bd40e6a0d480269927d31abe536932b29a6e370a508bd921f853f01ff021fb3
Python
1,416
39
import importlib import numpy as np from keras.src.testing import test_case from keras.src.utils import module_utils class LazyModuleTest(test_case.TestCase): def test_missing_required_attr(self): lm = module_utils.LazyModule("numpy", required_attr="dummy_attribute") self.assertFalse(lm.availabl...
be0cb0d3c68dc12200e0105ebf1c1f77cde60e12f13a571d30e1917f5f9f0cb4
Python
1,416
50
import base64 import logging from galaxy.files.models import ( BaseFileSourceConfiguration, BaseFileSourceTemplateConfiguration, FilesSourceRuntimeContext, ) from . import ( DefaultBaseFilesSource, PluginKind, ) log = logging.getLogger(__name__) class Base64FilesSource(DefaultBaseFilesSource): ...
e246c3a7f29479f9dda888ad17ba87d15c506131189798a68ad3ad2e85f7be08
Python
1,417
44
from setuptools import setup import versioneer requirements = [ 'tensorflow>=2.0', 'tensorflow-probability[tf]', # tfp for the Batch Norm (covariance) # 'tensorflow-addons', 'numpy', 'six', 'packaging', 'pandas', 'scipy', # Data 'colorlog', 'openpyxl', # Logging ...
0818b70d690f17f47b3bbe022aa2d45041f9b99daed46b018ca79d60876ed7ba
Python
1,418
40
from setuptools import setup setup( name='pyoperant', version='0.1.2', author='Justin Kiggins', author_email='justin.kiggins@gmail.com', maintainer='Timothy Gentner', maintainer_email='tgentner@ucsd.edu', description='hardware interface and controls for operant conditioning', long_descr...
1e95dd9a7f94b5d797ba6a48d93c319be1a8a858c0d7595b6706a418d77d013d
Python
1,418
31
# Define a set of distributions from which to sample # Currently the available sampling features are: # 1. soma_size # 2. n_neurites # 3. trunk_orientation_deviations from distributions import sample distributions_exemplar = { "soma_size": {"norm": {"mean": 8, "std": 1.18}}, "n_neurites": {"norm": {"mean": 6.7...
f3f1419fd9dc666817ee173ab0902ef19cd9806b1d2e5d90bc6ca5836b6ae1ec
Python
1,418
34
"""R65: two runnable-load parse-time exception classes were plain ValueError subclasses invisible to ``except TorchLensError`` handling, with no branchable ``fields["code"]``. They now subclass ``TorchLensError`` (keeping ``ValueError`` via MRO) and carry their code on ``fields``. """ from __future__ import annotation...
1d2cb556f6d7a8f8ba6f8a066e0c73d726ee439cdf5e7036384836590aa80ebe
Python
1,419
43
from os.path import dirname, realpath, exists from setuptools import setup, find_packages import sys author = u"Paul Müller" authors = [author] description = 'Graphical user interface for Bio-AFM analysis' name = 'pyjibe' year = "2019" sys.path.insert(0, realpath(dirname(__file__))+"/"+name) from _version import ver...
1ff26481620864d788256b7622c2b6f701126ae48ad3c7c42ff931debfecf198
Python
1,419
39
"""Widget containing preprocessing plot""" from nanite import preproc from PyQt5 import QtWidgets from .mpl_preproc import MPLPreproc class WidgetPlotPreproc(QtWidgets.QWidget): def __init__(self, *args, **kwargs): """Display preprocessing graph with navigation""" super(WidgetPlotPreproc, self)._...
4460b558aeffca1e4593d0eb684985b525a048595f8ff71879dca5ed77f32e37
Python
1,419
38
from __future__ import annotations import torch from PIL import Image from lightly.transforms import CAPITransform from lightly.transforms.utils import IMAGENET_NORMALIZE def test_view_on_pil_image() -> None: transform = CAPITransform(input_size=32) output = transform(Image.new("RGB", (100, 100))) asser...
72ea3e6c0166274972f55cb8a63acc6fee79aa66fa1d593174f9bc76f42374bd
Python
1,419
39
"""Widget containing preprocessing plot""" from nanite import preproc from PyQt6 import QtWidgets from .mpl_preproc import MPLPreproc class WidgetPlotPreproc(QtWidgets.QWidget): def __init__(self, *args, **kwargs): """Display preprocessing graph with navigation""" super(WidgetPlotPreproc, self)._...
871d61742e8ee3d067058327b45af36e5a2260e25d71b6eefa602c522a1f5414
Python
1,419
51
import pydeface.utils as pdu from shutil import which import tempfile import os import pytest from pathlib import Path import urllib.request def test_cleanup_files(): files = [] for p in range(3): files.append(tempfile.mkstemp()[1]) pdu.cleanup_files(files[0]) pdu.cleanup_files(*files[1:]) ...
9a3630774af361aa05af0bdac85bdc93a2ee0a4d7931b447ea826adaee1318bb
Python
1,419
38
''' Standard levels for Asteroid Impact This script generates the standard levels and exports them as json files, including a level list. ''' import json from makelevel import make_level from os import path def export_levels(levelprefix='hard'): leveldirectory = 'levels' levels = [ # crazy town # beatable in 10...
686f15c49a6ee73b4ae81e42890b711fff1e9c1e000b6a82993553a4a238160a
Python
1,420
55
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 80 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"] = dict(type="NoMotifModel") msp.architecture["affine_sparsity_enforcer"...
cead471c3fdc612e580ea5118e4f04538547c87a8f90ddb3a9c7b4d934c75e56
Python
1,420
47
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals from __future__ import division from __future__ import print_function import math import torch import torch.nn as nn import torch.nn.init as init from torch.nn.parameter import Parameter from torch.nn.modules.module...
026def5c794a4bc6625fd633fa428cd7b039a4e6d1ada3e5db435c78edf03473
Python
1,421
36
from os.path import abspath, join import numpy as np def run(): from spitfire.chemistry.mechanism import ChemicalMechanismSpec from spitfire.chemistry.tabulation import build_adiabatic_eq_library, apply_mixing_model, PDFSpec import spitfire.chemistry.analysis as sca test_xml = abspath(join('tests', '...
392fc17e4d8e2818a4251acbec2a738b0c59ab16c0e1d09c1c5f9a916e1bdcf2
Python
1,421
56
# to prepare for computeing the distance matrix based on blosum62 # following the formula in NetMHCpan paper, # first compute the alignment scores of the HLA pseudo sequences import numpy as np import pandas as pd from collections import defaultdict from collections import Counter # load blosum62_X blosum62_X = pd.r...
b2e52f3ae449a0680acebe26b0e4f506728165314000d0cd8d6693a688a869d0
Python
1,421
50
from lightly.transforms.byol_transform import ( BYOLTransform, BYOLView1Transform, BYOLView2Transform, ) class TiCoTransform(BYOLTransform): """Implements the transformations for TiCo[0]. These are the same as BYOL[1]. Input to this transform: PIL Image or Tensor. Output of this tran...
5a07d5e51f4fc579b8cfb2d7b2e96c8cf9cba11e67c16134c3696b556f782f61
Python
1,422
50
import os import sys import glob import pdb try: import cPickle as pickle except: import pickle import numpy as np # import matplotlib.pyplot as plt def mergetraces(ftr, outswcfile, logfiles=None): ftr_minus_traces = os.path.split(ftr)[-1] ftr_minus_traces = ftr_minus_traces[:-7] ...
aa614286edabd1a8b11a5cc8169880736561efd5591fbe78a37bbac9dd5d79da
Python
1,422
51
"""GCP Batch runner utilities and templates.""" from string import Template from galaxy.util.resources import resource_string from .helpers import ( compute_gpu_machine_type, compute_machine_type, convert_cpu_to_milli, convert_duration_to_seconds, convert_memory_to_mib, DEFAULT_CPU_MILLI, ...
f6ebc2b09360a4fc17a10b1d916000ae0b675ff45a89fd082f0b5dfd618a90ce
Python
1,422
53
#!/usr/bin/env python # -*- coding: UTF-8 -*- import sys def stop_err(msg): sys.stderr.write("%s\n" % msg) sys.exit(1) def get_col_index(col_str): if isinstance(col_str, str) and col_str[0] == "c": col_str = col_str[1:] return int(col_str) - 1 def main(blast_tabular_file, outfile, score_c...
1e5079c2425b09e9023f8f34ef365a630c96dbf7d4fad2419271f3ea815edc7a
Python
1,423
55
import os import hydra import omegaconf import pytorch_lightning as pl import torch from pytorch_lightning.loggers import TensorBoardLogger torch.backends.cudnn.enabled = True torch.backends.cudnn.benchmark = True def hydra_params_to_dotdict(hparams): def _to_dot_dict(cfg): res = {} for k, v in ...
33ecf405a076fd41a980c18230b83926d89fa3d2e8bc2da680fbb29b08bd51ea
Python
1,424
51
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=4), ) msp.data_spec = dict( type="H5Dataset", datap...
f1314775c0c87c1c9f0d02b18a27369abdd0f983e6aab1cff5489e210823013d
Python
1,425
49
from __future__ import annotations import json import os from datetime import datetime from typing import TYPE_CHECKING import numpy as np if TYPE_CHECKING: from bream4.device_interfaces.devices.base_device import BaseDeviceInterface # Native numpy types are not json serialisable # This causes weird type issue...
3ecd5b3e143ecf752a95ad77bf77a71729fd4ac85e05841394eff276e436d35e
Python
1,426
65
from collections.abc import Sequence import numpy as np from ._utils import StrSeqType, cast_seqs, check_axes def remove_N_seqs(seqs: Sequence[str]): """Removes sequences containing 'N' from a list of sequences. Parameters ---------- seqs List of sequences to be filtered. Returns -...
6a8cfeceaf33f3af8be24c46995e58cd6cb69aef3785ba3b8eac30953fa32c82
Python
1,426
47
from typing import List import snapatac2 as sa2 def modify_obs_name(sds: sa2.AnnData | sa2.AnnDataSet, obs_key = "sample") -> List[str]: obs_names: List[str] = [f"{i}.{j}" for i, j in zip( sds.obs[obs_key].to_list(), sds.obs_names)] return obs_names def...
bc5ebdec3d1c4dfc782e299c99badee4990970b8b5ad45f4b52fc9be25f5d598
Python
1,426
41
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on December 2020 @author: Thomas Bonald <bonald@enst.fr> """ import unittest import numpy as np from numpy.linalg import norm from sknetwork.data import karate_club, painters from sknetwork.utils import get_neighbors, get_degrees, get_weights class TestNeig...
3a99524d98eb69c44c331eb36f1b6221397e9b4817612fafedce14f23d7f0a30
Python
1,428
44
# overcoming the problem of SHAPE data working with a single line. # creating multiple multiple files containg SHAPE data for a single sequence and running RNAfold for every # single sequence. import re import sys from subprocess import PIPE, Popen from Bio import SeqIO params_list = sys.argv[1:] param_list_no_shape...
4e5baec07f00baf5f28258046086b86e75545962ceaec64b641dfdae25ffffa1
Python
1,428
43
import sqlite3 from .db import DB class DistrictVaccinationTable(DB): def __init__(self): super().__init__() self.table_name = 'UK_vaccination' self.table_desc = 'Uttarakhand district wise vaccination snapshot' self.cols = self.getcolumns() def getcolumns(self): cols...
cc97b38570a6425f5e2a44763959ff49ce05314b1d45b29b2b2e91f94b9d77e2
Python
1,429
48
import copy from typing import List import numpy as np from pymatgen.core.structure import Molecule def perturb_along_eigenmode( ts_molecule: Molecule, eigenmode: List[float], scaling: float ) -> Molecule: """Perturn the molecule along the eigen modes based on a scaling factor. Args: ts_molecul...
41d7efeaab7add610163c3bee58aaa2ef6f78191a034699a4e55a67b14e6cc8f
Python
1,430
46
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 pyabf.tools.sweep import matplotlib.pyplot as plt if __name__ == "__main__": ...
9c1503be3a006094daf906c8a3dec9b656211c8325c72399f6f67290aea2706e
Python
1,430
50
#!/usr/bin/env python3 """ Run this script to get ThermoNet ddG predictions. """ # import required modules from tensorflow.keras.models import load_model import numpy as np from argparse import ArgumentParser def parse_cmd_args(): """ Parse command-line arguments for running ThermoNet. Returns ...
2b4f38bbe837339617562045d234a098f41af05d8c512b3441286ac38c24f755
Python
1,431
50
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"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...