sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5f0322696b3437520bd4c106c07897c003ddbf0fa9cbd7c781dda10296753faa
Python
1,371
56
import os import shutil class models_genesis_config: model = "Unet3D" suffix = "genesis_chest_ct" exp_name = model + "-" + suffix # data data = "/mnt/dataset/shared/zongwei/LUNA16/Self_Learning_Cubes" train_fold=[0,1,2,3,4] valid_fold=[5,6] test_fold=[7,8,9] hu_min = -1000.0 ...
f6037e98820db072fa82c025b857313bd5228872f50682e0657245b1e3cc6d96
Python
1,371
38
import os import subprocess from tests.conftest import FIRST_LINE_MODEL_PATH, MIC_PLATES_PATH, DRUG_NAME, PROJECT_ROOT, TARGET_MIC_CSV import csv import pytest from os import path @pytest.mark.assets_required def test_main(tmp_path): d = tmp_path / "predictions" d.mkdir() env = os.environ.copy() env[...
03047a5a13c75d4e0a37ee6320025729256108e85a552cdd529a1319a01243bc
Python
1,374
51
import numpy as np import pandas as pd import time import datetime def remove_non_expressed(df: pd.DataFrame, verbose: bool=False): """ Identifies and removes genes with mean 0 from the dataframe, i.e. non-expressed genes. Parameters ---------- df : DataFrame Gene expression data, ...
66f8b0e0f4aee4da973bfd954f413de231a85037a629e9a0043c2838e3966fd0
Python
1,374
30
import numpy as np import pandas as pd import pytest from pyaging.preprocess import _preprocess def test_bigwig_signals_and_missing_regions_keep_input_order(monkeypatch, tmp_path): pybigwig = pytest.importorskip("pyBigWig") path = tmp_path / "sample.bw" with pybigwig.open(str(path), "w") as bw: b...
707561a7f3f4ed9a37f6dbc8f6570eebe7c2bcf5d21b6a865758f0d393e07176
Python
1,374
46
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import torch class Normalizer(object): """Normalize a Tensor and restore it later.""" def __init__(self, tensor=None, mean=None, s...
91404e328cfcccf1683cd3f717d5c9d6f0fabe25f6247907d273288c014b0a48
Python
1,374
44
import numpy as np import pandas as pd import pandas._testing as tm class TestJoin: def test_append_join_nondatetimeindex(self): rng = pd.timedelta_range("1 days", periods=10) idx = pd.Index(["a", "b", "c", "d"]) result = rng.append(idx) assert isinstance(result[0], pd.Timedelta)...
315143245cb500362f68c15416862062953dcb25d3d091d885f8007681130d97
Python
1,375
42
import dask.dataframe import pandas as pd import os def concat_path_elements_to_filelist(*args): '''e.g. args = ['str', [1,2,3], pd.Series([1,2,3])] > [['str', 'str', 'str'], [1, 2, 3], [1, 2, 3]] ''' if not args: return [] args = [[arg] if isinstance(arg, (str, int, float)) else...
8a896351264ba6044a75bf9ccb209bc381187f7405a1631cd4d9a604b60872d7
Python
1,375
39
import importlib import os from PyQt5.QtWidgets import QMessageBox from .DropDownMenu import DropDownMenu class SelectPKLFile(DropDownMenu): """ A dropdown menu widget specifically designed for selecting .pkl files. """ def __init__(self, default_msg, normative_model_ids): """ Initial...
c0596e8dd4cfcdd8c1983a7c57180612399005b027a628392870f7ab39a71e78
Python
1,375
48
import numpy as np import scipy.stats as stats def factorize_normal(samples, freedom=1) -> tuple[float, float]: mu, sigma = stats.norm.fit(samples) return (mu, sigma * freedom) def factorize_halfnormal(samples, freedom=1) -> tuple[float]: loc, scale = stats.halfnorm.fit(samples) return (scale * fre...
0e4db88d4babe6957abdd023e01a9c8ac0593d75210c433e4f836c58eb385a5b
Python
1,376
50
import sys import glob import pandas as pd import numpy as np import h5py file_list = sys.argv[2:] print(file_list) LABEL = 'Sample_characteristics_ch1' total_data = pd.DataFrame() for ff in file_list: data = pd.read_csv(ff, sep='\t', index_col=6) total_data = total_data.append(data) print(total_data.sh...
8b6755098393cfa4f54290b7672306c999ef071ad518cd66c8faecb11e0109de
Python
1,378
45
from typing import List, Optional, Union import numpy as np import scipy.signal import scipy.interpolate def _findFirstPeak(signal: np.ndarray, minHeight: float = 0.3, prominence: float = 0.05) -> Optional[int]: peaks, _ = scipy.signal.find_peaks(signal, prominence=prominence, height=minHeight) if len(peaks)...
046f1127da9899a30271a54be55ff96393594390d6db0c09f0314b2654e19a01
Python
1,379
32
#! /usr/bin/env python ############################################################################## ## DendroPy Phylogenetic Computing Library. ## ## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder. ## All rights reserved. ## ## See "LICENSE.rst" for terms and conditions of usage. ## ## If you use this wo...
3ba3d7dab4582f2828f79554b72f48e24c488dc141b3efc8c01fbdeb93770408
Python
1,381
38
# Copyright 2018-2025 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or...
9e6456f1b395f1be3431dd27fde24c38a85504aa2e4a5097b4c86682453f583f
Python
1,383
26
# please install abagen in terminal first # by running the following: # pip install brainsmash # import numpy import pandas as pd from brainsmash.mapgen.base import Base # input data # brain map a one-dimensional scalar vector (Nx1, N = number of regions) brain_map_file = "Y:\\projects\\jinliu5\\2021_Lon...
0bbf29d0f083f73a3473fc5e414f26db617a69d1b8a886d59f8acb6aa9ac096a
Python
1,384
39
"""Varimax rotation.""" import torch from einops import rearrange def varimax(phi: torch.Tensor, gamma: float = 1.0, n_iterations: int = 20) -> torch.Tensor: """Apply an orthogonal Varimax rotation. Parameters ---------- phi Input matrix of shape `(*batch, n_components, n_channels)`. ...
53bfaf657bd23909e03fe07e3f8f186e44cc67b0a83078486a40b8b0cc6aba99
Python
1,384
40
from .spaciotemporal_binning import time_list_from_pd import pandas as pd import numpy as np import dask.dataframe as dd import dask import compatibility from .temporal_binning import universal as temporal_binning def spatial_binning(sa, min_time = 0, max_time = 245+50, ...
6b7242a2af66ddcd5d85ea2ae4e57128d5c6bf308aeb879b2b3985705a2bdff8
Python
1,384
46
import numpy as np from modules import ( normalisation, transformations, transformation_utils, ) class BaseImageArrayNormalisation(normalisation.Normalisation): def apply_normalisation(self) -> np.ndarray: """ Apply the normalisation and store the relevant values for inver...
96ba0f6bf6bb507ca6ecbc1cb46fc2461d198b86f070f9e948a9e96b60f4a9d6
Python
1,384
36
import pandas as pd import numpy as np pheno_type = "multresp" zmat_file_orig = f"zmat/{pheno_type}_orig_zmat_201217.csv.gz" zmat_file_perm = f"zmat/{pheno_type}_perm_zmat_201217.csv.gz" out_file_orig = f"zmat/{pheno_type}_orig_zmat_201217.filtered.csv.gz" out_file_perm = f"zmat/{pheno_type}_perm_zmat_201217.filtered....
9b55730fe056d2c3d8d8a1a6b7b07670e553fc949791ef355fa163e93fd9b49e
Python
1,384
36
import tensorflow as tf from tensorflow.keras import layers def double_conv_block(x, n_filters): x = layers.Conv2D(n_filters, 3, padding = "same", activation = "relu", kernel_initializer = "he_normal")(x) x = layers.Conv2D(n_filters, 3, padding = "same", activation = "relu", kernel_initializer = "he_normal"...
9bddf3d8dc15cce80c25b2b7da8133df19669a551b027c62448a8c1f720e75e2
Python
1,384
41
# Copyright 2018-2023 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or...
7bff4d169fbcd165219544ff2a5d7b3ad8558959d6bba136850be5109d31c0ad
Python
1,385
69
#!/usr/bin/env python # -*- coding: utf-8 -*- # JN 2016-01-22 """ Create a csv file containing downsampling information from all channels """ from __future__ import print_function, division, absolute_import import os import tables import csv FNAME_OUT = 'h5meta.txt' def to_file(msg, outname): """ write h5in...
fccc9cf1445f22e0339d28950204d611a44170d7ae2df32058c5ec7b2866dd86
Python
1,385
52
import sys import numpy as np, pandas as pd from matplotlib import pyplot as plt from matplotlib import colors from matplotlib import figure CLONE_MAT = str(sys.argv[1]) + '.csv' CLONE_NPY = str(sys.argv[1]) + '.npy' CELL_BCS = str(sys.argv[2]) DATASET = str(sys.argv[3]) + '.csv' # load csv file as pandas and nump...
eba66a7e4e4a4c30624cd9e4e7eee4ed5fd4a78687b0e4b7d3f78f329d40b83f
Python
1,386
43
# -*- coding: utf-8 -*- """ Created on Wed Jun 21 20:21:56 2023 Convolutional Spiking Neural Networks for Intent Detection Based on Anticipatory Brain Potentials Using Electroencephalogram Authors: Nathan Lutes, V. S. S. Nadendla, K. Krishnamurthy """ def main(): #this function defines the paths for data loading...
cfa53b7e6d7a0e578f1391469ce8707808f6009d3b3fc972ca316cb77e0b0644
Python
1,388
49
import sys import re import storestate UNKCOUNT = int(sys.argv[1]) WordCount = { } for line in open(sys.argv[2]): count,word = line.split() WordCount[word] = int(count) for line in sys.stdin: wordlist = re.findall('(?<= )[^\(\) ]+',line) for word in wordlist: ## if word not in WordCount: ## sys.std...
52bb3d03559f5c2596869728e8f0effb91f1fade11349e83ebdcedf3efd76923
Python
1,390
41
# # Program to write Clebsch Gordan coefficients to text file # print('Program starting') import os import numpy as np #from tensorfieldnetworks.utils import FLOAT_TYPE import protein_holography.network.clebsch as clebsch cutoff_l = 10 print('Gathering cg coefficients') # here we implement the Clebsch Gordan coe...
a19aa06b6f0f45fd2243e670e9f2facecf4525ae1f5186554ee4d7027837f911
Python
1,390
43
import os import time import concurrent.futures import json # 该函数用于检查反编译后没有samli文件的apk,没有smali文件的apk就记为废物样本 path = r'E:\pythonProject\Experiment\out_benign_samples' allapkfiles = os.listdir(path) def check(apkfilename): abspath = os.path.join(path, apkfilename) files = os.listdir(abspath) if "...
e6c7fe1e9ca6c87f2232b51afa67bd5911f2f356fedeee66d2c37986559669c3
Python
1,394
61
"""Analysis procedure registry + dispatcher.""" from __future__ import annotations from typing import Any, Callable import pandas as pd from pycaret_server.analyses.base import ( AnalysisProcedureError, AnalysisResult, ) from pycaret_server.analyses.procedures import ( run_anova_oneway, run_arima, ...
309e7220474b95940d245f1c25ed6d2ae4ef8364553aff3f7ca41e23ccf885fa
Python
1,396
51
#!/usr/bin/env python3 """ Script to check md5 of files on S3. """ import argparse import boto3 import hashlib def main(): parser = argparse.ArgumentParser() parser.add_argument('-m', '--md5-file', dest = 'md5_file') parser.add_argument('-p', '--s3_prefix', ...
a2628109cc350df582783caaffd20297e868cadaef5e5ee8cc383f14522569c8
Python
1,399
35
#! /usr/bin/env python import argparse from os import mkdir,listdir from shutil import copyfile from os.path import exists,splitext,normpath,join def main(): parser = argparse.ArgumentParser() parser.add_argument("-i","--indir",required=True,help="Input folder which contains all trees and alignments") par...
60fc1765d44150f50907371b84c371aa7dc12db55e48abac9d86d3c30acce88c
Python
1,400
56
# JN 2016-05-12 """ Setup options.py with the correct clustering binaries """ from __future__ import print_function import os import sys import subprocess OPT_PATH = os.path.join('combinato', 'options.py') DEF_OPT_PATH = os.path.join('combinato', 'default_options.py') def setup(): if os.path.isfile(OPT_PATH): ...
f1f73fda6f2dc92d0abaf8ef829748b0f760742c59bf77d9c346f0c52bcf3ebc
Python
1,400
54
import matplotlib.pyplot as plt import numpy as np import pandas as pd import sys import matplotlib.ticker as ticker import matplotlib.transforms as transforms from pathlib import Path from statistics import mean, stdev import math import sys import argparse sys.path.append('../') from plotting_functions import * #...
c63c1855eabca79923b3dcae9acb2c29c981a80261e6fbc74b78b0fc1af939c0
Python
1,401
62
from scipy.integrate import solve_ivp from scipy.io import loadmat import numpy as np from time import time class P: field_locs = None field_sizes = None disc_step = None Iloc = None W = None I = None v = None tau = None T = None dt = None n = None def run_cont(t, v, p):...
6d89b0bea5a669fe7fedab54d2c19c7a4ed1784546e4b202ddffdb9e89d7635a
Python
1,402
58
from subprocess import run from argparse import ArgumentParser from pathlib import Path import os def cli(): cwd = os.getcwd() parser = ArgumentParser() parser.add_argument( "--data", default=Path(f"{cwd}/../data/norbelladine_4OMTase/boxes/4OMTase_dataset.pkl"), type=Path, ) ...
d310b283f72eaf9056e8f98cae5ec9216131f7e891320c4f01a0e4cad75f9768
Python
1,402
40
class ObjectFactory: """General-purpose class to instantiate some other base class from rl_games. Usual use case it to instantiate algos, players etc. The ObjectFactory class is used to dynamically create any other object using a builder function (typically a lambda function). """ def __init__(self):...
397883d65e72a49cd17ea32c0ff5799897260a66e5f01ce7a6cb742d039d8d05
Python
1,403
43
"""Heads that produce (x, y) predictions for coordinate regression.""" import torch from jaxtyping import Float from torch import nn # to ignore imports for sphinx-autoapidoc __all__: list[str] = [] class LinearRegressionHead(nn.Module): """Linear regression head that converts 2D feature maps to a vector of (x,...
310f6465383ffdfff9f2dc0bc40890158637c9b3755fe5e745f0f0b2eded47d9
Python
1,404
56
import datetime import numpy as np import pytest from pandas._libs.tslibs import ( Resolution, get_resolution, ) from pandas._libs.tslibs.dtypes import NpyDatetimeUnit def test_get_resolution_nano(): # don't return the fallback RESO_DAY arr = np.array([1], dtype=np.int64) res = get_resolution(ar...
822101ef211a76d2dd934a46d25ec0b7c760d0177559a6081cd48757f166692c
Python
1,404
34
#! /usr/bin/env python ############################################################################## ## DendroPy Phylogenetic Computing Library. ## ## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder. ## All rights reserved. ## ## See "LICENSE.rst" for terms and conditions of usage. ## ## If you use this wo...
684e04bb10898b2bffb6f47c730b808bc7c9422fd44f92992008196f4807924a
Python
1,405
47
#!/usr/bin/env python import torch from torch.utils.data import DataLoader from rdkit import Chem from rdkit import rdBase import data_struct as ds from data_struct import MolData, Vocabulary from model import RNN import sys def Sample(filename, enumerate_number): voc = Vocabulary(init_from_file="./Voc") P...
19cf751381513a7148cfe4b7493efa693bd653e1a38b7ffe13af4d3773a9e0c2
Python
1,406
39
# coding: utf-8 get_ipython().run_line_magic('cd', 'proboscis_utils') get_ipython().run_line_magic('ls', '') #get_ipython().run_line_magic('runfile("test_proboscis_model.py")', '') #runfile #get_ipython().system('runfile') get_ipython().run_line_magic('cat', 'test_proboscis_model.py') import test_proboscis_model as pro...
d05d04684bdb568623496ad7bca58785795b31b006e1f8dd7cde8a61c1ad8eb9
Python
1,406
44
import os import numpy as np import string from typing import Iterable def parse_a3m(filename): seqs = [] table = str.maketrans(dict.fromkeys(string.ascii_lowercase)) # read file line by line for line in open(filename,"r"): # skip labels if line[0] != '>': # remove lowercas...
e5096bd5837c3e8c56a2db1eb8395c8745a6192c607f38dd6babcbc8ab1b708f
Python
1,406
38
''' Created on Sep 16, 2016 @author: arco ''' from model_data_base.plotfunctions._decorators import dask_to_pandas, subsequent_calls_per_line, return_figure_or_axis @dask_to_pandas @return_figure_or_axis #has to stand above subsequent_calls_per_line @subsequent_calls_per_line def average_std(mean, std, ...
e47f7941266e24a0798573fa40394695877ca052addb3236947d1e473981f8d5
Python
1,408
49
import numpy as np import pytest import pandas as pd import pandas._testing as tm from pandas.tests.copy_view.util import get_array @pytest.mark.parametrize( "cons", [ lambda x: pd.TimedeltaIndex(x), lambda x: pd.TimedeltaIndex(pd.TimedeltaIndex(x)), ], ) def test_timedeltaindex(cons): ...
c5c5e34d3942d4f52be9ec9211ca01d29409ff7d406eda226be0a3da30ea4994
Python
1,412
37
""" Miscellaneous util functions """ import random import string def _generate_random_code(length=10, seed=None): """Generate random alphanumerical code, starting with a letter for proper sorting in file browsers. :param length: specifies length of random string, defaults to 10 :type length: int :par...
760464f1516bbe160881967ee44f94dedb31b24960533e0c9a4314e56ad36600
Python
1,413
53
#from pymatgen import MPRester from pymatgen.ext.matproj import MPRester from pymatgen.io.cif import CifWriter import csv import sys import os print('start') ###need 2 files: csv containing materials project IDs and atom_init.json (generic) ###get API key from materials project login dashboard online API...
0b1c7733f1cbe4050f631ad8e581e76388c5f0ae1bd2a7aaf29421136c855c81
Python
1,414
71
import pytest from src.config_handler import read_yaml, get_entry from pathlib import Path @pytest.fixture def pipe_config(): return { 'pipeline-test': { 'descr': 'Test Pipeline', 'steps': [ { 'name': 'scaler' }, { ...
cabb637bddd686cb64426eaaca7464907e13d05791726cac31027a4d4f476919
Python
1,414
33
from isaacgymenvs.pbt.launcher.run_description import ParamGrid, RunDescription, Experiment from isaacgymenvs.pbt.experiments.run_utils import version, default_num_frames kuka_env = 'allegro_kuka' _frames = default_num_frames _pbt_num_policies = 8 _name = f'{kuka_env}_{version}_pbt_{_pbt_num_policies}p' _wandb_acti...
087aac9b31928fd3a80e5a5bbaaf11ec7f5201789b713ee64428616a5853c64f
Python
1,415
36
"""Ellipse phantom for testing.""" import torch from mrpro.phantoms import EllipseParameters, EllipsePhantom class EllipsePhantomTestData: """Create ellipse phantom for testing. Parameters ---------- n_y number of voxels along y n_x number of voxels along x """ def __ini...
3de3cafe1c81c7e346bea851a2307037eb5e28ed010a0059cf9d3b76e345bb3f
Python
1,416
50
import os import shutil import pytest from pcntoolkit.dataio.norm_data import NormData from pcntoolkit.normative_model import NormativeModel from pcntoolkit.regression_model.test_model import TestModel from test.fixtures.norm_data_fixtures import * from test.fixtures.path_fixtures import * @pytest.fixture def test_...
e7b11786515250d79f33eb9705ac66a6d97a9f2f54a2a8d2fb7292fa19f860c8
Python
1,417
51
# JN 2015-01-11 # refactoring from __future__ import division, print_function, absolute_import import logging import numpy as np import scipy.stats as stats from .. import options logger = logging.getLogger(__name__) def select_features(features): """ select the features that go into sorting """ fact...
a20379d5ea31dbbe767bbd1603eb44e0b5b6be5005b581f492e7216e4ebc0aae
Python
1,418
33
from subprocess import check_output # Hyper-parameters table = "bow_tuning" # target = "dspln_PSYCHIATRY_12" target = "dspln_SOCIALWORK_12" max_tokens = [5000] # 1000 # c_s = [0.1, 0.2, 0.3, 0.5] # c_s = [0.6, 0.7, 0.8, 0.9, 1] # c_s = [1, 3, 5, 10, 100] # c_s = [0.1, 0.5, 0.7, 0.8, 0.9, 1, 1.1, 3, 5, 10] # c_s = [0....
cee35a829e9ad0b29f230b8f6df7eec42034afb4cf0377da9e3568aa1d766d3d
Python
1,418
55
import time class Timer(object): """docstring for Timer""" def __init__(self, class_name=[]): super(Timer, self).__init__() self.duration = {} self.start_time = {} self.names=[] for name in class_name: self.duration[name] = 0.0 self.start...
74bbd9234dfdf7f6a3575722fd16338d2b4c8f7952cfeb2ec3269db2c91b1ce2
Python
1,419
55
# -*- coding: utf-8 -*- #Author: https://pamelaguevara.icb.udec.cl/grupo-imagenes-medicas/ #from soma import aims import numpy as N import os import shutil import math #from soma import aims def read_bundle( infile ): points = [] bun_file = infile + 'data' os.path.getsize( bun_file ) bytes = os.path.getsiz...
79485a1dc76d53930dfd9a433ce9fbae3708b3b611bd95ee1513ce8db64265cc
Python
1,419
45
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Analysis of the power spectral density of the ROI time series: calculate PSD and export. Vinding, M. C., Eriksson, A., Low, C. M. T., Waldthaler, J., Ferreira, D., Ingvar, M., Svenningsson, P., & Lundqvist, D. (2021). Different features of the cortical sensorimotor rh...
097880cee21ac659f6c58d28747c3b500c41a1d49f0747cc71c4c8343ac21448
Python
1,420
49
"""Tests for Phase Operator.""" import pytest import torch from mrpro.operators import PhaseOp from mrpro.utils import RandomGenerator from tests import autodiff_test def test_phase_operator_forward(): """Test that PhaseOp returns angle of tensors.""" rng = RandomGenerator(seed=2) a = rng.complex64_tens...
09f3e86b6f6902c37f13e77f5b357eb5f05ace24cdc5b03c88a74afd9813fd76
Python
1,420
39
import unittest import torch from scipy.spatial.transform import Rotation import numpy as np class TestCaseNeSVoR(unittest.TestCase): @staticmethod def assert_tensor_close(*args, **kwargs): torch.testing.assert_close(*args, **kwargs) @staticmethod def assert_tensor_equal(*args, **kwargs): ...
e557decd9cf64821cacd56f23b847fa9111e9bfb1c61af895e4b6e98bf0da2ac
Python
1,420
43
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and relat...
f28181d957e88d4261670b0970318ef6223d4c7434673d38d4cbbbf655e7d8a0
Python
1,421
50
import numpy as np import sys def namesort(nameSet): sort_name = [] for sta in ['HAFStastic','safe','kappa','phi','dihhStastic',\ 'ihsStastic','nslStastic','sfsStastic','allelFrebaseStastic','hapFrebaseStastic']: for name in nameSet: if name.endswith(sta): ...
74c30fd96f0dadf79c74bc85055c22dbb02dc2691581ab4b2973df0d328381b0
Python
1,422
53
import sys import argparse class FQRecord: def __init__(self): self.seq = "" self.qual = "" self.anno = "" self.name = "" def string(self): ret = "@" + self.name.strip() + "\n" + \ self.seq + "\n" + \ "+" + self.anno + "\n" + \ self.qual ...
a0a13f8af76b99a65d960f38c51c18007afd19504e46d132f477e706bae29787
Python
1,423
53
# flake8: noqa """phy: interactive visualization and manual spike sorting of large-scale ephys data.""" # ------------------------------------------------------------------------------ # Imports # ------------------------------------------------------------------------------ import atexit import logging import os.p...
95771833ded13ee0c4e9a26cf7024d24ca479e43f10ba4f23ea557b576e906ba
Python
1,424
44
import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm class TestDataFrameReindexLike: def test_reindex_like(self, float_frame): other = float_frame.reindex(index=float_frame.index[:10], columns=["C", "B"]) tm.assert_frame_equa...
08133a4cb52cb42255d1f1ed56e12181396898344faa9990cf8b7353ef86c3ac
Python
1,425
46
""" Implements logging functions throughout ScanOMetrics package """ from os import EX_USAGE # "command used incorrectly" exit code from sys import exit __VERBOSE_LEVEL__ = 0 def set_verbose(verbose): """Set global verbose level. :param verbose: verbose level (0: hide everything, 1: warning/errors, 2: note...
0ce97b804235bce563c12e5f902018500ba6c2e3949216561af5e9a5c9119506
Python
1,425
44
import numpy as np import pandas as pd import pandas._testing as tm class TestWhere: def test_where_intlike_str_doesnt_cast_ints(self): idx = pd.Index(range(3)) mask = np.array([True, False, True]) res = idx.where(mask, "2") expected = pd.Index([0, "2", 2]) tm.assert_index...
bb2da70d64ffd951ca05d1e43cb018791616bb94c14d511295be59701c9ffac2
Python
1,425
51
# -*- coding: utf-8 -*- """ Created on Mon Jul 25 12:09:14 2022 @author: jeanbaptiste """ import time import json import sys sys.path.insert(0, "/projectnb/dunlop/JB/deepcellcontrol") import deepcellcontrol as dcc models_folder = "/projectnb/dunlop/JB/deepcellcontrol/assets/models/" # model_folder = models_folder+"...
ea5b237c0599b58a53ada2a3f9cb6db214ea656fbb802a00c342f31111e41e7d
Python
1,425
44
import numpy as np import pandas as pd mask2index = lambda mask: np.flatnonzero(mask) def index2mask(idx_arr, n): mask = np.zeros(n, dtype=int) mask[idx_arr] = 1 return mask.astype(np.bool) def np_groupby(arr, groups): """Numpy implementation of `groupby` operation (a common method in pandas). ...
aedd7f4a7ec8b77c5cc068af5f820168727c0d3518b77d94ca7420358473ab5d
Python
1,426
61
__all__ = [ "RetentionTimeLibraryBase", "IndicesNonSlice", "Indices", "Columns", ] import abc from typing import List, Optional, Union import numpy as np import numpy.typing as npt import pandas as pd IndicesNonSlice = Union[List[int], npt.NDArray[np.int_], "pd.Series[int]"] Indices = Union[slice, In...
d61b9b4561a72a7ddb88d43fc46474b9efdd0ac4c7fd18c822819a58339541d8
Python
1,426
54
# -*- coding: utf-8 -*- import numpy as np import pytest from emcee.autocorr import AutocorrError, integrated_time def get_chain(seed=1234, ndim=3, N=100000): np.random.seed(seed) a = 0.9 x = np.empty((N, ndim)) x[0] = np.zeros(ndim) for i in range(1, N): x[i] = x[i - 1] * a + np.random....
12769ee2e73e43bcfbc97658db3bf541d0da7e6f7fad04b6ca8c0b9f499407f6
Python
1,429
41
import numpy as np import pandas as pd import pandas._testing as tm class TestFactorize: def test_factorize_period(self): idx1 = pd.PeriodIndex( ["2014-01", "2014-01", "2014-02", "2014-02", "2014-03", "2014-03"], freq="M", ) exp_arr = np.array([0, 0, 1, 1, 2, 2], ...
8b4666a3760ff466ae0849c440b552f57b75709f22cf8cc96c3f2e72dd089215
Python
1,429
38
import numpy as np import pandas as pd import pandas._testing as tm def test_isocalendar_returns_correct_values_close_to_new_year_with_tz(): # GH#6538: Check that DatetimeIndex and its TimeStamp elements # return the same weekofyear accessor close to new year w/ tz dates = ["2013/12/29", "2013/12/30", "2...
4b419340e6966aea8e90621cb137330da54e044be0fbfd9857f46111d35e2498
Python
1,430
40
import os, sys import pickle import apnet import argparse import pandas as pd import numpy as np parser = argparse.ArgumentParser(description='Train single model with provided train and test set') # Mandatory arguments parser.add_argument('validation_path', help='[string] Path to validation pkl file') parser.add_arg...
47481b1d55c7c61a3ebe4c538ab0bada6663097a823f373df3ca999ddc58a3a9
Python
1,431
44
""" Chromosight's kernel submodule contains each default kernel in the form of a dictionary whith the kernel name. The items of the dictionaries are the key-value pairs from the kernel's json file, with the kernel matrices pre-loaded under the "kernels" key. Here is the kernel submodule can be used to extract the first...
651dee8a7abba16e7763aabf006da7a8d2f11c0f8815b607128d15dcfc804bf7
Python
1,434
56
import os import torch import torch.nn as nn import numpy as np import torch.nn.functional as F import matplotlib.pyplot as plt plt.style.use('ggplot') from src.models import TemporalPC from src.utils import * from src.get_data import * device = "cuda" if torch.cuda.is_available() else "cpu" print(device) result_path...
a6bfa1bba037f2ef7e760a8f814795133eb3cc65fd4f660d49fc0634ab632e3b
Python
1,435
45
from typing import Union import pandas as pd from deepglyco.chem.gpep.glycans import GlycanNode from deepglyco.chem.gpep.nglycans import NGlycan glycans = pd.read_csv(r"D:\GlycoDIA\data\background_glycan.txt", header=None) glycans.columns = ["original_struct"] def generate_entrapment_glycan(glycan: str): new_g...
fc060695b5cddc8e6f8d872b7caa5bbdab928473d9d347a1bd44e4acbfa585dd
Python
1,435
60
#!/usr/bin/env python ''' Testcases for the KwargsParser ''' from windseer.utils import KwargsParser import unittest class TestKwargsParser(unittest.TestCase): def run_case(self, type, default_value, use_name=False): kwargs = { bool.__name__: True, int.__name__: 1, f...
2973a4bf3d74e55ba04a6880e6df3a71d68a4f6239ab7dee0e5a1dc62d37bb6b
Python
1,438
55
# importing os module import os directory = os.getcwd() for count, mapname in enumerate(os.listdir(directory)): directory2 = directory+"/"+mapname if mapname == '.DS_Store': continue if mapname == 'LICENSE': continue if mapname == 'README.md': continue if mapname == 'ren...
d955cf46987d8f3ba849eb1dccfbd11c764cb24687248dfa5de9475d93c89f7c
Python
1,438
48
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 23 10:57:50 2023 @author: tomas """ import glob from cine import Cine import meniscus_rate as mr import tube2 import numpy as np import pathlib from skimage.io import imsave import pandas as pd if __name__ == '__main__': videonames = glob.glo...
380ccf8af95c5b412c6817f6e413cbe4e5601df66e341b4e800512526f037ac0
Python
1,443
42
from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm class TestFillNA: def test_fillna_period(self): # GH#11343 idx = pd.PeriodIndex(["2011-01-01 09:00", pd.NaT, "2011-01-01 11:00"], freq="h") exp = pd.PeriodIndex( ["2011-01-01 09:00", "20...
2c747cf859aa1f83d9cd99be0f4a45f107c9b987b8afe580f59ced131577a684
Python
1,444
41
import pytest import pandas as pd import pandas._testing as tm class TestPickle: def test_pickle(self, temp_file): # GH#4606 idx = pd.to_datetime(["2013-01-01", pd.NaT, "2014-01-06"]) idx_p = tm.round_trip_pickle(idx, temp_file) assert idx_p[0] == idx[0] assert idx_p[1] is...
76ab33bfa73a7f447a6db9b086eeec33cc0bcb64a1242d7ab0ec1ce7441f7cd1
Python
1,444
36
#! /usr/bin/env python ############################################################################## ## DendroPy Phylogenetic Computing Library. ## ## Copyright 2010-2015 Jeet Sukumaran and Mark T. Holder. ## All rights reserved. ## ## See "LICENSE.rst" for terms and conditions of usage. ## ## If you use this wo...
33276d5f13464262b4fb4a541a45ffa4243bac1e324f7dd43ab5f35d374e7543
Python
1,445
54
""" vision.py Created March 2, 2021 Contains all general methods for image processing. (Try to keep all the ugly cv2 calls in here.) """ from ecgdigitize.image import BinaryImage, GrayscaleImage import math from typing import List, Tuple import cv2 import numpy as np def houghLines(binary: BinaryImage, threshold: i...
e5fe62a79bd3328c458f41ac8b4419034944c6b22e032b0bd739997461d9ee5a
Python
1,446
43
# coding: utf-8 """ Tests write output (should it return True or False or write) """ from atropos.commands.trim.filters import ( NContentFilter, DISCARD, KEEP, SingleWrapper, PairedWrapper ) from atropos.io.seqio import Sequence def test_ncontentfilter(): # third parameter is True if read should be discarded ...
f7b1f8da773e48b91afaca7cd0b64fbf2100ba841cf3c538efb2cdb75549f064
Python
1,446
51
import numpy as np from numpy.linalg import slogdet, inv class SymmetrizedKullbackLeiblerDivergenceGaussians(object): name = "sKLD_Gaussians" """ sKLD = 0.5 ( KL(p || q) + KL(q || p) ) """ def __init__(self, cov1, cov2, mean1, mean2): """ :param cov1: Covariance of Gaussian p1()...
294f9b54667c1f3e8de9b9fc4e67bf569de833ee81e1ffef7c136a22a522ccb3
Python
1,447
46
"""Regression test for the legacy SIMS checkpoint format. The shipped sims_app/checkpoint/*.ckpt files were trained against scsims 3.x. v4 must be able to load them unchanged. This test is *skipped* in CI (the .ckpt files are huge and live in a separate repo) but can be run locally to verify legacy compatibility. Run...
1e245d406ba5bea56c593afb0ac85dfb79aa997761ec5b1e821dc0e6bb6a3b4e
Python
1,449
33
import os import pygraphviz as pgv # Directory containing the DOT files directory = "./hypotheses_tmpdot_" # Process each DOT file in the directory for filename in os.listdir(directory): if filename.endswith(".dot"): filepath = os.path.join(directory, filename) # Load the graph from the D...
5d0345e4d76cbba9479d6c418ded54133b6b0b6106622c2897f9f348d0dc98e6
Python
1,449
57
# Copyright 2026 Xanadu Quantum Technologies Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agre...
644129ba161f736236d6013c4ad8b3386ac4ab3b32cecf6f7abc1fd956b7f759
Python
1,449
71
# # File to select proteins from pdb files and store them in hdf5 file # from argparse import ArgumentParser import sys import Bio.PDB as pdb import Bio.PDB.mmtf as mmtf import h5py import numpy as np from protein_holography.utils.posterity import get_metadata, parser = ArgumentParser() parser.add_argument( '-...
e3c3a8a4ebaa16d46102163f577ce6f5657602a0fe984f9a3ec93d1602950f1d
Python
1,449
51
# -*- coding: utf-8 -*- """ Train the linear regression model & get the results for table S1 Created on Fri Apr 22 16:16:27 2022 @author: jeanbaptiste """ import copy import time import json import uuid import numpy as np import matplotlib.pyplot as plt import tensorflow as tf import tensorflow.keras # sys.path.in...
3c17a6d0aa33b2f4bec7d6bb35f5f18f1595cc5737c9a32b67778b2994bea52f
Python
1,451
47
#! /usr/bin/python import sys import re ''' Print warnings if predictors are not found in datatable ''' def removez(mstr): match = re.match("z\.\((.*)\)", mstr) if match is not None: return match.group(1) else: return mstr def formula2predictorstr(lines): #e.g. fdur ~ z.(myfixed) + (1 ...
147252dfb987780c4dd7018451e99d4d5d5ed7f444bb98178368b5bc509a7f6b
Python
1,456
52
""" _ .__(.)< (KWAK) \___) ~~~~~~~~~~~~~~~~~~~~ """ import time import sys sys.path.append("../") from HandPoseStreamer.pose_streamer import Pose_Streamer def working_example_2(): # Working example of a TCP stream of pose data from Python to Unity # One pose is made of 17 triplets of ...
a7a64db2bba50ede84d01fec89a51f4234be9c8dcd0e7729ee79370953e4c340
Python
1,456
56
import torch def optimizer_keys(optimizer): keys = list(optimizer.param_groups[0].keys()) keys = tuple(keys[1:]) names = () for name in keys: param = optimizer.param_groups[0][name] if isinstance(param, tuple): names += len(param) * (name,) else: names ...
41786766a93f645ca5a5a082dec1afa821598e78028fac2632b982e560fe8d61
Python
1,459
43
# emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 et: """ .. _metas_peaks2maps: ================================ Generate MA maps with peaks2maps ================================ .. warning:: peaks2maps has been deprecated within NiMARE and wil...
ede603561732e383d663212653c8773caff1cf616c3ac8f8075c0e9457c97b09
Python
1,460
32
from wordfreq import tokenize, word_frequency def test_apostrophes(): # Test that we handle apostrophes in French reasonably. assert tokenize("qu'un", 'fr') == ['qu', 'un'] assert tokenize("qu'un", 'fr', include_punctuation=True) == ["qu'", "un"] assert tokenize("langues d'oïl", 'fr') == ['langues', "...
c7017624a2698febec867170e04d45db56d2e00dea553886dc2bc416c536d03a
Python
1,461
46
# -*- coding: utf-8 -*- import numpy as np from .red_blue import RedBlueMove __all__ = ["DESnookerMove"] class DESnookerMove(RedBlueMove): """A snooker proposal using differential evolution. Based on `Ter Braak & Vrugt (2008) <http://link.springer.com/article/10.1007/s11222-008-9104-9>`_. Credit ...
ca67eae527e71d0acd8c59faf62771696b706ad270cd569f2e08a3219c1e717c
Python
1,461
37
import numpy as np, matplotlib.pyplot as plt import pumpprobe as pp plt.rc('axes',labelsize=16) time = np.linspace(0,40,400) ec = pp.ExponentialConvolution([0.1,0.12,3.]) y = ec.eval(time) y_plt = np.zeros(len(y)+100) y_plt[100:] = y time2 = np.linspace(-10,40,500) peak_t = ec.get_peak_time(time) rise_t = ec.get_eff...
9dd87dac3c8fae6323ac96c315d89b57c5566dcc9eb38526494a4ce426bf9fe2
Python
1,462
41
""" .. _metas_peaks2maps: ================================ Generate MA maps with peaks2maps ================================ .. warning:: peaks2maps has been deprecated within NiMARE and will be removed in version 0.0.13. """ ############################################################################### # Start...
a49001284de42708e0b277440728b5ecd464a44426d36308f09418c579a1c91f
Python
1,463
39
from PyQt5.QtWidgets import QLabel, QApplication, QStyle, QToolTip from PyQt5.QtCore import Qt class Icon(QLabel): """ A custom widget representing an icon with a tooltip. """ def __init__(self, tooltip_text, icon_name='SP_MessageBoxQuestion'): """ Initialize the Icon widget. ...
ed93a6fd8fde37fb7b4cf143e11cb28dd58de8fd284f546617e32df44626c84e
Python
1,463
42
import torch from torch import nn import torch.nn.functional as F class TcnnNet(nn.Module): def __init__(self, params, **kwargs): import tinycudann as tcnn nn.Module.__init__(self) self.actions_num = actions_num = kwargs.pop('actions_num') input_shape = kwargs.pop('input_shape') ...
013f6ea012b903841af6c6d6929d635cabc115bd7d451dba46673662e02abfdf
Python
1,465
39
#!/usr/bin/env python import argparse import torch def main(): parser = argparse.ArgumentParser( description="Release an OpenNMT-py model for inference") parser.add_argument("--model", "-m", help="The model path", required=True) parser.add_argument("--output", "-o", ...
188723e31e7d4ca340bf036dcf512e48c6a6aa4382b3161a36e64b23655bfbe0
Python
1,465
32
import sys import re #remove F model features where antecedent is null and k is a pronoun k such as f[01]&Top?&X-xX:he_1 #he, him, his, she, her, they, them, their, its #multiple models for different subtypes of coreference? #F depth syncat kvec kvec kvec corefOFF goldfek #fek is of format: F&E&K, where k is cat:pr...
a9d047bc88a0d5af18fa5bfd2f11472fee872951b66587e02c43f1133cf8f67b
Python
1,467
49
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from pathlib import Path from typing import Dict import h5py import numpy as np def save_reconstructions(reconstructions: Dict[str, np.nda...
1402dab2502d5a8f5958ee6f9146ada711f4f3d1848c2832ab0e0895a4832530
Python
1,468
39
from unittest.mock import Mock import pandas as pd import pyaging.preprocess._preprocess_utils as preprocess_utils def test_load_ensembl_metadata_uses_downloaded_hf_path_and_filters_chromosomes(monkeypatch, tmp_path): metadata_path = tmp_path / "returned-by-helper.csv" pd.DataFrame( { "g...