sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e3e9f98e6a62820ddc7fbcd4d5b501b85bffb9b4f16db591b533c91454c8fb73
Python
1,636
43
from setuptools import setup, find_packages with open("requirements.txt", "r", encoding="utf8") as fh: REQUIREMENTS = fh.read() INSTALL_REQUIREMENTS = REQUIREMENTS CLASSIFIERS = ["Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: ...
e47d4b02a9fbe11db27900e5bca9e266ae6bec6ce1362cea49b7cf9658972051
Python
1,636
53
import os import shutil import sys # Dirty fix, :TODO rewrite tools as a package - joined directly to Snudda or the lab sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, "tools"))) import unittest from meta.create_meta import write_meta from transfer.morphology import transfer_morphol...
5de7d4d08b329ac77cf387b4d3b958f8d5163c3cadbabbeed623b6724dc1733c
Python
1,637
63
#! /usr/bin/env python3 # -*- coding: utf-8 -*- import math #import copy import numpy as np # ROS libraries import rospy # ROS messages from std_msgs.msg import String from email.message import EmailMessage import ssl import smtplib class CallNurse(object): def __init__(self, hz = 10.0): rosp...
ef143073253f577f64db8ae31e56613b7dc669954f67e822613a54e7e386681b
Python
1,637
55
"""Negative Cosine Similarity Loss Function""" # Copyright (c) 2020. Lightly AG and its affiliates. # All Rights Reserved import torch from torch.nn.functional import cosine_similarity class NegativeCosineSimilarity(torch.nn.Module): """Implementation of the Negative Cosine Simililarity used in the SimSiam[0] p...
145ed88b9a2f147e47ab1a3c7bde360f7ab92baa4f41230339b1faf614734ae8
Python
1,638
40
from setuptools import setup, find_packages with open("README.md", "r") as fh: long_description = fh.read() setup( name='densratio', version='0.4.0', description='A Python Package for Density Ratio Estimation', long_description=long_description, long_description_content_type='text/markdown', ...
5010ee1090cbc43e4d80fc57d42e7126be880dedb1bfee2083ab330741f76416
Python
1,639
47
import os import pandas as pd import numpy as np import shutil import subprocess from settings import AGE_FROM, AGE_TO N_CASES = 2 path_for_images = "./data/pre-processing/test" def find_file_in_path(name, path): result = False for root, dirs, files in os.walk(path): result = next((os.path.join(file) ...
6bda950a1ca71a6115833fc0e194bdcb58b9b09a00662a29247241a589b12013
Python
1,640
56
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_...
2465cf22e1a19e0ee1a1432891aa6551fb7c41fb7f33755ec55e2a225b65a209
Python
1,641
48
#!/usr/bin/env python # -*- coding: utf-8 -*- from os.path import exists, dirname, realpath from setuptools import setup, find_packages import sys maintainer = u"Paul Müller" maintainer_email = "dev@craban.de" description = 'Fit and superimpose shapes from different imaging modalities' name = 'impose' year = "2020" ...
18f563556b777ccef13c7fb9218269bc4e8aa132f56af4c0d6d915fd6142bc6c
Python
1,642
43
import matplotlib.pyplot as plt from rdkit import Chem from rdkit.Chem import Lipinski, MACCSkeys import numpy as np import sklearn from sklearn.manifold import TSNE import warnings import pandas as pd from rdkit.Chem import AllChem warnings.filterwarnings('ignore') df_all = pd.read_csv('D:\PythonProject\Project_VAE\d...
3571dfbf90a6a44ee575fa13dc91e223e559c934f6b6130cd10dd314d17321aa
Python
1,642
46
import sys sys.path.insert(1, '../') import numpy as np import pandas as pd import os import shutil from datetime import datetime metadata_dob = pd.read_csv('itmt_v2/cvs_files/metadata_bch_scan_date.csv', header=0) def find_age_gender(id_to_find): for idx, row in metadata_dob.iterrows(): if str(id_to_fi...
f1a654cad68dd89b72415c3d91385ad57f7f081ac65c193b88adae889a0cad73
Python
1,642
62
"""Standalone launcher: `python -m larvaworld.portal.parameter_database`. Serves just the Parameter Database view on its own, without the rest of the portal (landing page, workspace, other apps). Configure via env vars, same as the main portal: - LARVAWORLD_PORTAL_PORT (default: 5006) - LARVAWORLD_PORTAL_OPEN_BROWSER ...
6324e6bbbdf852a1ad5b9f245a485edac48381c9962c49a801f05ccf2dd6b67f
Python
1,643
48
import gpytorch import torch from tqdm import tqdm from spateo.alignment.utils import _iteration def gp_train(model, likelihood, train_loader, train_epochs, method, N, device, keys, verbose=True): if torch.cuda.is_available() and device != "cpu": model = model.cuda() likelihood = likelihood.cuda(...
b5a9c0adce2fb2d359dfa08bafb4bcb8455d5d7d223f62bd5162902d372c3ec4
Python
1,643
50
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """tests for spring embeddings""" import unittest from sknetwork.data.test_graphs import * from sknetwork.embedding import Spring class TestEmbeddings(unittest.TestCase): def test_shape(self): for adjacency in [test_graph(), test_digraph()]: n ...
0e734460ff8dc8ed427447e6123e1612fef2e802991520b19a4b44c092d025f6
Python
1,644
60
"""Package setup.""" import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="bdd100k", # Replace with your own username version="1.0.0", author="Fisher Yu", author_email="i@yf.io", description="BDD100K Dataset Toolkit", long_description=l...
d325e8f9ccf336a5784b90501e6ede3cc57af2f506b8a64fe7991c28e0620b80
Python
1,644
48
from datetime import datetime from unittest import mock from uuid import UUID import dateutil.relativedelta from carbonserver.api.infra.repositories.repository_runs import SqlAlchemyRepository EXPERIMENT_ID = UUID("e52fe339-164d-4c2b-a8c0-f562dfce066d") class SessionContextMock: def __init__(self, session): ...
e8774d57aa6f3d071eca015780d64df44ae6941099cd1f51c0b205aa564af69e
Python
1,644
50
import os from options.test_options import TestOptions from data import create_dataset from models import create_model from util.visualizer import save_images from itertools import islice from util import html # options opt = TestOptions().parse() opt.num_threads = 1 # test code only supports num_threads=1 opt.batc...
97ab507a0f3a26294d12ba9dec8982687ad115a1387c1e79d2d26181737b506e
Python
1,645
45
from setuptools import setup, find_packages RECTIPY_TEAM = "Richard Gast" with open("requirements.txt", "r", encoding="utf8") as fh: REQUIREMENTS = fh.read() INSTALL_REQUIREMENTS = REQUIREMENTS CLASSIFIERS = ["Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", ...
00a73202e911b0a6dea6456a534a26d2bc1133de3ea41bcdce7044a1d3fcd3f7
Python
1,646
51
import anndata as ad import numpy as np import pandas as pd def write_subset_h5ad(adata, filename, obsm_keys=None, uns_keys=None): """Write only specific obsm and uns components to H5AD""" # Create a minimal AnnData object with the same structure minimal_adata = ad.AnnData( X=np.zeros((adata.n_ob...
9bf9e5d76f0b34ef66b9430dce5f02ec02031a9b8e64a832f973dfaf7cd68700
Python
1,646
60
__author__ = "quentin" import itertools import cv2 import numpy as np def merge_blobs(contours, prop=0.5): """ Merge together contour according to their position and size. If the distance between two blobs is smaller than the longest axis of, at least, one of them, then they get merged. This algo...
e8e969e4733562aa98e0725b66f97331838a9e6b3d4e18e2b0eb278ac3c9259d
Python
1,646
54
import os import subprocess import time from concurrent.futures import ThreadPoolExecutor disabled_error_message = "Refusing to deserialize disabled content of type " class test_config_serialization: def test_accept(self, celery_app): app = celery_app # Redefine env to use in subprocess #...
fea1df7b20c5d676a9b8aac15bb63114d2c2b62f1d70328024c64d96f5a80131
Python
1,646
57
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="SplicepointBasedBranchSitePredictor", splicepoint_model_spec=dict( type="BothLSSIModels", acceptor="model/splicepoint-model-acceptor-1", donor="model/splicepo...
056fd6b5102f3b5c7179a83302bdd2f0c5cf3647e926277620177641a6e8517d
Python
1,647
60
import argparse import nibabel as nib import torch from DeepDenoise.src.model import ResUnet def main(args): # Load the model checkpoint checkpoint = torch.load(args.checkpoint_path) # Instantiate the model model = ResUnet.load_from_checkpoint(args.checkpoint_path) # Load the input Nifti file ...
a1bdf9bb3a0a10e4f40a85f92260c71be4340a1a9ce603c93926c6ecda19dc63
Python
1,647
42
from imodelsx import AugGAMClassifier import datasets import numpy as np if __name__ == '__main__': # set up data dset = datasets.load_dataset('rotten_tomatoes')['train'] dset = dset.select(np.random.choice(len(dset), size=10, replace=False)) dset_val = datasets.load_dataset('rotten_tomatoes')['validat...
a901b779273e2ec0772c5aff764cdeb7012bf704ef15b06857abeb890b3faa30
Python
1,648
72
import os import re import pickle def join_paths(*args, create: bool = True) -> str: """ Joins strings to a path. If path does not exist yet, it is created. :param args: os paths or strings :param create: bool, if True a folder is created if it does not exist :return: joint os path """ p...
a285e5e475d61b4853ffe00a1c66c79fd8bb78d1ecd3f9c093985ae4e00b581b
Python
1,649
61
"""Choose between ``set`` and ``attach_hooks``. What this demonstrates ---------------------- ``set`` records a concrete one-shot replacement. ``attach_hooks`` records a sticky callable/helper recipe that can be replayed or rerun repeatedly. How to run ---------- ``python examples/intervention/05_set_vs_attach_hooks....
c67c757c1d61f1a0fc1ea2fc18ab373e8c14bd63a30c7701b7db26a0adcc0fd6
Python
1,650
55
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_...
ff947371eaae70bd18cfd5d5d18e1aae1a0dd373259658638c2a4a8b721c17e8
Python
1,650
43
# this dataset has very bad training accuracy from global_config import * isMeshFile = True # choose between part and mesh input format hasPerfileMetadata = True ############################## if testing: input_root_path = "./testdata/testThingi10K_data" output_root_path = input_root_path + ...
4138ef5e416b73e995542bb76eab98927867ea0a7fa205fb5dfe77a292f899fb
Python
1,651
62
# -*- coding: utf-8 -*- import os from utils import write import matplotlib.pyplot as plt plt.switch_backend('agg') class Logger(object): """ Framework to log encoding analysis progression and results. """ def __init__(self, path): self.log_path = path def report_logs(self, logs, le...
751133417929b874b6d1ca9b2c2111d4364b391ea21f1bbcb0f3b87ebec5f7ae
Python
1,651
43
# SPDX-License-Identifier: LGPL-2.1-or-later from __future__ import print_function, division, absolute_import import os import unittest import pyEcoHAB.utils.for_loading as uf from pyEcoHAB import data_path from pyEcoHAB.Loader import EcoHabDataBase, Loader from pyEcoHAB import Timeline from pyEcoHAB.SetupConfig impor...
a1d86a68ea6c884003ffea8c1d9ebd5778bfae204e69ecb5d11f32ffed7676e9
Python
1,651
54
from skimage.metrics import structural_similarity as ssim from PIL import Image import os import numpy as np from glob import glob from tqdm import tqdm import argparse def cal_SSIM(x, y): return ssim(x, y, multichannel=True) def get_dirImage(real_dir, fake_dir): real_image_paths = sorted(glob(os.path.join(...
151bd7f3f7948d65b140a215eb430d88b4717670eba7e9e6f1144cbd777b9584
Python
1,652
58
import os import numpy as np from dotenv import load_dotenv from sklearn.metrics import roc_auc_score from omop_learn.omop import OMOPDataset from omop_learn.sparse.models import OMOPLogisticRegression from omop_learn.utils.config import Config load_dotenv() config = Config({ "path": os.getenv("DATABASE_PATH")...
f6e387f6315f54c6d2d8498c9f1226cdfc00bc06fed25afe06e4bbf0688f50e7
Python
1,652
46
import torch def save_model(model, name, best_accuracy): if is_parallel(model): model = de_parallel(model) torch.save({ 'state_dict': model.state_dict(), 'best_acc': best_accuracy, }, f'{name}.pt') def is_parallel(model): # Returns True if model is of type DP or DDP retu...
3d6cf182051df3c8c5149fb521008f3b91413dd5b1da2fa2a509aea5e74811d9
Python
1,653
53
import os import random import numpy as np from skimage import io, color import cv2 images_path = './MRI' # series of MRI images masks_path = './pred' # series of predicted masks img_overlay_path = './overlayMRI' images = [] masks = [] images_name = [] for im in os.listdir(images_path): images.append(os.path.jo...
13a1605b372c1a55445564225735cee25d12691606547e029f0869276a66d8eb
Python
1,656
45
####usage: python script sample_sites.txt import sys, os import collections def get_annvar_input(sites_file): c = collections.defaultdict(list) with open(sites_file) as f, \ open('tmp_'+sites_file,'w') as out: for line in f: line = line.strip().split('\t') chr_id = line[0] #chr_id.replace("chr", "") p...
3875e800d8f81e78c108bf9db5cd4d17744d2cec4b3d1980697b17e0c1e9ed83
Python
1,656
59
import random from .utils import functional as F class Normalize(object): """Normalize a tensor image with mean and standard deviation Given mean: m and std: s will normalize each channel as channel = (channel - mean) / std Args: mean (int): mean value std (int): std value """ ...
55ab60fca596e746c7dc14532a1047cd06559427566b9ad6e48dacb93f8c22ba
Python
1,656
53
from datetime import datetime from unittest import mock import dateutil.relativedelta from api.mocks import FakeAuthContext from carbonserver.api.infra.repositories.repository_projects import SqlAlchemyRepository from carbonserver.api.usecases.project.project_sum import ProjectSumsUsecase PROJECT_ID = "e60afa92-17b7...
a0f58b8eb5ec308380b2a8517eebbd1486a31f60573920331429fa78160250e4
Python
1,656
52
# coding=utf-8 # Copyright 2025 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...
132a03009fd06a7d42fdc8ff13e0f48cd3d007ab1e2bbbf50de9d3a641de37c4
Python
1,657
50
import collections import copy __author__ = 'quentin' class DataPoint(collections.OrderedDict): def __init__(self, data): """ A container to store variables. It derived from :class:`~collections.OrderedDict`. Variables are accessible by header name, which is an individual identifier ...
8adfe3bbbf62e281b373cbbd860737116956439372d567d47cc00c981a4101ce
Python
1,657
60
import numpy as np from seqpro.rag import Ragged class _Sub(Ragged): __slots__ = () def _ragged(): return Ragged.from_lengths( np.arange(6, dtype=np.int32), np.array([2, 1, 3], np.uint32) ) def test_with_layout_preserves_subclass(): sub = _Sub(_ragged()._layout) out = sub._with_layout...
346675da2dd0f99694635a8678c3e932fcac20539434aadd6224966169f86685
Python
1,658
50
import collections import copy __author__ = "quentin" class DataPoint(collections.OrderedDict): def __init__(self, data): """ A container to store variables. It derived from :class:`~collections.OrderedDict`. Variables are accessible by header name, which is an individual identifier ...
3849f10c9bd6b3f7ec4b6b6e54a10395462cd6099df8fc8ff7c1d927a9b31c14
Python
1,658
53
from .h5_dataset import H5Dataset from .multi_setting_h5_file import MultiSettingH5File class DuplicatedSettingH5File(MultiSettingH5File): """ Just duplicates the data identically for each setting. """ def __init__(self, path, datapoint_extractor, num_settings): super(DuplicatedSettingH5File,...
fd4e2a564af5efa1de99c20767c9f55ff7f856416f8863f173b53f982207e6e2
Python
1,658
54
#!/usr/bin/env python """ Input: molecular input file. Output: Molecule file with removed ions and fragments. Copyright 2012, Bjoern Gruening and Xavier Lucas """ import argparse from openbabel import openbabel, pybel openbabel.obErrorLog.StopLogging() def parse_command_line(): parser = argparse.Ar...
4c0d62f3dc7809acc7f8ecb5432d28ff33edd753ce43663b9e3a483499176dea
Python
1,659
54
from skimage.metrics import structural_similarity as ssim from PIL import Image import os import numpy as np from glob import glob from tqdm import tqdm import argparse def cal_SSIM(x, y): return ssim(x, y, multichannel=True) def get_dirImage(real_dir, fake_dir): real_image_paths = sorted(glob(os.path.join(...
44e0fd6ab70af4b76861521457f362122e6e90556e990344784aef1e3e99f7a8
Python
1,660
64
# 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...
8dfcbcced4a6198eb21161a87149ec474720666b3f3ab2aa3634c0fe05f019ab
Python
1,660
55
""" Gregory Way 2017=8 PanCancer Classifier feature_comparison/analysis_pipeline.py Master script to submit all pancancer classifiers trained on compressed gene expression features. Usage: python feature_comparison/analysis_pipeline.py Output: Classifier results in the `feature_comparison/classifiers` fold...
a8a1710aa42e51da657ace3637c13294ac845d14df3c0be5114537c5dde8295a
Python
1,660
52
"""Prepare Multi-Human Parsing V1 dataset""" import os import shutil import argparse import zipfile from gluoncv.utils import makedirs from gluoncv.utils.filesystem import try_import_gdfDownloader, try_import_html5lib _TARGET_DIR = os.path.expanduser('~/.mxnet/datasets/mhp') def parse_args(): parser = argparse.A...
e6ec2e4500ed00cd91bdc4afd8cb6b7ef11449f83a1406537380d5bc3c5c31f1
Python
1,660
46
import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) # Get the long description from the relevant file with open(os.path.join(here, 'README.rst')) as f: long_description = f.read() def get_version(string): """ Parse the version number variable __version_...
68039f921d13ac558eca33283d87711fb99da97378e46186031f7906619120d4
Python
1,661
65
"""Regression tests for saved ModuleCall summary counters.""" import torch from torch import nn import torchlens as tl class _ModuleCallCounterModel(nn.Module): """Tiny model with a named child module for ModuleCall counting.""" def __init__(self) -> None: """Initialize the child module.""" ...
9dcccabfa2229ebfcbad4c7d74d24397d2fe16b90d64398bb64b32a87cea2f67
Python
1,661
63
#!/usr/bin/env python """ Utility functions for SuCOS and other RDKit modules """ from __future__ import print_function import gzip import sys from rdkit import Chem def log(*args, **kwargs): """Log output to STDERR""" print(*args, file=sys.stderr, **kwargs) def open_file_for_reading(filename): """Op...
a0a2ddc662ae2a35fb14c90f4b3575c21a0c0a7abd105f23115c4003c3a20a12
Python
1,661
57
"""Generate palettes for different tasks.""" from typing import Dict, List import numpy as np from .label import drivables, labels, lane_categories from .to_mask import STUFF_NUM PALETTES: Dict[str, List[int]] = {} def get_palette(mode: str) -> List[int]: """Generate mapping for the required task.""" if m...
c9fa0e9209a8f636630eb72e5eed3cea65a8d6c07b2bd1fbf2d3eba1144d5c88
Python
1,661
53
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import torch from torch.nn im...
7a7e2108bb7ee53ff43101dfab739cacc595c25ec4b5003993e680dceb9e908a
Python
1,662
53
import argparse import numpy as np import mxnet as mx import matplotlib.pyplot as plt from mxnet import gluon, nd, image from mxnet.gluon.data.vision import transforms import gluoncv as gcv gcv.utils.check_version('0.6.0') from gluoncv.model_zoo import get_model parser = argparse.ArgumentParser(description='Predict ...
0216ad5acacc5d79116af32f7ac35a6118d0c665b74d0438ac747cf8173286fa
Python
1,663
48
import numpy as np from src.cpd_registration import RigidRegistration, NonRigidRegistration def generate_synthetic_tree(n_points=50): # Generate a simple branch (a line in 3D) points = np.linspace(0, 10, n_points) return np.stack([points, np.zeros(n_points), np.zeros(n_points)], axis=1) def deform_tree(po...
d136d9aec5f9912c4d6072b9aac6f100a12655c0e883d14a62fb53d60741e47c
Python
1,663
58
from . import data_cleaning import pandas as pd import scipy.io def mat2dataframe(path, shift_idx_fields, td_name=None): """ Load a trial_data .mat file and turn it into a pandas DataFrame Parameters ---------- path : str path to the .mat file to load "Can also pass open file-like...
0b89e95108ad9ac1b89bfdca11cdb9859e5138a9f1a038c91351dfe49214f493
Python
1,665
37
import argparse import os import warnings from itmt_v2.infer_segmentation import test from settings import CUDA_VISIBLE_DEVICES os.environ['CUDA_VISIBLE_DEVICES'] = "0" os.environ["TF_CPP_MIN_LOG_LEVEL"] = '3' warnings.filterwarnings("ignore") if __name__ == '__main__': parser = argparse.ArgumentParser(descr...
30f1f1287b60ca0787e78aa90f83237dc891cc84bd914a2ee86e2dfe53a56c4c
Python
1,665
51
# coding=utf-8 # Copyright 2025 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...
b8f445de0c374aebeee212f3712953372add29b581e10ded6762504c10cf8d2f
Python
1,665
57
import numpy as np import scipy.spatial as spatial from anndata import AnnData def disk( adata: AnnData, use_data: str = "X_umap", radius: float = 10.0, rates: int = 1, method: str = "mean", copy: bool = False, ) -> AnnData | None: adata = adata.copy() if copy else adata coords = adat...
053ac09b617d55028926ce9a6685f0c03685e093c861012ceee030a53e95bb22
Python
1,666
41
import functions_common import functions_3D import pandas as pd parameters = functions_common.read_parameters() print("#"*5,"parameters","#"*5) print(parameters) key_file = functions_common.read_key_file(parameters) print("#"*5,"key_file","#"*5) print(key_file.head()) print(key_file.keys()) #macrophage_properties_df...
1258ca2eac3fa15334f33391fb42ad413160f70b50cd3c68a75bf23dbbad61ac
Python
1,666
49
import operator from unittest.mock import Mock from celery import signals from celery.concurrency import solo from celery.utils.functional import noop class test_solo_TaskPool: def test_on_start(self): x = solo.TaskPool() x.on_start() def test_on_apply(self): x = solo.TaskPool() ...
788d442831e03fedbf6876463371c4506b7e18ed90598e5711fadda36098f2fb
Python
1,667
39
import requests import tarfile import sys import os VISUAL_CHECKPOINTS_LOCATION = 'model_analysis_folders/visual_networks/pytorch_checkpoints/' AUDIO_CHECKPOINTS_LOCATION = 'model_analysis_folders/audio_networks/pytorch_checkpoints/' ASSETS_LOCATION = 'assets/' def download_extract_remove(url, extract_location): ...
4905a6ed5069ec2e83d9f842be047dc86f133d2f5dbb4506701402727b9c58c6
Python
1,668
53
""" Compute test scores """ # python get_test_scores.py -y data/medical -pred exp_out/2022-05-28-17-19-27 import os import json import argparse from sklearn.metrics import precision_recall_fscore_support from sklearn.metrics import classification_report from sklearn.metrics import accuracy_score from sklearn.metrics i...
49ee4b4a0422f91c00fa75db27597fba98cac3f30d21c91e4ff761dd361697ac
Python
1,668
54
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in May 2023 @author: Thomas Bonald <bonald@enst.fr> """ from typing import Iterable, Optional, Union import numpy as np from scipy import sparse from sknetwork.path.distances import get_distances from sknetwork.utils.check import check_format, check_square ...
5f0f578c1147b411145a44411324320f8fb6ea0e494f40364eb6db07e2b5c8ca
Python
1,668
42
import argparse import logging from rpy2.situation import get_r_home from rpy2.situation import iter_info from rpy2.situation import r_ld_library_path_from_subprocess from rpy2.situation import set_default_logging import sys logger = logging.getLogger(__name__) if __name__ == '__main__': parser = argparse.Argume...
75268a61a471b46021d093669923c716c28987281ff3bf15a543972a4b5b89b7
Python
1,668
53
import pandas as pd from anndata import AnnData def lr( adata: AnnData, db_filepath: str, sep: str = "\t", source: str = "connectomedb", copy: bool = False, ) -> AnnData | None: """Add significant Ligand-Receptor pairs into AnnData object Parameters ---------- adata: AnnData ...
9925e791bc917c74c5afc7810f0ce9816609748c34f6b6cd9fdf3dbe2d19eb50
Python
1,668
70
""" Implementation of postprocessing methods """ from Bio.SVDSuperimposer import SVDSuperimposer import numpy as np from numpy import array, dot, set_printoptions def group_sites(p_sites): size4_sites = [x for x in p_sites if len(x) == 4] out_list = [] for p_site in p_sites: contained = False ...
cdcf3c3850e6453761bf14f0b35db7b42b5764754912a99c23b6607d86031867
Python
1,668
52
"""Accelerate on-ramp rows (memo item 20 / Tier 2). ``init_empty_weights()`` and literal ``from_pretrained(..., device_map='meta')`` are advertised ONLY after these rows pass — ``device_map='meta'`` is the one DIGEST-AUDIT-named spelling no panel lab could run in four rounds (accelerate absent from the checkout); abse...
5a7ef5945a9f3b8230745950cd66d0601d439390cea6284ec47bc15032ab169e
Python
1,669
36
import requests from pytest_celery import RESULT_TIMEOUT, CeleryTestSetup from requests.auth import HTTPBasicAuth from celery.canvas import group from t.integration.tasks import add, identity from t.smoke.tests.quorum_queues.conftest import RabbitMQManagementBroker class test_broker_configuration: def test_queue...
6374dba2abb382db8c390b17204a09f1692326f5bf9e742e9327ea5b9f9facfa
Python
1,669
57
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_...
6d8ebd5ff0ddba5ca962894b655739ae98d40203e96f81278f9a8c37bf5f1fcd
Python
1,669
44
__author__ = 'quentin' from ethoscope.hardware.interfaces.lynx_motion import SimpleLynxMotionInterface class SleepDepriverInterface(SimpleLynxMotionInterface): def send(self, channel, dt=350, margin=10): """ Sleep deprive an animal by rotating its tube. :param channel: The channel to use ...
d77b0b62007441730042e2b0aef916da3a6828f464922acc8e13c4ef2d4e6daf
Python
1,669
56
"""Remove unique constraint from role name, add not null constraint Revision ID: 9a5207190a4d Revises: a99a5b52ccb8 Create Date: 2024-10-08 14:08:28.418055 """ import logging from alembic import op from sqlalchemy import text from galaxy.model.database_object_names import build_index_name from galaxy.model.migrati...
8eda5429a73379a422b235e4946ecebb22e1040247d4463ceb0cfabb63000dd7
Python
1,670
59
import pytest import torch import torch.nn as nn from torch.autograd import Variable import pretrainedmodels as pm import pretrainedmodels.utils as utils # torch 1.0.x set_grad_enabled = getattr(torch.autograd, 'set_grad_enabled', None) pm_args = [] for model_name in pm.model_names: for pretrained in pm.pretraine...
b4de5dee0a68fd066083d74e0cdbf87045adbd42548c5af2049e8e60e0aa1c34
Python
1,670
47
from train_srgan import SRGenerator import mxnet as mx from mxnet.gluon.data.vision import transforms from matplotlib import pyplot as plt from gluoncv.utils import try_import_cv2 cv2 = try_import_cv2() from mxnet import image import argparse def parse_args(): parser = argparse.ArgumentParser(description='Test wit...
f5cfdb03f4a2959ff7aff9577ff8388b6718567526deb03b7b2428bf3ece5804
Python
1,670
49
"""nnsight bridge against the real nnsight package (no sys.modules fakes). A live ``LanguageModel.trace`` tracer exposes no mapping, ``to_dict()`` or ``nodes``; the bridge must refuse it typed instead of returning an empty payload, and must carry values the user saved with nnsight through unchanged. """ from __future...
131f15a2f69ae0b9ea6546d2bf9e1ccdae8cb3822fbf86982c25eb212e37f1ef
Python
1,671
65
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """Recommended tools for OpenBCI debugging. * PyCharm * ``install_debug_handler()`` defined in this file To connect to existing processes with PyCharm or Pyrasite you need to run is you have...
6c6189669afc6161d20a68d420d1fc13650439678f2f75dd5482b8cb4390d15f
Python
1,671
54
########################## # FreeCAD standard part library ######################### # download part data and generate classification by folder structure from __future__ import print_function, division import os import os.path from global_config import * MechanicalOnly = True # no electronics parts splittingFaste...
7c8b871f388bd40e8f19bd8722e05f12b2679cd92f3ee2012df65c7b15fb22cb
Python
1,671
58
# -*- coding: utf-8 -*- # @Author: gviejo # @Date: 2022-04-04 22:35:44 # @Last Modified by: gviejo # @Last Modified time: 2022-08-19 09:03:33 """Tests of neurosuite loader for `pynapple` package.""" import warnings import numpy as np import pandas as pd import pytest import pynapple as nap @pytest.mark.filter...
acd4c96685fc88991d73659079017a898ba0029e9d680bc5809d25200dd0db68
Python
1,671
58
from __future__ import annotations import os import pytest from pytest_celery import CeleryTestWorker, defaults from pytest_docker_tools import build, container, fxtr from celery import Celery from t.smoke.workers.dev import SmokeWorkerContainer class AltSmokeWorkerContainer(SmokeWorkerContainer): """Alternati...
01bc5f62922e96f6786cdfdad71eb36b2a965faee208c04a79908b9207d40dd4
Python
1,672
46
def find_pattern(sites, usable, skippable, pattern): """ Find the sites that match the pattern, where usable and skippable are boolean arrays indicating which sites are usable and skippable. The pattern is a string of A and D, where A means "acceptor" and D means "donor". The pattern must consist o...
3f3baca6ea86618a958f7538c033dc5f24b787c59f3b1af5dcb5448646f8045d
Python
1,672
43
"""Wrapper for transforming observations.""" from typing import Any, Callable import gym class TransformObservation(gym.ObservationWrapper): """Transform the observation via an arbitrary function :attr:`f`. The function :attr:`f` should be defined on the observation space of the base environment, ``env``, a...
24498accbf0a96b82daea27ff6a2c58c73813e2c5eb676b6ba4583e45c5c8eb2
Python
1,673
54
import json import re import matplotlib import numpy as np from matplotlib import pyplot as plt font = {'family' : 'Times', 'weight' : 'normal', 'size' : 12} matplotlib.rc('font', **font) with open("./storage/predictability_repeated_august19a.json", "r") as f: results = json.load(f) # remove en...
477c674d5b534bc6973fbc6e682c22619afb580a3bc4898b542bbee3fef7cb22
Python
1,673
64
"""Use one sticky hook recipe with replay and rerun. What this demonstrates ---------------------- Attach a hook once, replay over the saved graph, then rerun the original model with the same active intervention spec. How to run ---------- ``python examples/intervention/04_sticky_hooks_multiple_engines.py`` Runnable...
81b13a1e86304f715087e83521cab75d349c2bc5506001c16718765bed938f6b
Python
1,673
65
"""Compare three or more prompt variants in a Bundle. What this demonstrates ---------------------- Capture three tensor "prompt" variants, package them into one ``Bundle``, and compute both member-wise and joint metrics. How to run ---------- ``python examples/intervention/13_paired_prompt_3plus.py`` Runnable by de...
c377299159fd2717cdc69a8e265ac87449b9b367cb4d066bf53b0b6c6cbaa819
Python
1,673
47
import sqlite3 from .db import DB class CaseInformation(DB): def __init__(self): super().__init__() self.table_name = 'HR_case_info' self.table_desc = 'Haryana daily new cases, recoveries, deaths information' self.cols = self.getcolumns() def getcolumns(self): cols ...
df3a4f4c0c7901d378db00a9efade038ac652af1748105df18ac3682b8e39cc6
Python
1,673
46
"""Abstract class for TreeGrower Algorithms""" import abc import copy class AbstractAlgo: """TreeGrower abstract class""" # meta class is used to define other classes __metaclass__ = abc.ABCMeta def __init__(self, input_data, params, start_point, context): """TreeGrower Algorithm initializat...
f04e34da5d16a92881ee575550e8b547200dc6287c62d8ee1ccc6e1e2d6f53f8
Python
1,673
59
import re import numpy as np import pytest import gym.spaces def test_sample(): """Tests the sequence sampling works as expects and the errors are correctly raised.""" space = gym.spaces.Sequence(gym.spaces.Box(0, 1)) # Test integer mask length for length in range(4): sample = space.sample(...
96224f48e67830bc121df930e8167f25f38c0ce78f3ee698a32a7d56a3a948d4
Python
1,674
60
import numpy as np from neuron import gui from neuron import h # This checks the use of `diam` and `area` in MOD files. def check_morphology(sections): d2_expected = np.array([s(0.5).diam ** 2 for s in sections]) a2_expected = np.array([s(0.5).area() ** 2 for s in sections]) d2_actual = np.array([s(0.5)...
b2e1785a3aeeccc18cd0ff479c488cfad3c8c4d409c911f34b3635b63bfb9430
Python
1,674
43
import torch import torch.nn as nn from prodict import Prodict import utils class ICNet(nn.Module): def __init__(self, dims: Prodict, device=torch.device("cpu")) -> None: """The initial condition encoder module for TDNODE. Parameters ---------- dims : Prodict A diction...
c73744d606eb3456545035ab20de7c47a136b6d7d4318420f8fb9cc74133d631
Python
1,674
67
#!/usr/bin/env python """ Input: UniProt accession number(s) Output: uniprot protein sequence(s) Sept 2011 Xavier Lucas, Bjoern Gruening """ import argparse import subprocess import sys LIB_PATH = "/media/data/databases/uniprot/devided/" def parse_command_line(argv): parser = argparse.ArgumentParser() parser...
3ea8ac0cc3042f05f2462f583cdd316de219c471ca19bd8a3ce8232fa334e8d3
Python
1,675
42
from pyabf.abf2.section import Section class StringsSection(Section): """ Part of the ABF file contains long strings. Some of these can be broken apart into indexed strings. The first string is the only one which seems to contain useful information. This contains information like channel names, c...
3fc1baeeda12920f2f85827236317e8bfc61c63b2a4da6379c6b4ea531e158a6
Python
1,675
63
#!/usr/bin/env python3 # LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this so...
6a0248fa5129c0ff65d47b1a5baf894a6ce7abc46304d5a3360f8bd8de07c42d
Python
1,675
54
try: from anvilfs.anvilfs import AnVILFS except ImportError: AnVILFS = None from galaxy.files.models import ( BaseFileSourceConfiguration, BaseFileSourceTemplateConfiguration, FilesSourceRuntimeContext, ) from galaxy.util.config_templates import TemplateExpansion from ._pyfilesystem2 import PyFiles...
09323ec8a4d9683f781166c1c67e256309ecd3d08508c8fa9825af4ba6a3b6bb
Python
1,676
52
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ MAF on cartesian coordinates using a neural spline transformer. """ # ========================================...
32e0f065198fc2a22c36fe2b9ff7748e5def8c1d65512cc6cb5411145a5c72ab
Python
1,676
62
'''Tests for bdpy.ml''' import unittest import numpy as np from bdpy.ml import regress class TestRegress(unittest.TestCase): '''Tests for 'ml.regress' module''' def test_add_bias_default(self): '''Test of bdpy.ml.regress.add_bias (default: axis=0)''' x = np.array([[100, 110, 120], ...
37a943770d44df64b3e3e9cddeb9fe524dc102d60799878e21fab54c2cf1d31e
Python
1,676
46
import glob import os import json experiment_dir = "../../../storage/experiments/" experiment_group_inclusion_filters = { # all filters are "only if in" filters, i.e. if the experiment has any of the values in the filter, it will be # included, otherwise it will be excluded "group_one": { "archit...
7f56f89daf57c86cf21fe7d41afca5865571b0728dfd259debe530fa5c9ca7f3
Python
1,676
55
import os import importlib import glob def find_launcher_using_name(launcher_name): # cur_dir = os.path.dirname(os.path.abspath(__file__)) # pythonfiles = glob.glob(cur_dir + '/**/*.py') launcher_filename = "experiments.{}_launcher".format(launcher_name) launcherlib = importlib.import_module(launcher_...
980c2cde05688b32b37dd49a9ee3e5f74e8fc7fafcb607c21e9a07702d38205e
Python
1,676
62
from database import ( ImageModel, TaskModel, DatasetModel ) from celery import shared_task from ..socket import create_socket from .thumbnails import thumbnail_generate_single_image import os @shared_task def scan_dataset(task_id, dataset_id): task = TaskModel.objects.get(id=task_id) dataset =...
c86028d135ee52a02abb1301dbe020c20bfb97cabff6fcb029b965e2551bb655
Python
1,676
62
#!/usr/bin/env python3 f_1 = open("isoform_TPM_withAnnotation.txt", "r", encoding = "utf-8") o_1 = open("isoform_proportion_individual.txt", "w", encoding = "utf-8") i = 0 for file_1 in f_1: line_1 = file_1.strip().split('\t') if i != 0: percent_C = [] if line_1[len(line_1) - 2] == "1": ...
f44c2087e58d89708b7cc21c25cd72d04ff2a0fed0e91ba130a22fdf489e8dde
Python
1,676
59
import numpy as np from gym import utils from gym.envs.mujoco import MuJocoPyEnv from gym.spaces import Box class SwimmerEnv(MuJocoPyEnv, utils.EzPickle): metadata = { "render_modes": [ "human", "rgb_array", "depth_array", ], "render_fps": 25, } ...
34bd02fd21eb797a72314faec2ae69fca8120aae57bb57595c46f86d6e9945e7
Python
1,677
52
""" Data Structures used to represented molecules for convolutions. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import re __author__ = "Qingyuan Feng" __copyright__ = "Copyright 2018, Simon Fraser University" __license__ = "MIT" class Protein(ob...
681b4d05785c5f20323df5cc87695c25844f7551e3a33ce42949433402802a9b
Python
1,677
48
import pickle def run(): from spitfire.time.integrator import odesolve from spitfire.time.methods import RK4ClassicalS4P4 import numpy as np def right_hand_side(c, k_ab, k_bc): """ Computes the right-hand side function for the ODE system. Note that time integration requires a...