sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9bce116e7136a85cc0526a18b2b838b3d3b0fb9b6b2065e77526ad77b33fcbd6
Python
687
25
import sys bed_fname1 = sys.argv[1] bed_fname2 = sys.argv[2] def load_bed(bed_fname): data = [] with open(bed_fname, "r") as f: for line in f: tokens = line.strip().split() chrom, start, stop = tokens[0:3] data.append((chrom, int(start), int(stop))) return data ...
e597869457023952a3578e615fed7c3b65b235df7451906f444aa0d42f6887a8
Python
687
23
import os; import sys; my_path=os.path.dirname(os.path.realpath(__file__)); root=os.path.abspath(my_path+'/../..') sys.path.insert(0,root); from biswebpython.core.bis_objects import * from biswebpython.modules.smoothImage import * # change this fname1= root +'/test/testdata/indiv/prep.nii.gz'; input=bisImage(); inp...
faeec4e7204247c0d3765a591e3a80255a6b374b1f09d6bfc64c9dfe81949614
Python
687
21
from PIL import Image from lightly.transforms.simclr_transform import SimCLRTransform, SimCLRViewTransform from .. import helpers def test_view_on_pil_image() -> None: single_view_transform = SimCLRViewTransform(input_size=32) sample = Image.new("RGB", (100, 100)) output = single_view_transform(sample) ...
255c6cc3c7eb3cf9464b8b3fff28a6febfc9a389372c335abc72e7f15962717f
Python
688
25
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="NoSparsityPropagation") msp.architecture["final_processor_spec"].update( dict( bottleneck_spec=dict(type="First...
90d323c3f0419b81d03c7ed5a367d35a178d7cbaad9872a2cb0b0e63577daf3c
Python
688
27
""" This module define a """ # pylint: disable=W0223 import torch import logging from utils.utils import select_output_lm import torch class SumLossJustExpWeights( torch.nn.modules.loss._Loss ): # pylint: disable=protected-access """ This class define a specific loss : """ def __init__(self): ...
11f3521c310a9f31c5c11dc2d526d9f8a48b3ab32794dc2d46e1ff79429a19f9
Python
689
23
from neuron import h, gui # Since a double is 64-bits and a pointer is also 32 or 64-bits, we can store # the bits of a pointer in the memory that was allocated for use as doubles. # Concretely, we, using VERBATIM, safe pointers in ASSIGNED or RANGE variables. # # The pattern is found in the builtin mod file: `apcount...
9901524a702109d878adb100ca8841b75f05f3523d8b344ccebfc40c1af33489
Python
689
17
"""Script for export pre-trained models in GluonCV model zoo.""" from __future__ import print_function import argparse import gluoncv as gcv gcv.utils.check_version('0.6.0') def parse_args(): parser = argparse.ArgumentParser("Export model helper.") parser.add_argument('--model', '-m', required=True, type=str, ...
263051ee39876e568e2d5d5b39f8f6940fa90739f9d0ff3d76ea91a16eedd692
Python
690
26
import pytest from rpy2 import robjects @pytest.fixture(scope='module') def set_class_A(): robjects.r('methods::setClass("A", representation(a="numeric", b="character"))') yield robjects.r('methods::removeClass("A")') def test_slotnames(set_class_A): ainstance = robjects.r('new("A", a=1, b="c")'...
58d71775afb05ac23b9f5c92c6376ac0a859e3975fb1f661e1baca0dc7b09f5d
Python
690
15
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
bbfba43b03ea9308c9fdef0292650dd573ecf419caf2eb8a87d2075c0a8e5d0f
Python
690
24
""" Simulate creating old GUIDs from new onew """ 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 def oldIncorrectGUID(GUID): ""...
66f261562ffe09167b284a29077614a54eaabf316c69ee912de4ecfa39c56458
Python
691
37
import numpy as np from sklearn.preprocessing import normalize np.set_printoptions(precision=3) np.set_printoptions(formatter={'float': '{: 0.3f}'.format}) data = np.array([ [100, 100], [300, 100], [200, 100]]); data2= np.array([ [ 10,8 ], [ -10,8 ], [ 10,8 ]]); norm_data=normalize(data,ax...
a9de86ca022907fb40d644c2561f6d7ac78567e9c0cefdc9d3584ca80f764c35
Python
691
36
import gc from neuron import h, gui def allocate_props(n_instances, mech_name): s = h.Section() s.nseg = 1 for _ in range(n_instances): getattr(h, mech_name)(s(0.5)) def assert_equal(actual, expected): assert actual == expected, f"{actual} != {expected}" def check_ctor(n_instances, mech_...
1a1ff9ced3aa54ea934c84365798eceaee52d729369f48110d63e7737d45bc76
Python
692
24
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging logger = logging.getLogger() def init_logger(log_file=None, log_file_level=logging.NOTSET): log_format = logging.Formatter("[%(asctime)s %(levelname)s] %(message)s") logger = logging.getLogger() logger.setLevel(logging.INFO) ...
38cc9a734b74a371e3f22a2186ca301fa9a50f9991bf724913ffb30e6df47c6d
Python
692
22
from ethoscope.tracking.roi_builders import TubeMonitorWithTargetROIBuilder import cv2 def draw_rois(im, all_rois): for roi in all_rois: x,y = roi.offset y += roi.rectangle[3]/2 x += roi.rectangle[2]/2 cv2.putText(im, str(roi.idx), (x,y), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (255,255...
45062e647b88cf1842e3acabc484e2173c7521a105397c2e8f45a6df12b0fdd2
Python
692
23
""" This module define a converter """ import torch from converter.generic_converter import GenericConverter from utils.utils import square_pad_sequence class ConverterInverseWeightToPred(GenericConverter): """ This class convert proba output to prediction """ def convert_output_and_target(self, outp...
4f71f6d732c19be1d4707ce45f0ae3a292fd1cc1dc12dd225008316d00b75e73
Python
692
29
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="SpliceaiAsDownstream", motif_model_spec=dict( type="PSAMMotifModel", motif_spec=dict(type="rbns"), exclude_names=("3P", "5P"), ), spliceai_spec=dict(t...
681fc52fe73d7a9b0498a05e62c35e228b6254ba61b9468765abe74cb80c7dd3
Python
692
21
from PIL import Image from lightly.transforms.simsiam_transform import SimSiamTransform, SimSiamViewTransform from .. import helpers def test_view_on_pil_image() -> None: single_view_transform = SimSiamViewTransform(input_size=32) sample = Image.new("RGB", (100, 100)) output = single_view_transform(samp...
ba05503314badf903dc0a3cdeb7ffaf57b1d9d2d366bac9d425798a5e2d372f2
Python
692
29
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="SpliceaiAsDownstream", motif_model_spec=dict( type="PSAMMotifModel", motif_spec=dict(type="rbns"), exclude_names=("3P", "5P"), ), spliceai_spec=dict(t...
dc36595571d08466f5b10e22d6862789c8cf95cff1738fc4a55b75c5e352574f
Python
692
24
import os from matplotlib import image import numpy as np import nibabel as nib import itk import pandas as pd import tarfile import shutil from scripts.preprocess_utils import find_file_in_path input_path = "data/pseudolabels_mris" # + for id_patient in os.listdir("data/registered/all_mris"): filepath = "data/re...
f51658d65c0bdb5044c90f85239fa4a4829b1202b54dd38142ef55c604771de4
Python
692
21
""" See how fast just the protocol can be read from ABF files """ 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 time demoAbf...
f692a153ec29e96fa9d7a9c8405cc8aa1149ada389490512628c6e55101761e5
Python
692
19
import numpy as np def perm_test_two_tailed( a, b ): nsamples = 10000 permutation_a_b = np.zeros( [np.size(a), 2] ) over_a_b = 1 delta_a_b = np.nanmean(a) - np.nanmean(b) if np.isnan(delta_a_b): p_value_a_b = 1 else: for k in range(nsamples): for i in range(0,np...
7911c42a9f03c82e7b20db7f36c529605263fafb469eaf3382086c9cc960afc4
Python
694
18
import os os.environ["CUDA_VISIBLE_DEVICES"] = "1" root = "/home/luke/PycharmProjects/NeuralPred" def build_dataset(dataset, ntau, nlat, nspan, scale, model, layer, n_pca): os.system(f"python fit.py --root={root} --dataset={dataset} --ntau={ntau} --nlat={nlat} --nspan={nspan} --scale={scale} --model={model} --la...
7a02455fc8b54fb1dffb23a4831d6da9e779bf4743aed79df2ebaf7578c867c0
Python
694
29
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="SpliceaiAsDownstream", motif_model_spec=dict( type="PSAMMotifModel", motif_spec=dict(type="rbns"), exclude_names=("3P", "5P"), ), spliceai_spec=dict(t...
93917e00517bc38939c5c32e3da84805dfec4214d898f9a67fa508aa6ed84bcc
Python
694
27
import pickle from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler import numpy as np all_features = [] for i in range(0,300000,10000): f_name = '../preprocessed_pickles/all_features_'+ str(i) with open(f_name, "rb") as f: temp = pickle.load(f) all_features.extend(temp...
9853ce251fd0076f37166f2079f3875fdbf97d2b2190b3b2ffe144672c624102
Python
694
33
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt from scipy.sparse import * from scipy.io import mmwrite nb_pre = 100 nb_post = nb_pre//4 sigma = 20.0 # Width of diagonal in channels mat = np.empty((nb_pre,nb_post)) x = np.arange(nb_pre) for i,c in enumerate(np.linspace(0,nb_pre,nb_post))...
f395f7468ce8ecff5e88b7565b569fe9d504fd27844a452ea58d30caf27f5b85
Python
694
29
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="SpliceaiAsDownstream", motif_model_spec=dict( type="PSAMMotifModel", motif_spec=dict(type="rbns"), exclude_names=("3P", "5P"), ), spliceai_spec=dict(t...
fbc7b17baa4d4e103bd4141506e30e4a29aae26ccc354946ffc9fec44c0ad08f
Python
694
29
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="SpliceaiAsDownstream", motif_model_spec=dict( type="PSAMMotifModel", motif_spec=dict(type="rbns"), exclude_names=("3P", "5P"), ), spliceai_spec=dict(t...
00859b73fdb590bab79cc5579fe9a8ed2c5d690dc245f4a3c173046a8291c424
Python
695
38
""" This file is a part of BdPy """ __all__ = ['add_bias'] import numpy as np def add_bias(x, axis=0): """ Add bias terms to x Parameters ---------- x : array_like Data matrix axis : 0 or 1, optional Axis in which bias terms are added (default: 0) Returns ------- ...
07c132eba2d0eb3462048673b4102c1d41c0fccabca2fedfa0b4310d13f3572b
Python
695
39
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """A range of utility functions for xcp_d interfaces and workflows.""" from xcp_d.utils import ( atlas, bids, boilerplate, concatenation, confounds, doc, execsummary, filema...
d5094a581065523d1c9050f961d073593b77da7e2238b50eb3fc9693f7add887
Python
695
18
from review_comparison.compute_metric import compute_metric from review_comparison.generate_all_predictions import generate_all_predictions from review_comparison.parse_and_create_the_different_dataset import ( create_the_different_dataset, ) import logging logging.getLogger().setLevel(logging.INFO) # Create the...
65e6381260619acec4138e8402fdf7fa5ac6c1996d3909fcbe48b6a8e8089ac3
Python
696
24
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( ...
7b3439d07e52e39d0faaa264ec5ae6ff43ff7be2391b2d5da944b989584acfd6
Python
696
18
import os os.environ["CUDA_VISIBLE_DEVICES"] = "1" root = "/home/luke/PycharmProjects/NeuralPred" def build_dataset(dataset, ntau, nlat, nspan, scale, model, layer, n_pca): os.system(f"python fit.py --root={root} --dataset={dataset} --ntau={ntau} --nlat={nlat} --nspan={nspan} --scale={scale} --model={model} --la...
88a8659e31cc26e2f9fb0ce044c93db37cf1a7b53ba55abe06a9da2349889d60
Python
696
29
from logging import getLogger import torchvision.datasets as datasets logger = getLogger() class MoCoDataset(datasets.ImageFolder): def __init__( self, data_path, tau_g, ): super(MoCoDataset, self).__init__(data_path) self.tau_g = tau_g # set of global transforms ...
4e76c218d70d7bdefe38614f8aa4d92da0da4000554bb06633c3e4fd4d9ebdf0
Python
697
25
import sqlite3 from .db import DB class ContactTestingInformation(DB): def __init__(self): super().__init__() self.table_name = 'TG_contact_testing' self.table_desc = 'Telangana primary and secondary contact testing' self.cols = self.getcolumns() def getcolumns(self): ...
6bd3a731e37e1f6933cd3b50ae8a7f5525980df43e0d502d58cba659e51a5626
Python
697
24
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 146 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
a11e4114b53f353cd1f777a3299bf7c6384033b0be33b2d0eb00a8ecc473a5eb
Python
697
24
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 146 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
a7bd7a4d18afb4052a349296228fd06294ff1ec33779b04e42fcccd098f569ad
Python
697
27
import unittest import hydra import pytest from hydra.experimental import compose try: from hydra import initialize except ImportError: from hydra.experimental import initialize from lightly.cli.version_cli import version_cli class TestCLIVersion(unittest.TestCase): def setUp(self): with initia...
0bc5be48cc6c743cdac975bdc2253e0f4ad7e4cfe7393c2f973c40d8054d785d
Python
698
25
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=dict(t...
3364327efa77be67809852a16788c381779b519abe21ad1ffad9bf43f6825913
Python
698
38
import io import os from setuptools import setup, find_packages def read( fname, ): with io.open( os.path.join( os.path.dirname(__file__), fname, ), encoding="utf-8", ) as f: return f.read() setup( name="XASNet-XAI", packages=find_packages("s...
5dc83781efd45154341379efa7962f4e274b037024fe4a59f2d6f8f998a81383
Python
698
24
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( ...
cdcffa1b726166f2ab14b24093650948e1d9c0deec1a88c2f1b5d309b99a531e
Python
698
23
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """tests for neighbor sampler""" import unittest from sknetwork.data.test_graphs import test_graph from sknetwork.gnn.neighbor_sampler import * from sknetwork.utils import get_degrees class TestNeighSampler(unittest.TestCase): def setUp(self) -> None: """T...
d29412652597dac81a9fb456e9c97ec125baff7119e057d0c95e92b0a912b967
Python
698
24
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._colorbar import ColorBar from ._hoverlabel import Hoverlabel from ._legendgrouptitle import Legendgrouptitle from ._textfont import Textfont from . import colorbar from . import hoverlabel from . import legendgrouptitle el...
d3db0e327b68f973de77c90a0605706720b9a0f702ab7c86ea6661ac3679c827
Python
698
36
project = "minimal-basis" copyright = "2023, Sudarshan Vijay" author = "Sudarshan Vijay" release = "0.0.1" import os import sys sys.path.insert(0, os.path.abspath(os.path.join("..", "..", "src"))) extensions = ["myst_parser", "sphinx.ext.autodoc", "sphinx.ext.autosummary"] myst_enable_extensions = [ "amsmath", ...
5bb7b05487a5d20e39e5890684af778a780fca7c0bd05134d535cba2f202289f
Python
699
24
""" This module define a converter """ import logging import torch from converter.generic_converter import GenericConverter from utils.utils import square_pad_sequence class ConverterProbaToPred(GenericConverter): """ This class convert proba output to prediction """ def convert_output_and_target(sel...
77d0687d446e35c0102493f3b0f9ec0c4075707d4bd63e3e3503d4b4339ca192
Python
699
30
"""Add public tag to project Revision ID: f3a10c95079f Revises: 9d5ff5377b63 Create Date: 2025-01-14 22:01:12.694786 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "f3a10c95079f" down_revision = "54d9cae546ad" branch_labels = None depends_on = None def upgra...
b43bdb31ef30aabfddaf94d7884c31ac0c92a6f11b649769f74f5c9db34e4799
Python
699
24
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 146 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
c6fca231fe31f35542424f4fbe7ce698134fbf08db0259abf830c60d3121c3cf
Python
699
27
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["num_motifs"] = 82 msp.arch...
f5017bd6de083140d91f5247845cd9c37dd0b28f17f6b3b9538cdcefab3876ef
Python
699
25
# Set default logging handler to avoid "No handler found" warnings. import logging import os import subprocess try: # Python 2.7+ from logging import NullHandler except ImportError: class NullHandler(logging.Handler): def emit(self, record): pass current_path = os.getcwd() try: GIT_V...
058baef796d49e5de517aef6e305b06dad454248f860d9bc9487a038a221dc3b
Python
700
27
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["num_motifs"] = 146 msp.arc...
3d31cbcb5b1b6eb9eade7abe9d379920385fb8650cc9d8bcedb63fa85aee8a69
Python
700
16
from keras.src.backend.tensorflow import distribution_lib from keras.src.backend.tensorflow import ops from keras.src.backend.tensorflow import random from keras.src.backend.tensorflow import rnn from keras.src.backend.tensorflow import tensorboard from keras.src.backend.tensorflow.ops.core import Variable from keras.s...
937e1890c4405a7c358e04649df3e648a32c394c10dbcb9c858bd613f94ca657
Python
700
24
import time from ethoscope.hardware.interfaces.interfaces import BaseInterface from ethoscope.stimulators.odour_stimulators import DynamicOdourSleepDepriver from ethoscope.tests.integration_api_tests.old.utils import test_stimulator class MockSDInterface(BaseInterface): def send(self, channel, stimulus_duration)...
cdc775fac5e790fdc31cce7ad9073dcda3aac7e7aa69dab5ab36cea1277b4161
Python
700
22
import numpy as np def gabor(t, s, t0, f0, phase=0.0, segment_length_s=20.0): """ Generates values for Gabor atom with unit amplitude. t0 - global, t - also global, """ t_segment = t % segment_length_s t0_segment = t0 % segment_length_s result = np.exp(-np.pi*((t_segment-t0_segment)/s)**2)...
10b0a5e41a4a4453ccd62e064e0f02b3c7a78bb7b33393a0504be767016d770c
Python
701
21
#!/usr/bin/env python3 import sys import subprocess import os ##Script to estimate the illumina coverage before running hypo. ##Author: Jèssica Gómez Garrido ##email: jessica.gomez@cnag.crg.eu fasta = sys.argv[1] bam = sys.argv[2] dir=os.path.dirname(os.path.realpath(__file__)) glen_out = subprocess.check_output(di...
4a9fc478af99744fb19c4dc7d7adef485dc152f2a43ece12cab1893fd20a19ee
Python
701
15
import unittest from modular_splicing.motif_perturbations.summarize_effect import avg_blur, radial_sum class TestSum(unittest.TestCase): def test_sum_basic(self): self.assertEqual(radial_sum([1, 2, 3, 4, 5], 0).tolist(), [1, 2, 3, 4, 5]) self.assertEqual(radial_sum([1, 2, 3, 4, 5], 1).tolist(), [...
5d5d1e947b91b66008daeaa3bd4769b3bb984018dc50184a64c1d07a7a07f449
Python
701
25
import sqlite3 from .db import DB class VaxInfoTable(DB): def __init__(self): self.table_name = 'WB_vaccination' self.table_desc = 'West Bengal vaccination information' self.cols = self.getcolumns() def getcolumns(self): cols = { 'date': 'DATE NOT NULL PRIMARY KEY...
9460f7416a043d2b9f0454a38e3d430fb24c13295d9e896593c5b5cf32f97b85
Python
701
17
# 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...
b54f66042d837c9c7133b46b6eaff36dfb897b1f71f894958c1913c5caae909d
Python
701
26
from .adds.add_deconvolution import add_deconvolution from .adds.add_loupe_clusters import add_loupe_clusters from .adds.add_mask import add_mask, apply_mask from .adds.annotation import annotation from .adds.image import image from .adds.labels import labels from .adds.lr import lr from .adds.parsing import parsing fr...
1f8a5318fe1b9fd08f7ec5c00810348bf0c60cb835dc4e7292234d60c94b2b8c
Python
702
27
#/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup requirements = [ ] setup( name="encoding", version="0.1.0", description="Code for fitting fMRI encoding", author="Amanda LeBel", author_email="amanda_lebel@berkeley.edu", packages=[ 'encoding', ], package_d...
2570c504c0436015121823202b53867ed78ed0ab13e3e982184506d5b96c4760
Python
702
23
import numpy as np import pytest import gym from gym import spaces from gym.wrappers import FlattenObservation @pytest.mark.parametrize("env_id", ["Blackjack-v1"]) def test_flatten_observation(env_id): env = gym.make(env_id, disable_env_checker=True) wrapped_env = FlattenObservation(env) obs, info = env...
3c7284905309e2d1cf30610a6706a4fdaaab7d81dcd30271a1ff54ade66da269
Python
702
16
from bioconfpred.model import ComENetModel from bioconfpred.ranker import ModelRanker from bioconfpred.params import COMENET_CONFIG from rdkit import Chem from rdkit.Chem.rdDistGeom import EmbedMultipleConfs config = COMENET_CONFIG config['data_split'] = None checkpoint_path = "/home/bb596/hdd/conf_ranking/data/lightni...
30eb429d9af0f8bef47750fcec60c0f5391ccbac30c919d8f74ea8b496dee315
Python
703
18
""" Normalizing flow models for PyTorch. All the layers defined in this module are invertible and implement an ``inverse()`` method (not to be comfused with the ``Tensor``'s ``backward()`` method which backpropagate the gradients). The forward propagation of the modules here return both the transformation of the inpu...
8cf2c928960496d169636b9cb74272244903d6168ec8d53c87fd4ac222cc8193
Python
703
26
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """tests for postprocessing""" import unittest import numpy as np from sknetwork.ranking.postprocess import top_k class TestPostprocessing(unittest.TestCase): def test_top_k(self): scores = np.arange(10) index = top_k(scores, 3) self.asser...
8f9a88b4f2c4426d9479ec782201fe5ff39551ce29162beddd789f4d46621811
Python
703
30
# %% import sys import argparse import random # %% def main(): parser = argparse.ArgumentParser() parser.add_argument('beds', nargs='+') parser.add_argument('-n', type=int) args = parser.parse_args() if args.n < 1: exit(1) lines = [] for bed in args.beds: with open...
a0fc4fe475186973d8663f1712f723b10841e73410846e196c0f274dd43fb804
Python
703
34
__author__ = 'quentin' from ethoscope_node.utils.helpers import generate_new_device_map from ethoscope_node.utils.mysql_backup import MySQLdbToSQlite, DBNotReadyError import logging import optparse import time import multiprocessing import traceback import os import subprocess import re db_credentials = { "n...
25a96c750043cf22f961d76e1bc6e012c9e068b5c4543f2d55b2657c985a98f6
Python
704
19
# flake8: noqa: F401 import pyqtgraph as pg from . import mask from . import shapes def pg_roi_to_impose_shape(roi, tr, point_um): """Convenience method for converting a pyqtgraph ROI to an impose shape""" if isinstance(roi, pg.CircleROI): return shapes.Circle.from_pg_roi(roi, tr, point_um) elif ...
1868ee23f78c0ac3a97ac058166a6599fcda84a670394c88343c96cd8798e2a4
Python
705
30
from abc import ABC, abstractmethod class PostProcessor(ABC): @abstractmethod def post_process(self, element): """ Post process the element, producing a sequence of elements """ pass class FlattenerPostProcessor(PostProcessor): def __init__(self, *, indices): self...
1d5734d62188f3e83812cb9cea1e6123ffc97a564b5fd6442a62ec996b0c304b
Python
705
20
from __future__ import annotations def detect_quorum_queues(app, driver_type: str) -> tuple[bool, str]: """Detect if any of the queues are quorum queues. Returns: tuple[bool, str]: A tuple containing a boolean indicating if any of the queues are quorum queues and the name of the first quorum ...
ecc60d1c6ee00aac6fe6285b50146e13225c86fa3c57bd2a046b157bb6117984
Python
706
30
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=6), ) msp.data_dir = "../data/canonical_and_gtex_dataset/" ...
478704c9a00f76d6f3fd9580f9afcf493a36f134ecaf478d0fe108766c8a7cb8
Python
707
22
import tqdm.auto as tqdm import numpy as np def mcmc_step(state, current_score, rng, *, report, temperature=1, **kwargs): mutation = state.sample_mutation(rng, **kwargs) state.perform(mutation) new_score = state.score() log_ratio = temperature * (new_score - current_score) if np.log(rng.rand()) < ...
a1fb7d07883b498b942181a44d5b4213514f53dc32ecab346a37801ed2596220
Python
707
27
""" This module define a """ # pylint: disable=W0223 import torch import logging from utils.utils import select_output_lm import torch class SquaredSumLossJustExpWeights( torch.nn.modules.loss._Loss ): # pylint: disable=protected-access """ This class define a specific loss : """ def __init__(s...
a4cf1ea17ea9037df36254296411771431de841f771dbfabf2b5628fee6ed3be
Python
707
24
import sys import logging class LoggerWriter(object): def __init__(self, writer): self._writer = writer self._msg = '' def write(self, message): self._msg = self._msg + message while '\n' in self._msg: pos = self._msg.find('\n') self._writer(self._msg[:p...
04127a031f4f11ff8980a4676e7e0e7c4aa8326739da70603e40c38f7246db34
Python
708
24
import numpy as np import math import pdb # ------------------------------------------------------ # Set default radius to 0.5 def set_default_radius(swc_matrix): updated_swc_matrix = swc_matrix if (swc_matrix.loc[:, "Radius"].isnull().values.any()): updated_swc_matrix["Radius"] = updated_swc_matri...
251992b90100d95e4023f151a65eb56cd56db9642352499ea0ac2b07ff84bfed
Python
708
22
from time import sleep from celery import shared_task from t.integration.tasks import LEGACY_TASKS_DISABLED @shared_task def waitfor(seconds: int) -> None: print(f"Waiting for {seconds} seconds...") for i in range(seconds): sleep(1) print(f"{i+1} seconds passed") print("Done waiting") i...
bb36b2d2104f6e6f5f73fabfe50002f99167d01e03dd04e1591d48fee16d69c3
Python
708
19
import numpy as np import torch import opt_einsum as oe from torch.autograd.functional import jacobian from src.MODEL import * #============================calculate the energy=================================== class Property(torch.nn.Module): def __init__(self,density,nnmod): super(Property,self).__init_...
9f7c440e268ed2bd78d8ce4704a7c7a82213c5e122d7048458f0e582b09e9f17
Python
709
16
# Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved. # # 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://creativecommo...
a42b25505c3f994b13ea2ba251dd3bad3618a73b65db698d1ab88c1f08c9d572
Python
709
23
from sys import argv from msp import MSP, amm_mean40v1 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...
ffc7a780bdccf606861241baf70267cc9f5d1ccd7b941b1308bbcaa8db18dfc8
Python
709
15
# Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved. # # 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://creativecommo...
c69d687aa02b522494364d26f4cd2ac2ebd4e51abc0b1f62db2bf0d20265784d
Python
710
30
import numpy as np from neurogym.core import TrialEnv from neurogym.utils import spaces class Null(TrialEnv): """Null task.""" def __init__(self, dt=100) -> None: super().__init__(dt=dt) self.action_space = spaces.Discrete(1) self.observation_space = spaces.Box( -np.inf, ...
02904cb99efd2237b91536485b742f052fd9d83713400019a39b80853be75a92
Python
711
36
from mongoengine import * import datetime import time class Event(EmbeddedDocument): name = StringField() created_at = DateTimeField() meta = {'allow_inheritance': True} def now(self, event): self.created_at = datetime.datetime.now() class SessionEvent(Event): user = StringField...
95c99370ddea64d44d49861f3cf26e0483f5b5f6ff5d33833cccf25cbda3a00d
Python
711
21
from PIL import Image from lightly.transforms.swav_transform import SwaVTransform, SwaVViewTransform from .. import helpers def test_view_on_pil_image() -> None: single_view_transform = SwaVViewTransform() sample = Image.new("RGB", (100, 100)) output = single_view_transform(sample) assert output.sha...
2749a17454a9aa8a610a2213d739046488af06fe742da1c06802d00ab28a3bf8
Python
712
30
import flask def test_aborting(app): class Foo(Exception): whatever = 42 @app.errorhandler(Foo) def handle_foo(e): return str(e.whatever) @app.route("/") def index(): raise flask.abort(flask.redirect(flask.url_for("test"))) @app.route("/test") def test(): ...
9ca6075bcadabbf31f8aae1f40a41532c8f760814c54a9f23230c25b5a859b4a
Python
712
31
"""add index workflow_request_step_states__workflow_invocation_id Revision ID: 3a2914d703ca Revises: c39f1de47a04 Create Date: 2023-03-07 15:06:55.682273 """ from galaxy.model.database_object_names import build_index_name from galaxy.model.migrations.util import ( create_index, drop_index, ) # revision iden...
6ea29a79dd7b2d04784b5342942e573ca823b2f927fe2d8b70b4fdedf62866de
Python
713
27
# -*- coding: utf-8 -*- """ Created on Thu Mar 2 10:25:14 2023 @author: fede_ """ import pickle import matplotlib.pyplot as plt # define full path to the results of the permutations test results = '/path_to_output_directory/permutations.pkl' # define full path where to save the image image = 'path_to_output_director...
7bb501084b1640ce30f620a13e9f5b7d49b72a31396ea69f1954d7e124d7ce7c
Python
713
29
#!/usr/bin/env python """Convert GlimmerHMM gene predictions into protein sequences. This works with both the GFF and the costumn Tabular Output. And is only a wrapper to call the appropiate scripts. Usage: glimmerhmm_to_sequence.py <glimmer output> <ref fasta> <output file> <format> <protein> """ import sys im...
bde721f36012475ad8f28d241ca2c66cba84c74904473992892bf597887dc09f
Python
713
21
from pl_bolts.models.rl.advantage_actor_critic_model import AdvantageActorCritic from pl_bolts.models.rl.double_dqn_model import DoubleDQN from pl_bolts.models.rl.dqn_model import DQN from pl_bolts.models.rl.dueling_dqn_model import DuelingDQN from pl_bolts.models.rl.noisy_dqn_model import NoisyDQN from pl_bolts.models...
06328de19a9782fc284691a7bb66948c6d41c01f673e727c1828182e9349433c
Python
714
15
# Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved. # # 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://creativecommo...
a1429251698f6fa1c9fc3b3effd50e43ad154f6cd9464af3584ba68888062ce0
Python
714
23
""" Code here makes it easy to glance at a header item from every demo ABF file. """ from imports import * if __name__=="__main__": for fname in sorted(glob.glob(PATH_DATA+"/*.abf")): abf = pyabf.ABF(fname) if abf.abfFileFormat==1: print(abf.abfID, abf._headerV1.nTelegraphEnable) ...
c1a5b39ea0fac792372228ce49acff413981923c5436529c7cb19508d8442ffe
Python
714
23
#!/usr/bin/env python """ Wrapper and analysis for simulations ran with PLUMED. """ # ============================================================================= # UTILITY FUNCTIONS # ============================================================================= def check_plumed_is_installed(): """Check that th...
26d593435b6d5b49e9da91cbd711183cf0f2e2f0f1b1228b90a6589ef88d9e7e
Python
715
17
""" Gathers all splitters in one place for convenient imports """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals # TODO(rbharath): Get rid of * import # from deepchem.splits.splitters import * # from deepchem.splits.splitters import ScaffoldSplitter # from...
9587250fab4b787aa3e48b86e75c4a5e85683a96f13d96ed58cf5659cd600577
Python
715
24
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( ...
2931d3861c1de27f1e34fa9490b9af87f4eb0c25e10ca79c4cb3ef6043d31409
Python
716
34
"""add display_name column to galaxy_user Revision ID: 64d49ad328d4 Revises: a4c3f2e1b790 Create Date: 2026-08-13 10:00:00.000000 """ from sqlalchemy import Column from galaxy.model.custom_types import TrimmedString from galaxy.model.migrations.util import ( add_column, drop_column, ) # revision identifier...
5564c4306c2232503819125d0c49845ad64c282042f34b9c4d26bc7cfa9d00ab
Python
716
25
""" This module define a CrossEntropyPerToken """ # pylint: disable=W0223 import torch import logging from utils.utils import select_output_lm class CrossEntropyPerProtWeighted( torch.nn.modules.loss._Loss ): # pylint: disable=protected-access """ This class define a specific loss : crossentropy loss for...
5e81939b250dbb055a002ba32e3bec3bd27d16122eacdce7fb9a83ec6e871372
Python
716
27
# Generated by Django 2.2.2 on 2019-06-12 17:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('biomedisa_app', '0042_upload_shift_size'), ] operations = [ migrations.RemoveField( model_name='upload', name='shift...
c78861e14ffd122de3a2b6d061d48852079abb0ed660baccd24b4c0f2f2e6e22
Python
716
25
import os import numpy as np from PIL import Image abs = np.load('abs_trainSR.npy') angle = np.load('angle_trainSR.npy') save_path = 'train_cat_tif' if os.path.exists(save_path): print('save path existed') else: os.makedirs(save_path) def transform_val(array): array = 255 * (array - np....
da6f82591613613805ff54f193b66dad0d1f97f275651caf85098c3ec6358a1a
Python
716
29
import pytest import rpy2.rlike.functional as rlf def test_tapply_sumbystring(): seq = ( 1, 2, 3, 4, 5, 6) tags = ('a', 'b', 'a', 'c', 'b', 'a') expected = {'a': 1+3+6, 'b': 2+5, 'c': 4} with pytest.deprecated_call(): res = rlf.tapply(seq, tags, sum)...
8aed1716e8fcc634af0b955ef2c33ce31d77bd030676e607b8bc6f4fd831586e
Python
717
23
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["motif_model_spec"]["motif_width"] = 9 msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict( type="FCMotifFeatureExtractor", extra_compute=10, num_compute_layers=1 ) msp.architec...
5d1e1ab015a28075ab486cfa10d8a4501ada75de9f66850e418f1ead112c85c8
Python
718
22
""" Main entry point of the bioseq2seq library """ from __future__ import division, print_function import bioseq2seq.inputters import bioseq2seq.encoders import bioseq2seq.decoders import bioseq2seq.models import bioseq2seq.utils import bioseq2seq.modules import bioseq2seq.bin from bioseq2seq.trainer import Trainer im...
473cba46b7a47462e67bafa269a5b8a4d056b1ba87bfc4ed29b543e26da81228
Python
719
19
import unittest import numpy as np from carbontracker import predictor class TestPredictor(unittest.TestCase): def test_predict_energy(self): total_epochs = 10 epoch_energy_usages = np.array([10, 20, 30, 40, 50]) expected_result = total_epochs * np.mean(epoch_energy_usages) result =...
b4b17e8cbb1f336385a9bc951cad68f635d55bfd4f6d390c7319005ee1a330ef
Python
720
24
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for hierarchy API""" import unittest from sknetwork.data.test_graphs import * from sknetwork.hierarchy import * class TestHierarchyAPI(unittest.TestCase): def test_undirected(self): adjacency = test_graph() n = adjacency.shape[0] f...
697581f4feed5a25a9bb57974b5113cbf2f390ca153085e79ef2e2933fb02c3b
Python
721
21
from PIL import Image from lightly.transforms.smog_transform import SMoGTransform, SmoGViewTransform from .. import helpers def test_view_on_pil_image() -> None: single_view_transform = SmoGViewTransform(crop_size=32) sample = Image.new("RGB", (100, 100)) output = single_view_transform(sample) asser...