sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4ba952e1bb67aa96071dd2b122b4ff4150de2e4743e881732d8ac25c50bb6281
Python
308
12
#!/usr/bin/env python """ # Author: Kangning Dong # File Name: __init__.py # Description: """ __author__ = "Kangning Dong" __email__ = "dongkangning16@mails.ucas.ac.cn" from .Train_STAGATE import train_STAGATE from .utils import Cal_Spatial_Net, Stats_Spatial_Net, mclust_R, Cal_Spatial_Net_3D
5e0c8d21b16ae7ae8b19f5ca1ef381ddd32aeeb552f1c9f1caf9f21c3733ede5
Python
308
10
import F02 class F05(F02.F02): def get_map(self, img, img_f04, eroded_roi): return super(F05, self).get_map(img, img_f04, eroded_roi) def get_map_float32(self, img, img_f04, eroded_roi, normalize=True): return super(F05, self).get_map_float32(img, img_f04, eroded_roi, normalize)
5e8798a3ebdf9ddcb1e72f0b6257b3863d405f05774e7363e55645ce76beaf64
Python
308
9
try: import importlib.resources as pkg_resources except ImportError: import importlib_resources as pkg_resources def datafile(filename): """Obtain the complete path to the installed file in the src/spitfire/data directory.""" return str(pkg_resources.files('spitfire.data').joinpath(filename))
8333d990747d02e48b84f8a459899fc92160911f10ed3cb6b4a55c1c7a22f83f
Python
308
10
import F03 class F06(F03.F03): def get_map(self, img, img_f04, eroded_roi): return super(F06, self).get_map(img, img_f04, eroded_roi) def get_map_float32(self, img, img_f04, eroded_roi, normalize=True): return super(F06, self).get_map_float32(img, img_f04, eroded_roi, normalize)
b821bab80c1bc91d931ef115e8ccc30d0501b41c1c6943afe92ec52f61c5b210
Python
309
12
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["sparse_spec"] = dict( type="SpatiallySparseAcrossChannelsDropMotifs", sparse_drop_motif_frequency=0.87, ) msp.extra_params += " --learned-motif-sparsity-threshold-initial 90" msp.run()
4d705533d953c9c94608d552be384391946563388a3cba7f14f5c1734d7106d4
Python
310
8
"""Spatiotemporal modeling of spatial transcriptomics """ from .borderline import get_borderline, grid_borderline from .boundary_old import * from .contour import extract_cluster_contours, gen_cluster_image, set_domains from .grid import digitize, gridit from .utils import digitize_general, order_borderline
4fbda400fd6483799efed12edb3d50fde4521e00df4aaf0d8c64395348c7d05c
Python
310
9
from tensorflow.python.client import device_lib def get_available_gpus(config): r""" Returns the number of GPUs available on this system. """ local_device_protos = device_lib.list_local_devices(session_config=config) return [x.name for x in local_device_protos if x.device_type == 'GPU']
6237f9e8f75e8fec12eec2d0c571ed673b18ccf50471a1c2c021462ec1083460
Python
310
7
from keras.src.ops import image from keras.src.ops import operation_utils from keras.src.ops.core import * # noqa: F403 from keras.src.ops.linalg import * # noqa: F403 from keras.src.ops.math import * # noqa: F403 from keras.src.ops.nn import * # noqa: F403 from keras.src.ops.numpy import * # noqa: F403
5a4b12652a65ce26c57a776febafc8cadba265ef69fac29b316bc75e48a51f68
Python
312
11
# membrane noise from brian2 import mV, ms from pypet import cartesian_product input_dict = {'ext_drive': [1.], 'sigma_noise': [5.0]*mV, 'dt': [0.1]*ms} name = 'hdf5_data' # explore_dict = n_list(input_dict) # check later if I need that explore_dict = cartesian_product(input_dict)
6fed0233545eb0ba095e0ebe8c69815858a2e49b59ad70217d88801bbd1d5b5c
Python
312
14
# -*- coding: utf-8 -*- """tests for dataset""" import unittest from sknetwork.data.base import Dataset class TestDataset(unittest.TestCase): def test(self): dataset = Dataset(name='dataset') self.assertEqual(dataset.name, 'dataset') self.assertEqual(dataset['name'], 'dataset')
7d4efc01db77bb6ff4b5e38494d06bc6263d1432aae35d7fc12edb737b542920
Python
312
9
# pylint: disable=wildcard-import """Faster-RCNN Object Detection.""" from __future__ import absolute_import from .faster_rcnn import * from .doublehead_rcnn import * from .predefined_models import * from .rcnn_target import RCNNTargetGenerator, RCNNTargetSampler from .data_parallel import ForwardBackwardTask
cdbd2342a58dfa7d31e60b7d1b7b4f6ae47097ed75c9a26ba289992c91d54add
Python
312
14
import os import sys sys.path.insert(0, os.getcwd()) # ## Start worker with -P eventlet # Never use the worker_pool setting as that'll patch # the worker too late. broker_url = 'amqp://guest:guest@localhost:5672//' worker_disable_rate_limits = True result_expires = 30 * 60 imports = ('tasks', 'webcrawler')
505d065edc44d6991d42d020ccf9dce58f58c369ef1545102084b311cb95531c
Python
313
8
from social_core.backends.auth0_openidconnect import Auth0OpenIdConnectAuth from galaxy.authnz.oidc import GalaxyOpenIdConnect class GalaxyAuth0OpenIdConnect(GalaxyOpenIdConnect, Auth0OpenIdConnectAuth): name = "auth0" EXTRA_DATA = ["id_token", "refresh_token", ("sub", "id"), "picture", "expires_in"]
7a18b9a2734f41c1424991d09e312023e35df887bd8774e797aa32896c65dc84
Python
313
10
#!/usr/bin/env python # ============================================================================= # PACKAGE DOCSTRING # ============================================================================= """PyTorch-compatible potential energy functions.""" __all__ = ['base', 'ase', 'openmm', 'psi4', 'tblite']
7befb964011c7569d4dd896fad7c62e2b8539003a4f3abb958fca50c1ad33fff
Python
314
10
try: import importlib.metadata as importlib_metadata except ModuleNotFoundError: import importlib_metadata package_name = "seqdatasets" __version__ = importlib_metadata.version(package_name) from ._datasets import get_dataset_info, random1000 from ._datasets import jores21, ray13, deBoer20, deAlmeida22
924a4aeacf9a994bcde48b8c0ee49518d08986f0def28a79d54c21e1e32f97a9
Python
315
8
"""Custom evaluation metrics""" from __future__ import absolute_import from .coco_detection import COCODetectionMetric from .coco_keypoints import COCOKeyPointsMetric from .voc_detection import VOCMApMetric, VOC07MApMetric from .segmentation import SegmentationMetric from .heatmap_accuracy import HeatmapAccuracy
c26d4b77f46020968b19bcdc10349e99f60db06c2c4138b19a1aad8905d74753
Python
315
13
from mirp._data_import.generic_file import ImageFile class BaseWorkflow: def __init__( self, image_file: ImageFile, write_dir: None | str = None, **kwargs ): super().__init__() self.image_file = image_file self.write_dir = write_dir
06e6f12406bee272ec718b40afab797959d27dd824e382828a189c798c5e0610
Python
316
13
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et """Nipype workflows for xcp_d.""" from xcp_d.workflows import anatomical, base, bold, parcellation, plotting __all__ = [ 'anatomical', 'base', 'bold', 'parcellation', 'plotting', ]
416b7468d16addd483512b729910ef121e45f8f25467520ecd3e90b26051893a
Python
316
16
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="PreprocessedSpliceAI", preprocessor_spec=dict(type="Identity"), spliceai_spec=dict(type="SpliceAIModule", output_size=3), ) msp.n_epochs = 10 msp.acc_thresh = 100 msp.run()
43af982cfa78c24885cde1048f2a2c762449325d6b03d83a8c7166909f0407f0
Python
317
16
import time import logging def profile(func): def wrap(*args, **kwargs): started_at = time.time() result = func(*args, **kwargs) diff = time.time() - started_at if isinstance(result, dict): result['time_ms'] = int(diff * 1000) return result return wrap
5a273776dc4e899710bc9100f2956a8b1ea652de15e619adf059c89448f7b9fb
Python
318
15
import os.path as osp from setuptools import find_packages, setup requirements = ["pytorch-lightning==1.6.0"] exec(open(osp.join("pointnet2", "_version.py")).read()) setup( name="pointnet2", version=__version__, author="Erik Wijmans", packages=find_packages(), install_requires=requirements, )
5fdd85c1c5b90d3b3e873e08a0bed7ce6b845e2f51cb681525dacce71469dd81
Python
318
16
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="PreprocessedSpliceAI", preprocessor_spec=dict(type="Identity"), spliceai_spec=dict(type="SpliceAIModule", output_size=3), ) msp.window = 10_000 msp.acc_thresh = 100 msp.run()
ca8edf5849571bc30fe2e271b22dafdd3b663b4bf2eab85347254ae9dd5aca01
Python
318
18
from ethoscope.hardware.interfaces.odour_delivery_device import OdourDelivererInterface o = OdourDelivererInterface("/dev/ttyUSB1") import time i = 1 while True: time.sleep(1) print(i) i += 1 if i == 15: o.interact(channel=1, pos=1) elif i == 17: o.interact(channel=1, pos=2)
f74802a3564b7c433352ad03a3ec9ad5fe7fbda7452b2eeda7df4e81b63b0dde
Python
318
12
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._marker import Marker from ._textfont import Textfont else: from _plotly_utils.importers import relative_import __all__, __getattr__, __dir__ = relative_import( __name__, [], ["._marker.Marker", "._textfont.Textfont"] )
578b7a1a08bf7e1f29c7922aec20cb949bdb5dfcf6e2669c438dd2b34b4f6f92
Python
319
15
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """tests for verbose.py""" import unittest from sknetwork.log import Log class TestVerbose(unittest.TestCase): def test_prints(self): logger = Log(verbose=True) logger.print_log('Hello', 42) self.assertEqual(str(logger.log), 'Hello 42\n')
a3f3ee2bff148316722359794e16d7e5bd88fbaa476e5e703213a624fde6e9da
Python
319
17
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="PreprocessedSpliceAI", preprocessor_spec=dict(type="Identity"), spliceai_spec=dict(type="SpliceAIModule", output_size=3), ) msp.acc_thresh = 100 msp.window = 10_000 msp.run()
f0fab46af6e4c89b81b8ed8f66722ac569f18dcc7cf3283af340df2493faf0d5
Python
319
8
import numpy as np import imodelsx.augtree.llm from os.path import join, dirname, abspath path_to_repo = dirname(dirname(abspath(__file__))) if __name__ == '__main__': # should print 'cached!' out = imodelsx.augtree.llm.expand_keyword('bad', cache_dir=join(path_to_repo, 'results', 'gpt3_cache'), verbose=True)
3745314bb5acf38efe7ec09a971575e82328051e530b80d20142f6192610fd2d
Python
320
14
import requests from celery import shared_task @shared_task() def urlopen(url): print(f"-open: {url}") try: response = requests.get(url, timeout=10.0) except requests.exceptions.RequestException as exc: print(f"-url {url} gave error: {exc!r}") return return len(response.text)
3999cffc4157d2987aa9dee1a91eabc04cfabf07d0e92e3dc5b05be1149902cf
Python
320
15
""" TNS Author: Lida Kanari Ecole Polytechnique Federale de Lausanne Blue Brain Project (c) 2017-2019. All rights reserved. """ from tns.utils import TNSError from tns.generate.grower import NeuronGrower from tns.astrocyte.grower import AstrocyteGrower from tns.version import VERSION as version
12d154ba61a15aedaaaea5755d565f550deaeeec882fd8eb745ee1c7d38b4dfc
Python
321
9
from os.path import dirname, basename, isfile, join import glob modules = glob.glob(join(dirname(__file__), "*.py")) __all__ = [ basename(f)[:-3] for f in modules if isfile(f) and not f.endswith('__init__.py')] for pkg in __all__: exec('from . import ' + pkg) del dirname, basename, isfile, join, glob, modules, pk...
7638a06ed4cdde8e79b9dfb30edba050b06a3044450395acc68138d1f5d1ca34
Python
322
8
"""Module defining decoders.""" from bioseq2seq.decoders.decoder import DecoderBase from bioseq2seq.decoders.transformer import TransformerDecoder from bioseq2seq.decoders.cnn_decoder import CNNDecoder str2dec = {"transformer": TransformerDecoder} __all__ = ["DecoderBase", "TransformerDecoder", "CNNDecoder","str2dec"...
bb72aabdc3abc2da09fdd4a9b8594ec4aeb6416e585b4f8b284e2811887be3ed
Python
322
13
import gzip import tempfile import requests def read_gzip(url): out = requests.get(url) with tempfile.NamedTemporaryFile(suffix=".gz") as temp: with open(temp.name, "wb") as f: f.write(out.content) with gzip.open(temp.name, "rb") as f: result = f.read() return resul...
c74c16a34701ab5708cfa3e8cce6447eec73a0c63f161e421fc0fcac220fbb0e
Python
322
17
# ruff: noqa: F401 from ._base_renderers import ( MimetypeRenderer, PlotlyRenderer, JsonRenderer, ImageRenderer, PngRenderer, SvgRenderer, PdfRenderer, JpegRenderer, HtmlRenderer, ColabRenderer, KaggleRenderer, NotebookRenderer, ExternalRenderer, BrowserRenderer, ...
d786fc099a2da205b56e8f97732b55cc8587215a3cb51061ed6d1b8aa884fa1c
Python
322
14
from ._fit import fit, fit_sequence_module try: from ._hyperopt import hyperopt RAY_AVAILABLE = True except ImportError: RAY_AVAILABLE = False def no_ray(): raise ImportError( "Install ray to use functionality EUGENe's hyperopt functionality." ) hyperopt = no_ray ...
d833a160e766e60c66ff1d6dfe1df9b18b1a9ce8fab552bf794a1b984f902ac2
Python
323
18
""" This module implement the generic class for the converter """ from abc import abstractmethod class GenericConverter: """ This class define what is a converter """ @abstractmethod def convert_output_and_target( self, output, target, ): raise NotImplementedEr...
1d00a9d24fe77e16b72c87b569433639955cfd27d8d51a1621f87138fb525da9
Python
324
5
from gym.envs.classic_control.acrobot import AcrobotEnv from gym.envs.classic_control.cartpole import CartPoleEnv from gym.envs.classic_control.continuous_mountain_car import Continuous_MountainCarEnv from gym.envs.classic_control.mountain_car import MountainCarEnv from gym.envs.classic_control.pendulum import Pendulum...
c124351b43ec2bf14e5696b4d98b81e13ba4f3dc545275f7833340c14e8204f1
Python
324
16
import numpy as np from neuron import h, gui from neuron.units import ms s = h.Section() s.insert("NeuronVariables") celsius_hoc = h.Vector().record(s(0.5)._ref_range_celsius_NeuronVariables) h.stdinit() h.tstop = 5.0 * ms h.run() celsius = np.array(celsius_hoc.as_numpy()) assert celsius[-1] == 6.3, f"{celsius[-1]...
e4846c5dfb10ed6135324ab4d92db0e9b6ef164910cee888540f4a48a17e151f
Python
324
13
import numpy as np import mistofrutta as mf class volume: def __init__(self, frames, z, dx=0.4, dy=0.4): self.frames = frames self.dx = dx self.dy = dy self.z = z def plot(self, wait=False): mf.plt.hyperstack(self.frames, order='zc', cmap='viridis', wait=wa...
81fb5618276af06ab2505b42a330092e1e690d682423784e8ea500313aa3a9e6
Python
325
13
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["motif_model_spec"] = dict( type="NeuralFixedMotif", path_format="model/rbns-binary-model-{motif}-2", removed_motifs=["3P", "5P", "HNRNPA1", "RALY"], ) msp.r...
cc5d6a53643a8b868715f515f73f8f8f3e5ffb6d64e368313dcc93d37e2bd559
Python
325
15
import requests from celery import task @task(ignore_result=True) def urlopen(url): print(f'Opening: {url}') try: requests.get(url) except requests.exceptions.RequestException as exc: print(f'Exception for {url}: {exc!r}') return url, 0 print(f'Done with: {url}') return ur...
cf590b68ee9914183d8373287aec55fba50f99ca8a0314ecd1f8eaa1840e81ce
Python
325
7
"""utils module""" from sknetwork.data import * from sknetwork.utils.check import is_symmetric from sknetwork.utils.format import * from sknetwork.utils.membership import get_membership, from_membership from sknetwork.utils.neighbors import get_neighbors, get_degrees, get_weights from sknetwork.utils.tfidf import get_t...
a30989e8be352edf742954ce24822641986875929fd27c88416eaf99d9ddd37d
Python
326
20
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.window = 40 msp.batch_size = 150 msp.architecture = dict( type="SplicePointIdentifier", cl=40, asymmetric_cl=(2, 20), hidden_size=100, n_layers=4, ) msp.extra_params += " --only-train donor" msp....
e3bc7fb3257476485c9fe60d98642b4db9bcedccae519dee4a2a6fbbfcdf9dd5
Python
326
16
""" Bertalign initialization """ __author__ = "Jason (bfsujason@163.com)" __version__ = "1.1.0" from bertalign.encoder import Encoder # See other cross-lingual embedding models at # https://www.sbert.net/docs/pretrained_models.html model_name = "LaBSE" model = Encoder(model_name) from bertalign.aligner import Bert...
05faffdc4d4b295257d6d1b540baa268aaac327232ca80f98c07bf0ba743dd31
Python
327
16
from celery import Celery from config import Config from database import connect_mongo connect_mongo('Celery_Worker') celery = Celery( Config.NAME, backend=Config.CELERY_RESULT_BACKEND, broker=Config.CELERY_BROKER_URL ) celery.autodiscover_tasks(['workers.tasks']) if __name__ == '__main__': celery.s...
1630cefb5d073808e8b4164e4d910f69aee57a93eaee53debb575e7e7aabb83f
Python
327
14
from flask import Blueprint from flask import render_template frontend = Blueprint("frontend", __name__, template_folder="templates") @frontend.route("/") def index(): return render_template("frontend/index.html") @frontend.route("/missing") def missing_template(): return render_template("missing_template....
7e8c26cb4f3b51305d5e35a311df2cdd790a17f656bd113b233dec2c1dda83e5
Python
327
13
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"] = 13 msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict( type="FCMotifFeatureExtractor", extra_compute=10, num_compute_layers=1 ) msp...
8d6c13608bccfcd4b31187b9ad9d6f4c29684cd73e3436fb3f80d37f8d2b199a
Python
327
18
from tqdm import tqdm from motif_model import load_model, evaluate_model, MotifModel, MotifModelDataset def main(): bs = 512 p = 'result_raw_20/' m = load_model(p)[1] deval = MotifModelDataset( 'data/rbns_test.h5' ) evaluate_model(m, deval, limit=float("inf"), bs=bs, quiet=False) ...
bf93326f569138b8a63e8ea2a88364cf3d0f2b784370c6c9fdf1d587880f9a86
Python
328
18
# ruff: noqa: F405 """Built-in datasets for demonstration, educational and test purposes.""" from plotly.data import * # noqa: F403 __all__ = [ "carshare", "election", "election_geojson", "experiment", "gapminder", "iris", "medals_wide", "medals_long", "stocks", "tips", "w...
266015244b0866652f99681cf282aa02923ba5bacbdd46b976c46cb93a5a890c
Python
329
9
''' A file to store general basic functionality needed in different modules.''' import numpy as np def round_num(num, decimal_places=4): """Rounds a number to the selected num of decimal places This allows consistency throughout the method and avoids numerical artifacts""" return np.round(num, decimal...
3692a72b2663fa49a04a06e163944f505d507549c1eb540bf661ffd5c59c30a0
Python
329
14
""" GTN (Galaxy Training Network) Integration Module. This module provides search and retrieval capabilities for GTN tutorials through a lightweight SQLite database with FTS5 full-text search. """ from .search import ( FAQResult, GTNSearchDB, SearchResult, ) __all__ = ["GTNSearchDB", "SearchResult", "FAQ...
3817cf0385c75542bc299f554ab6442861af8dea8b942ad20a7757d79eb554b3
Python
329
20
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.window = 40 msp.batch_size = 150 msp.architecture = dict( type="SplicePointIdentifier", cl=40, asymmetric_cl=(20, 2), hidden_size=100, n_layers=4, ) msp.extra_params += " --only-train acceptor" m...
6196acdccfb80775bb6ab1731a8178d2e61040799e8175e388b1edc5d8c69dc7
Python
329
13
def should_use_motif(x): return any(remap_motif(x).startswith(pre) for pre in ("HN", "SR", "TRA")) def remap_motif(x): return { "PTBP1": "HNRNPI", "PTBP2": "HNRNP: PTBP2", "PTBP3": "HNRNP: PTBP3", "FUS": "HNRNPP2", "PCBP1": "HNRNPE1", "PCBP2": "HNRNPE2", }.g...
a26ad668b9dc9f11b559f347731b45ad01058e2fd0c6041746b631b1e5030a3e
Python
329
14
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.batch_size = msp.batch_size * 2 // 3 msp.seed = int(argv[1]) msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3 msp.architecture = dict( type="DiscretizeMotifModel", original_model_path="model/rbnsp-67_1", original_model_step=1459275, ) m...
ba1467fec21c655d8d856498ecd01649a7ae69c04a841f6b7fe976929b8ee4f0
Python
329
10
def estimate_variance_of_binomial_proportion(kvec, nvec): """ Returns the unbiased estimate of the variance associated with the proportion estimator, phat = k/n: :param kvec: :param nvec: :return: """ # todo: add checking on argument phat = kvec / nvec return (phat * (1 - phat)) / (n...
cfee427574cb96fa5bbf2313b845da1b3952d90bf2aef2f6c4cbb26430ac07de
Python
329
10
"""Test functions for specparam.modutils.debug""" from specparam.modutils.debug import * ################################################################################################### ################################################################################################### def test_sys_info(): sy...
d7142d178424fed8153223c20264cf21ae38ba93e8284f8ccb1c26a99e73e8b3
Python
329
14
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.batch_size = msp.batch_size * 2 // 3 msp.seed = int(argv[1]) msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3 msp.architecture = dict( type="DiscretizeMotifModel", original_model_path="model/rbnsp-67_2", original_model_step=1184055, ) m...
70ddd12678f5c916bf3c532f6b2bd025e01fc04e44c647981da295fa7a58df4a
Python
330
14
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.batch_size = msp.batch_size * 2 // 3 msp.seed = int(argv[1]) msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3 msp.architecture = dict( type="DiscretizeMotifModel", original_model_path="model/msp-171a1_1", original_model_step=3920295, ) ...
9dabc6cbd753cdc98c5ff1736b97a4969baa32f9765b564e4c6dd23d8cbf16a6
Python
330
10
import pandas as pd barcode2id_file = "../resource/barcode2id.csv" barcode2id = pd.read_csv(barcode2id_file, header = 0) cluster2size = barcode2id.L1.value_counts() with open("../resource/sa2_L1_cluster2size.csv", 'w') as f: f.writelines([f"{c},{s}\n" for c, s in zip( cluster2size.index.to_list(), cluster2...
03e1aa50d6a9ad1779e14b5ffe475a79eadd4643f8cb095a26807b5bf1ad52fc
Python
331
15
""" This module define a converter """ import torch from converter.generic_converter import GenericConverter from utils.utils import select_output_lm class ConverterNoChanges(GenericConverter): """ This class doesn't convert """ def convert_output_and_target(self, output, target): return outp...
22bf9b4cbf5c80d281d776296f6e4133ee887a80d36aa6b3f37646db21a13497
Python
332
13
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._data import Data from ._layout import Layout from . import data else: from _plotly_utils.importers import relative_import __all__, __getattr__, __dir__ = relative_import( __name__, [".data"], ["._data.Data", "._layout.Lay...
487463f39e80f1e75370b583e684ff5d96589c9cdd4b30becadfe84bfd166d22
Python
333
10
"""Some basic statistical tests for univariate data.""" __test__ = False from ._stats.glm import ANOVA from ._stats.test import ( Correlation, TTestOneSample, TTestIndependent, TTestRelated, MannWhitneyU, WilcoxonSignedRank, pairwise, ttest, correlations, bootstrap_pairwise, lilliefors, pairwise_cor...
55cd093824f29b34ac572e8a5f756c9a56369d3493919a76a458242926cdfac6
Python
333
11
try: from ._version import version as __version__ except ImportError: __version__ = "unknown" __author__ = "Marcos Obando and Minh Nhat Trinh" __credits__ = "Teresa Correia and Germán Mato" __email__ = "marcos.obando@ib.edu.ar" from ._reconstruction_widget import ReconstructionWidget from .processors import O...
a76b34f20aac12ecd33a8832a7fe75ef554be084aa6b9ae1a325170cb2883000
Python
333
21
"""Merge heads Revision ID: 75b461a2b24a Revises: 724237cc4cf0, 98621a25ab75 Create Date: 2025-12-12 18:54:48.572124 """ # revision identifiers, used by Alembic. revision = "75b461a2b24a" down_revision = ("724237cc4cf0", "98621a25ab75") branch_labels = None depends_on = None def upgrade(): pass def downgrade...
33b91e3dfbe8e62250ca73c7acb6fbaec80fbe1e740383b15c3bad338a8ae778
Python
334
14
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.batch_size = msp.batch_size * 2 // 3 msp.seed = int(argv[1]) msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3 msp.architecture = dict( type="DiscretizeMotifModel", original_model_path="model/rbnsp-80-adj2_2", original_model_step=1546995...
39441aec221c45b0e66eb19b196d7753b8d0fcd45d6cf87c609c7293a5f4d451
Python
334
12
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._font import Font from ._grouptitlefont import Grouptitlefont else: from _plotly_utils.importers import relative_import __all__, __getattr__, __dir__ = relative_import( __name__, [], ["._font.Font", "._grouptitlefont.Grouptitl...
5e7424052bdb2a0448683c1481cff4170197724bdc4671f2efa8f99c585783ba
Python
334
14
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.batch_size = msp.batch_size * 2 // 3 msp.seed = int(argv[1]) msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3 msp.architecture = dict( type="DiscretizeMotifModel", original_model_path="model/rbnsp-80-adj2_3", original_model_step=2345595...
6940e8a9aadd52ba590e213ece77bbc8cb55b4c5100ec757a6fe3f7e62b0aab4
Python
334
14
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.batch_size = msp.batch_size * 2 // 3 msp.seed = int(argv[1]) msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3 msp.architecture = dict( type="DiscretizeMotifModel", original_model_path="model/rbnsp-80-adj2_1", original_model_step=2731035...
7a5269b0b919c8736228a12fd24fc5a480f5ae03f00585a4a4874c4eb0f0b117
Python
334
20
#!/usr/bin/env python # encoding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import os, sys, re import logging import argparse import collections import numpy import time logger = logging.getLogger(__name__) class GraphCycleException(Exceptio...
228d66ab791f5949f35844cf54fcaa0fdd2f4e9d0cbf90dbb2cba67d19e2a9c0
Python
336
11
from PIL import Image from lightly.transforms.mae_transform import MAETransform def test_multi_view_on_pil_image() -> None: multi_view_transform = MAETransform(input_size=32) sample = Image.new("RGB", (100, 100)) output = multi_view_transform(sample) assert len(output) == 1 assert output[0].shape...
cfda58acef3bccee5681a0eb50339f30626359dcc857f12dec55fb456ceb177d
Python
336
19
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from common import sort_items if len(sys.argv) < 2: print("Sort the dictionary") print(("Usage: ", sys.argv[0], "[input] ([output])")) exit(1) input = sys.argv[1] if len(sys.argv) < 3: output = input else: output = sys.argv[2] sort_items...
08282ef4246eff0e6a70f94d1f95e6a6f74ab24677d9c186db343cc423e245de
Python
337
13
import sys wild_fa = sys.argv[1] snp_tags = sys.argv[2] outfile = sys.argv[3] # Write RNA sequence and SNP tags to a outfile out = open(outfile, "w") with open(wild_fa) as in_fa_handle: for line in in_fa_handle: out.write(line) with open(snp_tags) as in_snp_handle: out.write("*" + in_snp_handle.readlin...
b665f5d7467c4b857efd418d56a6a9af92459770b886f02820b27bc7512f28cb
Python
337
16
from .constituitive import Constituitive from .null import Null from .alternate_sites import AlternateSites from .skipped_exon import SkippedExon from .exclusive_exons import ExclusiveExons from .other import Other annotation_types = [ Constituitive, Null, AlternateSites, SkippedExon, ExclusiveExo...
f1797bfdd1351a4888ccce259c53f29a68c22ef3995e50cf439cb4bc6d057fcd
Python
337
13
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._fill import Fill from ._font import Font from ._line import Line else: from _plotly_utils.importers import relative_import __all__, __getattr__, __dir__ = relative_import( __name__, [], ["._fill.Fill", "._font.Font", "._l...
d8d6c926fe99b03f3f99ac7d458ba12fe6d4c3e436ac426e48c0315b2f8bb7b2
Python
338
15
import pytest from src import config def test_config_port(): assert config.PORT == 8000 def test_config_my_region(): assert config.MY_REGION == 'VPM' def test_config_soma_thr(): assert config.SOMA_THR == 30 def test_config_cpd_params(): assert 'max_it' in config.CPD_PARAMS assert config.CPD_PARA...
dfbafae8eed75465ab6c5a322fcdc162e0f520d230fec44b61ebbdcef659a74a
Python
338
17
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="PreprocessedSpliceAI", preprocessor_spec=dict(type="Identity"), spliceai_spec=dict(type="SpliceAIModule", output_size=3), ) msp.data_dir = "../data/gtex_dataset/" msp.acc_thresh...
1f88e6cd20b06f28d1de7bb2fa36ed29aa0ae2c069a5b176753dc6520f6db171
Python
339
11
""" Authentication module for Ethoscope Node. Provides PIN-based user authentication with session management, rate limiting, and security features. """ from .middleware import AuthMiddleware, require_admin, require_auth from .session import SessionManager __all__ = ["AuthMiddleware", "require_auth", "require_admin",...
7ce8ba10185346decff4e7b55f68a5c9d1cf510558211379aa7d8c8c3de5ab4e
Python
339
14
import argparse parser = argparse.ArgumentParser( "Explainable Deep Learning for Tumor Dynamic Prediction and Overall Survival using Neural ODE" ) parser.add_argument( "--config", type=str, default="assets/configs/config.json", help="paremeter file that specifies TDNODE configuration", ) args = p...
89528b876030f8bbeb82ba8848c46f6272efc703db95336daad037651d95178b
Python
339
10
from sklearn.metrics import mean_absolute_error, mean_squared_error, max_error, r2_score def get_metrics(y_true, y_pred): mae = mean_absolute_error(y_true, y_pred) rmse = mean_squared_error(y_true, y_pred, squared=False) maxerr = max_error(y_true, y_pred) r2 = r2_score(y_true, y_pred) return [mae...
d8ca8b53e0d43d6fe2dda48e2c86b190c1e2c17b775f53f1bc0e6e9b159da0f3
Python
339
17
# Generated by Django 2.1.5 on 2019-01-25 10:31 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('biomedisa_app', '0030_auto_20190123_1815'), ] operations = [ migrations.RemoveField( model_name='upload', name='sensitivity'...
fcb10ef3bd6a920d2e5fc1e4c6fb17185b73c372f7096c80837e927a3d50aa26
Python
339
7
import numpy as np h = np.load("cache/features_healthy.npz", allow_pickle=True) s = np.load("cache/features_stroke.npz", allow_pickle=True) for name, d in (("healthy", h), ("stroke", s)): X = d['X'] print(f"{name}: alpha logPSD {X[:, :29].mean():7.2f} " f"beta {X[:, 29:58].mean():7.2f} RMS {X[:, 5...
252e315abbe84b435886746a072d9e3555e0c075d3b05b0e59d2ae3549cb6eb7
Python
340
9
from sklearn.metrics import mean_absolute_error, mean_squared_error, max_error, r2_score def get_metrics(y_true, y_pred): mae = mean_absolute_error(y_true, y_pred) rmse = mean_squared_error(y_true, y_pred, squared=False) maxerr = max_error(y_true, y_pred) r2 = r2_score(y_true, y_pred) return([mae,...
0e16747901d595f2df416cadd1a82ea9fdcaa225f4905283e8d9bf7fc9812aa6
Python
341
14
import torch # define the strategy of weight decay class Save_Pes(): def __init__(self,PES_Normal,PES_Lammps): self.PES=PES_Normal self.Lammps=PES_Lammps def __call__(self,model): state = {'reannparam': model.state_dict()} self.PES(state) if self.Lammps: ...
179844b27e1099197ecc8ff0b9f05ff10c2cc189c3aaabc61ccdb8457428f39f
Python
341
14
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.batch_size = msp.batch_size * 2 // 3 msp.seed = int(argv[1]) msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3 msp.architecture = dict( type="DiscretizeMotifModel", original_model_path="model/rbnsp-80-adj13x4-nsp_2", original_model_step=...
39a16f0465e25837e095eff0b7466e4e9d6d68e7107b1b22fc63ec0fa1791c50
Python
341
17
# Generated by Django 2.1.5 on 2019-04-09 12:12 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('biomedisa_app', '0039_auto_20190322_1601'), ] operations = [ migrations.RemoveField( model_name='upload', name='inverse_step...
b4130b8b08e61986fb2113da5238e4697671333894fe52fa9de769d6ca2a40a9
Python
341
13
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._button import Button from ._font import Font from ._pad import Pad else: from _plotly_utils.importers import relative_import __all__, __getattr__, __dir__ = relative_import( __name__, [], ["._button.Button", "._font.Font"...
bd78d2cccca18b8b84ba514dfc9a4fc0fe8307e0bb2ab6ec52b19fc7859064c6
Python
341
10
"""Test functions for specparam.utils.random""" from specparam.utils.random import * ################################################################################################### ################################################################################################### def test_set_random_seed(): ...
cd6260904222debc9e2da14717610932bbaac50919e547a040ba2e096ef7021a
Python
341
8
"""Sub-module for model objects & related utilities.""" from .model import SpectralModel from .group import SpectralGroupModel from .time import SpectralTimeModel from .event import SpectralTimeEventModel from .utils import (compare_model_objs, average_group, average_reconstructions, combine_model_...
e7bbeaf7bd02cb5604be2ae7f35c069018eb5207fe65081b3a4ab34697cd32c8
Python
341
10
from lightly.cli.config.get_config import get_lightly_config def test_get_lightly_config() -> None: conf = get_lightly_config() # Assert some default values assert conf.checkpoint == "" assert conf.loader.batch_size == 16 assert conf.trainer.enable_model_summary is True assert conf.summary_cal...
ef2e42a2b11189855504c0a95a2a02c3f9bf363d6881e560a1808956c80175e5
Python
341
14
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.batch_size = msp.batch_size * 2 // 3 msp.seed = int(argv[1]) msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3 msp.architecture = dict( type="DiscretizeMotifModel", original_model_path="model/rbnsp-80-adj13x4-nsp_1", original_model_step=...
f085332174e121d6f5426e4ace21b466a66f8e86b7c0c295d97c5cd456a689c1
Python
341
14
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.batch_size = msp.batch_size * 2 // 3 msp.seed = int(argv[1]) msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3 msp.architecture = dict( type="DiscretizeMotifModel", original_model_path="model/rbnsp-80-adj13x4-nsp_3", original_model_step=...
2524be904bd9dff8c96c0d02f13b25d55c9c9aaaef8dba2257e0cd717f8d5826
Python
342
21
"""Merge head revisions Revision ID: 75348cfb3715 Revises: 9a5207190a4d, cbc46035eba0 Create Date: 2024-11-19 11:48:02.273303 """ # revision identifiers, used by Alembic. revision = "75348cfb3715" down_revision = ("9a5207190a4d", "cbc46035eba0") branch_labels = None depends_on = None def upgrade(): pass def ...
05cd8b25b7d163cc9277ccd82f6cabfe9b7e6470e4c3162522ee122559b21873
Python
343
21
"""Merge migration heads Revision ID: 98621a25ab75 Revises: 1d1d7bf6ac02, 63dc6cca023f Create Date: 2025-12-12 13:48:07.888987 """ # revision identifiers, used by Alembic. revision = "98621a25ab75" down_revision = ("1d1d7bf6ac02", "63dc6cca023f") branch_labels = None depends_on = None def upgrade(): pass def...
5b307154f4e4d3814180450d5f8fd3e3d169b244ec6906502f055f27f7714f8d
Python
343
11
import numpy as np def split_array(X, lengths): """ Split an array into subarrays of given lengths along its first dimension. """ assert np.sum(lengths) == X.shape[0] border_indices = np.insert(np.cumsum(lengths), 0, 0) return [X[start:end, ...] for (start, end) in zip(border_indices[:-1]...
90ac86f8045b1b1fef2f9e9a57aa272cf948c56d61e6d1c78fbbbe10f8d5bff0
Python
343
11
from scipy import ndimage from .dctsplines import l2spline,l1spline import numpy as np def grayscale_msr(img, sigmas=(15,80,250),smoother=l2spline): out = np.zeros(img.shape,np.float32) img = img.astype(np.float32) for s in sigmas: #smoothed = out += np.log(img/(smoother(img,s)+0.001)) ...
0dc7436142f4754b2b86f2eed6675c23300b3642335e9eb7d285e6d3b106ef3f
Python
345
14
"""Backward-compatibility shim. Module renamed to pyriemann.utils._check.""" import sys import warnings from . import _check as _moved warnings.warn( "pyriemann.utils.utils is deprecated and will be removed in 0.14.0; " "use pyriemann.utils._check instead.", DeprecationWarning, stacklevel=2, ) sys.mo...
437e495521a1c2e9ce0eae4f4958b633ee9b846c084310a89579cbc5a9ccfc16
Python
345
12
from sklearn.utils.testing import assert_true from sklearn.utils.testing import assert_equal from mord.datasets.base import load_housing def test_load_housing(): res = load_housing() assert_equal(res.data.shape, (1681, 3)) assert_equal(res.target.size, 1681) assert_equal(len(res.feature_names), 3) ...
4485c6d7f14378c218de5507835cdc18e0ac41dbd3d9fa74a103f29b2338b3c3
Python
346
11
from modular_splicing.eclip.data.pipeline import produce_all_eclips RCS = "1", "2", "1, 2" for rc in RCS: for is_train in False, True: produce_all_eclips( replicate_category=rc, dataset_path="canonical_dataset.txt", sequence_path="canonical_sequence.txt", is_...
734d8844f3449a9ba1998b748a2424958b2e5c8ed4b5e91094e9756ddefd74c7
Python
346
13
"""A way to run the XCP-D CLI with a Python call.""" from xcp_d.cli.run import main if __name__ == '__main__': import sys from xcp_d import __name__ as module # `python -m <module>` typically displays the command as __main__.py if '__main__.py' in sys.argv[0]: sys.argv[0] = f'{sys.executable...
adfc25ef357d5b2d894eb2dc24a827949b3fd1cbcb65fd32af29aee6810b0e3c
Python
346
7
from . import base from .base._blocks import DenseBlock, Conv1DBlock, RecurrentBlock from .base._towers import Tower, Conv1DTower from ._SequenceModule import SequenceModule from ._ProfileModule import ProfileModule from ._utils import list_available_layers, get_layer, load_config from .base._initializers import init_m...
4b6ad6742a402190e955bffc747bd2e2879e4477d2480b4bc94c650794be700a
Python
347
16
from afmformats.formats import formats_by_modality from . import fd analysis_types = { "fd": { "suffixes": [f["suffix"] for f in formats_by_modality["force-distance"]], "gui": fd.UiForceDistance, } } known_suffixes = [] for _item in analysis_types.values(): known_suf...