sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
183e8d5fe9a44e663163c80eb1bd7fb7c026b12d637ddf83324fd804f01c061c
Python
1,548
42
import numpy as np, matplotlib.pyplot as plt, sys import pumpprobe as pp, wormdatamodel as wormdm sort = "--sort" in sys.argv neu_j = None for s in sys.argv: sa = s.split(":") if sa[0] in ["-j","--j"]: neu_j = int(sa[1]) ds_list = "/projects/LEIFER/francesco/funatlas_list.txt" funa = pp.Funatlas.from_datasets...
36dfd9d10888eaed07a5b638f20e9a44578fa74b5d33e1552d93de6ff205a57c
Python
1,549
48
# 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...
3bebc81216badad2b0908bfeff0633820e606d6add039593dac8fc037659bdbc
Python
1,549
46
import aicspylibczi import numpy as np import os import pathlib import tifffile import gc from sys import getsizeof def get_reassembled_czi(czi): #Reassembles the czi images. It returns a np.array of uint16. data = [] dims_shape = czi.get_dims_shape() if not 'C' in dims_shape[0]: raise Exception("Image la...
b8fe828ddc5e513f8dcc5c33ad9549631a748ecf72f947fb3b7e342d864b48e2
Python
1,549
48
# -*- coding: utf-8 -*- import glob import logging import shutil import subprocess from pathlib import Path import click from dotenv import find_dotenv, load_dotenv parent = str(Path(__file__).resolve().parent) def combine_all(root, outpath): files = glob.glob(root + "/**/*.csv", recursive=True) print(files)...
0ecbbaa6f43903a31a9f2b7556540b2bca51a59b6bf92d93dee6c9bd141a4650
Python
1,550
48
import pytest import pandas as pd class TestFlags: def test_equality(self): a = pd.DataFrame().set_flags(allows_duplicate_labels=True).flags b = pd.DataFrame().set_flags(allows_duplicate_labels=False).flags assert a == a assert b == b assert a != b assert a != 2 ...
5d93d15e98247f1261322277e2d6f6f1f395236e7a0a8ddfd1e82f7da5e39799
Python
1,550
66
# Copyright 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 agre...
2edf2ed931bfe8c720df0717f59912e236e3c9a13815d9194f38b73d6325f44b
Python
1,553
42
import scipy.io as scio import numpy as np # 生成模型需要的cites文件 if __name__ == "__main__": # 处理为.cites文件 # data = scio.loadmat(r'E:\experiment\testdata\dataset1\Normalize\test3.mat')["permission"] # self = np.eye(len(data)) # datanew = data-self # fout = open(r'E:\experiment\testdata\dataset...
797113814f2b234ea5b9b3063d2aa7c2ecec85303ad8f291a782f317067eba6a
Python
1,553
43
from base import surfaces from base.kernelFunctions import Kernel from base import surfaceMatchingNormalExtremities as SMNE import matplotlib matplotlib.use("QT5Agg") import matplotlib.pyplot as plt from base import loggingUtils import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]...
c27e782640fdd3a77e6cb3e2bb4c7091a0d53dfc1c6e6fe6fc377b66d5b82f8d
Python
1,553
67
import numpy as np import pytest from pandas._libs import lib import pandas as pd import pandas._testing as tm def assert_block_lengths(x): assert len(x) == len(x._mgr.blocks[0].mgr_locs) return 0 def cumsum_max(x): x.cumsum().max() return 0 @pytest.mark.parametrize( "func", [ cu...
8b42e9c7b10e580ec5ca047e5bafb744e409e4c0bc80dd733803f47553901e5a
Python
1,554
51
# -*- coding: utf-8 -*- """ Created on Fri Oct 13 14:46:54 2023 @author: nrq2 """ ## ssh rachel@nostromo.ncl.ac.uk ## spyder-scenic-ad3 # cd /data/rachel/Linda_Lako/Retina/AD3/ATAC_analysis/SCENIC/ # conda activate scenicplus # python -m spyder_kernels.console # /home/rachel/.local/share/jupyter/runti...
15fa01a140cdfc5fcb01aa3efab30deb8560f674c18254a7c4ca3371d8c37ad5
Python
1,555
54
from values import * # across basolateral def kcc4(conc,memb_id,xKCC4,area): bet2 = conc[1][1]/bkkcc bet5 = conc[1][4]/bkkcc bet6 = conc[1][5]/bkkcc gam2 = conc[2][1]/bckcc gam5 = conc[2][4]/bckcc gam6 = conc[2][5]/bckcc dnu2 = conc[10][1]/bmkcc dnu5 = conc[10][4]/bmkcc dnu6 = conc[10][5]/bmkcc sig2 = 1.0+...
c80fbc51c5c99b5571d18bb402903de70f5497c0d2ba5aaff1146dc1c464a4c9
Python
1,555
58
import os import csv import random import numpy as np import tensorflow as tf from .augmentation import rotation3D, relocation def gen(dataset, batch_size, shuffle, augment=False): while 1: if shuffle: random.shuffle(dataset) for i in range(0, len(dataset), batch_size): ds...
1e82cb4c7959f2365fe03496d53cab21c43db6e77bebaae56e05abb6f1e84a81
Python
1,557
27
# Copyright (c) 2018-2023, NVIDIA Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of condit...
3f32fd3f8f3046c9c4c3a11121be194525f83d2a66e19578caed6de5ad9bdf71
Python
1,558
27
# Copyright (c) 2018-2023, NVIDIA Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of condit...
b7f278f99cef414fae874755698209c678bdbfebd84d5c0d164d25fd47e19a3b
Python
1,559
60
# -*- coding: utf-8 -*- import importlib import logging __all__ = ["get_progress_bar"] logger = logging.getLogger(__name__) try: import tqdm import tqdm.auto except ImportError: tqdm = None class _NoOpPBar(object): """This class implements the progress bar interface but does nothing""" def __...
b04cf6d5f51d752795eab23bbe31bc512de432b4267ec79ddc2c90101e8edd60
Python
1,560
50
import numpy as np import pandas as pd homeDir = 'path to home folder' chanDir = 'path to folder containing channel information (e.g. source data)' # Specify ROIs of interest ROIlist = ['Anterior Insular Cortex', 'Posterior Insular Cortex', 'Frontal Orbital Cortex', 'Subcallosal Cor...
5896f80cc79efceee0a7a98647c3a1ed9a2c677b36ba414618aeb1cb29096149
Python
1,562
47
from nose2.tools import params import tempfile import os import numpy as np import pandas as pd import cooler import chromosight.utils.plotting as cup import chromosight.utils.detection as cud import chromosight.utils.io as cio mat, chroms, bins, res = cio.load_cool("data_test/example.cool") mat = mat.tocsr() # Get...
7ceb547bf42543fef718659bd346e05ee8389f1f7ce586300e6cfcb1aa58b118
Python
1,562
48
import torch from typing import List from ...image import Stack from ...utils import ncc_loss def matrix_rank( stacks: List[Stack], threshold: float = 0.1, rank_only: bool = False ) -> List[float]: scores: List[float] = [] for stack in stacks: masked_slices = stack.slices * stack.mask.float() ...
7d117ea07b77e17ef98f6a197079397ca2fb3f6455dc2d5da10a71e998c4452e
Python
1,562
53
#!/usr/bin/env python """Parse machine info (cat /proc/cpuinfo /proc/meminfo) and write a tab-delimited row to stdout with the following fields: 1. Program name 2. Total memory 3. Number of processors 4. Speed of processors """ import argparse from collections import defaultdict from common import fileopen, parse_pro...
a465188ad8dc91a5fd9bf8123cbb325aaae7694c2f4742e7800d814d349285b2
Python
1,562
55
import contextlib import numpy as np import torch def seed_all(seed): torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False np.random.seed(seed) @contextlib.contextmanager def temp_seed(seed): """Temporarily set th...
988964ded5ee1f9b5525a65972bc3cd8bc2bd51e71dc242f6284ee7bb93a3c8a
Python
1,563
56
import torch.nn as nn class BaseRGCN(nn.Module): def __init__(self, num_nodes, h_dim, out_dim, num_rels, num_bases=-1, num_hidden_layers=1, dropout=0, use_cuda=False): super(BaseRGCN, self).__init__() self.num_nodes = num_nodes self.h_dim = h_dim self.out_dim = out_...
ab2c6b441e8251575a3cab36cd1608e97e5c1c8d453ec7adb74da63da4983a23
Python
1,563
56
""" Set up templateflow in customised directory. Download atlases that are relevant. This is no longer need for curious curator. We uploaded all the atlas on osf. """ import os from pathlib import Path def fetch_schaefer(): """Download schaefer2018.""" import templateflow.api as tf schaefer_path = tf.ge...
ac946f64e8af20c1ae0c23b11de2a6f76e29a34e2946dfb05214bdcc0ad2cb6a
Python
1,563
52
# Based on # Color Universal Design (CUD) # - How to make figures and presentations that are friendly to Colorblind people # # # Masataka Okabe # Jikei Medial School (Japan) # # Kei Ito # University of Tokyo, Institute for Molecular and Cellular Biosciences (Japan) # (both are strong protanopes) # 11.20.2002 (modified ...
0645317f5f03c333f6e28170eeef5767d4900b54c631abf529a4d691567ab6f7
Python
1,564
53
from __future__ import print_function import argparse import torch def compare_model_weights(model1, model2, eps, verbose): param1 = torch.load(model1) param2 = torch.load(model2) # first check if both models have the same keys if (param1.keys() != param2.keys()): print('The parameter of the...
9dd98ffcb8191e59b61da280d6e76d5cf5f704de8b5f7fff9b42630ecb9682e3
Python
1,564
46
import torch from torch import nn from rl_games.common import common_losses from rl_games.algos_torch.layers import symexp, symlog from rl_games.common.extensions.distributions import TwoHotDist class DefaultValue(nn.Module): def __init__(self, in_size, out_size): nn.Module.__init__(self) self.val...
b49fd6057f1c6f8f6ea793f2ab45f1da220ce2fcd135e34eea61a02d2139ab11
Python
1,564
74
import setuptools from setuptools import setup install_deps = [ 'numpy>=1.20.0', 'scipy', 'scikit-learn', 'tqdm', 'torch>=1.6', 'numba', 'faiss-cpu', ] gui_deps = [ 'pyqtgraph>=0.13.0', 'pyqt5', 'pyqt5.sip', 'google-cloud-storage', 'matplotlib' ] docs_deps = [ 'sph...
f1a7eccf7be7aa897185c30eee79314f408d8e0c76e651146566bce481f34d33
Python
1,564
51
import pytest from pandas.errors import Pandas4Warning import pandas as pd import pandas._testing as tm @pytest.mark.parametrize("tz", [None, "Asia/Shanghai", "Europe/Berlin"]) @pytest.mark.parametrize("name", [None, "my_dti"]) def test_dti_snap(name, tz, unit): dti = pd.DatetimeIndex( [ "1/...
13200153152bc75be8a698cbc4c77e73e0c0bae8455fc38115bfe699864bc3c2
Python
1,567
42
# -*- coding: utf-8 -*- """ Get transformation MRI <-> MEG with MNE coregistration. Tthis script is run manually for each subject. 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 rhythms are...
d983054196cbbd0cbddd19b2a43b7595a50dbaf7cf6744eb745e90cc110334aa
Python
1,567
55
import time import logging from abc import abstractmethod import torch from modules import model_utils class Model: """ This base class is responsible for loading the model. """ DOCKER = True # Set this variable to True if using Docker container. DOCKERPATH = "/opt/conda/envs/ga...
13174d602ee1c22ae21fd98d385347d73aa4102881e59dae8f30e0f9263805d7
Python
1,568
44
#!/usr/bin/env python import os, sys from cupcake.io.GFF import collapseGFFReader def main(input_prefix): input_gff = input_prefix + '.gff' if not os.path.exists(input_gff): print("Looking for input GFF {0} but not found! Abort!".format(input_gff)) sys.exit(-1) f1 = open(input_prefix + '....
67b859ae2034fb28fe6ed3284807898119d29347827d2ca509a54af270e3be5d
Python
1,568
52
import os import platform PACKAGE_PATH = os.path.dirname(__file__) PLATFORM = platform.system().lower() BINS_DIR = os.path.join(PACKAGE_PATH, 'bins') MODELS_DIR = os.path.join(PACKAGE_PATH, 'models') MODEL_PATH = os.path.join(MODELS_DIR, 'pi.stan') MODEL_NAME = 'pi' RECOMMENDED_MEMORY = 16 * (1024**3) # 16 GB # Com...
99213433e8bd584849ba466bfd6c04f34d5445c02a13dbfcf241306306a4c7f7
Python
1,568
67
"""Tests that the tslibs API is locked down""" from pandas._libs import tslibs def test_namespace(): submodules = [ "base", "ccalendar", "conversion", "dtypes", "fields", "nattype", "np_datetime", "offsets", "parsing", "period", ...
0bf97cb74d0bfa7f1b2e4fd78fddcdd7f8b8c487574720ce446f2bfd3b99b066
Python
1,569
41
import pytest import pandas as pd import pandas._testing as tm def test_add_prefix_suffix(string_series): with_prefix = string_series.add_prefix("foo#") expected = pd.Index([f"foo#{c}" for c in string_series.index]) tm.assert_index_equal(with_prefix.index, expected) with_suffix = string_series.add_s...
4932ad42573acca6f5449f731111b465bcdc8c78bc6d95fa4f7fdb3e31088913
Python
1,571
41
import torch from torch_geometric.transforms import BaseTransform class RattleParticles(BaseTransform): """Applies a random gaussian noise to paritcle positions. The standard deviation of the noise is drawn uniformly from a range [sigma_min, sigma_max]. Args: sigma_min (float): The minimum standa...
84ca852b557c0eb74ada5d9a437ed192a12b179b896c7b747449457a3e2faecd
Python
1,571
50
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 5 11:47:43 2023 @author: Noelia Martínez-Molina, adapted from code provided by Yonatan Sanz-Perl at CNS, UPF """ from numpy import genfromtxt import numpy as np import matplotlib.pyplot as plt import matplotlib.style as style import seaborn as sn...
91e5fab7c72da7d9b86df78976926f4e40596cd7c98975bb2fd66ba49beb245d
Python
1,571
54
import logging from pathlib import Path from datetime import datetime from contextlib import redirect_stdout def make_log_name(name): log_name = f"pred_age_{name}" + datetime.now().strftime("%Y%m%d-%H%M%S") + ".log" return log_name def setup_logging(log_file, log_level=logging.INFO, handler=logging.StreamHand...
b2fb9554f3a2c5a308a6425f682baa9acfd83d249e209c71ceacdac9752e8f48
Python
1,572
36
import sys, argparse import pandas as pd argparser = argparse.ArgumentParser(description='Generates naturalstories.evmeasures data table.') argparser.add_argument('f1', type=str, nargs=1, help='Path to experiment data table') argparser.add_argument('f2', type=str, nargs=1, help='Path to itemmeasures data table') args,...
f87744604c25aad3cf6f5bc5bbc5c7a386bb5fa13f7313eb7b65a3eb13cae57c
Python
1,573
58
# -*- coding: utf-8 -*- #! JN 2014-10-23 Add spike viewer to SWR viewer from PyQt5.QtWidgets import QDialog #from PyQt5.QtCore import * #from PyQt5.QtGui import * from .sWidgets import * from ui_spikes import Ui_Dialog import numpy as np from matplotlib.gridspec import GridSpec gs = GridSpec(1, 1, top=.95, bottom=...
b43b27dba2428b50c3d34d563dfb62217c94363b85c83f25776fb901c906a19a
Python
1,574
40
import numpy as np, sys import matplotlib.pyplot as plt import wormdatamodel as wormdm plt.rc("xtick",labelsize=18) plt.rc("ytick",labelsize=18) to_paper = "--to-paper" in sys.argv folder = "/projects/LEIFER/francesco/pumpprobe/AKSxneuropal/20210209/pumpprobe_20210209_163726/" rec = wormdm.data.recording(folder, re...
dd4e461675a6a7d7113d7f506376659b0beab263292c52eb4cadb06245965adb
Python
1,574
47
#%% from pathlib import Path from src.fs_roi_lut import read_rois, Roi from src.fs_stats import StatsFile from src.paths import Paths import pandas as pd import numpy as np import os #%% set paths data_dir = Path(__file__).parent.parent.parent / 'data' # %% read rois rois = read_rois(data_dir / "rois_fs.json") rois....
4851e5642311d3d4897f91ed29f7a23dc3d08cd1d30f83a1bbaab925b9e3b8a4
Python
1,576
39
import torch from torch_geometric.data import Data from ssa import sparrow_search_algorithm from cnn import CNN from gnn import SimpleGNN from cbam import CBAM from torchvision import transforms def evaluate_model(model, dataloader, device): model.eval() all_predictions = [] all_labels = [] ...
ea063cf490cebef3868e0e74eb7a5275aef3b41d4458450255e14fe9afb0963d
Python
1,576
41
#!/usr/bin/env python3 import os, sys from csv import DictReader import pysam def paint_bam_post_phaser(input_bam, output_bam, read_info, chrom, start, end): reader = pysam.AlignmentFile(input_bam, 'rb') fout = pysam.AlignmentFile(output_bam, 'wb', header=reader.header) for r in reader.fetch(chrom, start,...
f2aa2d68a8b9f86128a2c72fc8412b373587fb73e02fee0722667a419bbb3c67
Python
1,576
61
import dclab import numpy as np import matplotlib.pylab as plt # dataset ds = dclab.new_dataset("fluorescence/fluorescence.rtdc") evt = 54 # traces flraw = ds["trace"]["fl2_raw"][evt] flmed = ds["trace"]["fl2_median"][evt] # plot fig = plt.figure(figsize=(7, 3)) # image axi = plt.subplot(221, title="event image")...
1d097a4f5c803707e10859d39fc729f3e2df17b78ca7fb437c59199c6cbad5ff
Python
1,578
59
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
85538fc50dfcd224e2fbeadd7b544e614ed9fd218709b22c42f91d992b96942f
Python
1,580
43
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QCheckBox from PyQt5.QtCore import pyqtSignal, Qt class CheckBox(QWidget): # Signal emitted when the checkbox state changes. It sends the label of the checkbox when checked. sgn = pyqtSignal(str) def __init__(self, label): super().__init__() ...
b4fc50bc1ac98d7d4fd720d9bde5038cc2d8d02689dbbcc7baa02e3f74eed558
Python
1,581
46
import sys import re import pandas as pd import argparse network_names = ['Lang', 'MDlangloc', 'MDspatwm', 'DMNlangloc', 'DMNspatwm', 'AC', 'LHip', 'RHip'] def compute_network(name): if 'Hip' in name: return 'Hip' for network_name in network_names: if name.startswith(network_name): ...
d6bc671b034aa73a2272c8fa6f58304b5a5875cc8530f727ef3acb05e5432512
Python
1,581
72
# Count class frequency to deal with unbalance import tensorflow as tf import os import nibabel as nib import numpy as np import random import re from skimage.transform import resize from pathlib import Path from const import * # CSF: 1, 2, 23, 24, 0, 18 -> 1 # WM: 16, 17 -> 2 # GM: Rest -> 3 # Brain Stem: 7 -> 4 # C...
0212263c61eea02519df93601bed7a39e090f3ee931a444c58ba95c177c61689
Python
1,582
49
from .. import utils from ..file_utils import get_generated_path, make_basedir import os template1 = ''' import os, sys # Add the pheweb package into the PYTHONPATH so that we can import it. # This assumes that you cloned pheweb from github. If you installed with pip, maybe this has no effect? sys.path.insert(0, '{...
5b338c7e10803338fe40d8cfad5c58ebd1f4ddc1fd418ba7c806a371f0e62493
Python
1,582
42
"""session 25: trial artifacts (stored_path + sha256 + size_bytes + params) Revision ID: c3d4e5f6a7b8 Revises: b2c3d4e5f6a7 Create Date: 2026-05-08 20:00:00.000000+00:00 Promotes ``Trial`` from a metrics-only row to a full candidate-pipeline record. Each compare/search trial now keeps its fitted pipeline pickle on di...
e310ea11a2893949192fc0a7d71c6f4664214302b1b6ead147f38b66201ee8cd
Python
1,582
42
#!/usr/bin/env python import os, sys from collections import defaultdict from Bio import SeqIO from cupcake.io import BioReaders def type_fa_or_fq(file): file = file.upper() if file.endswith('.FA') or file.endswith('.FASTA'): return 'fasta' else: return 'fastq' def summarize_GMAP_sam(input_fa_or_fq, inpu...
eb5af4e6c8574184f42f0e3737f2242df63f70eaad3f66aab51be7eb9bf7e529
Python
1,583
45
import os import torch import pickle import matplotlib.pyplot as plt import matplotlib as mpl import pandas as pd load_dir = '/Users/elizabethnewman/Desktop/tnn_results/cifar10_timing/tensor/' results_tensor = [] for subdir_name in ['depth_4', 'depth_8', 'depth_16', 'depth_32', 'depth_64', 'depth_128']: print(sub...
230ce43fa747ea6ce923bc209eea485e87689d629ad70cb5ef879386153c6775
Python
1,584
60
import sys import glob import pandas as pd import numpy as np import h5py file_list = sys.argv[2] print(file_list) LABEL = 'Characteristics[cell_type]' total_data = pd.DataFrame() for ff in [file_list]: data = pd.read_csv(ff, sep='\t', index_col=0) total_data = total_data.append(data) print(total_data.sha...
2069ff109c72a19fb75c1bf1138715147a82cdd53471e39ee29030c734de0f64
Python
1,585
53
# Generate base histograms of the first and last 20 bp of read1 and read2 import argparse from common import * import csv from xphyle import xopen import tqdm nuc = ('A','C','G','T','N') def make_hists(fq1, fq2, n_bases=20): read1_hist = [ dict((base, [0] * n_bases) for base in nuc) for i in rang...
4eab07cef48fd5f4681d80950c7be2e3942932586fe6093d2acc166549aa7006
Python
1,585
47
import pytest import pandas as pd class TestIntervalConstructors: @pytest.mark.parametrize( "left, right", [ ("a", "z"), (("a", "b"), ("c", "d")), (list("AB"), list("ab")), (pd.Interval(0, 1), pd.Interval(1, 2)), (pd.Period("2018Q1", fre...
15a39990f91b0aaa88a8cf4738ff81dcc7b8a3fc5daabf4460105c1051920c79
Python
1,586
43
import numpy as np import pandas as pd def compute_pvalues(scores: np.ndarray, null_scores: np.ndarray, verbose: bool=False) -> pd.DataFrame: """ Compute empirical p-values. Args: scores (ndarray) : The ES scores computed using actual annotation. null_scores (ndarray) : The ES sco...
46e9518f25b3527f6054555eca99dd5300cb7b3a51d92580083ebf0589b12838
Python
1,586
50
from __future__ import annotations import numpy as np import pyarrow def pyarrow_array_to_numpy_and_mask( arr, dtype: np.dtype ) -> tuple[np.ndarray, np.ndarray]: """ Convert a primitive pyarrow.Array to a numpy array and boolean mask based on the buffers of the Array. At the moment pyarrow.Bool...
99f03982e3e86ea5e6c1e8986b32628f6bd60c5393ae53f87a736a6b2d02011a
Python
1,587
51
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Created by Roberto Preste from setuptools import setup, find_packages with open("README.rst") as readme_file: readme = readme_file.read() with open("HISTORY.rst") as history_file: history = history_file.read() requirements = ["Click", "pandas", "requests", "aio...
a413de3725bd4366ba7392d8ed34f5f1032113f08a3566d0d4c4accd1ddd8533
Python
1,588
36
""" Converts foldseek databases into pairs of 3Di and amino acid fasta files. """ import argparse import sys from esmologs import __version__ def foldseekdb2fasta(input_basename, output_basename): with open(f"{input_basename}","rb") as aa_h, open(f"{input_basename}_ss","rb") as tdi_h, open(f"{input_basename}_h"...
ae9197396ba4d10d76ca082a81d4b974400680850430cbcab40d4db62736fbc8
Python
1,588
53
# 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...
fc32975f2083204fb7086d9012556b4b97fbe5ead064e64013c1bd9897cc54c3
Python
1,588
58
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Noelia Martínez-Molina """ import seaborn as sns import matplotlib.pyplot as plt import pandas as pd # Set plot style and frame sns.set_theme(style="darkgrid") plt.rcParams['font.family'] = 'Helvetica' # Import data from file df=pd.read_csv('/Volumes/LASA...
56d873c01787b9966da9a0a52d6f9c60b9bb644bdb748d4336ed31e6f1173fc1
Python
1,589
51
"""Test stats functionality""" import pathlib import tempfile from unittest import mock from PyQt6 import QtWidgets from shapeout2.gui.main import ShapeOut2 from shapeout2 import session from shapeout2.gui.compute.comp_stats import ComputeStatistics import pytest data_path = pathlib.Path(__file__).parent / "data" ...
df5dcca8b4c3799ba2d7b89d605de4ba08223928e5de9b39a20820acfc9917ed
Python
1,589
43
#%% Imports from pathlib import Path import argparse from src.logsetup import Logger from src.experiment import ExperimentBuilder import sys import os import warnings #%% set Paths and configs RESULTDIR = Path(__file__).parent.parent / "results" DATADIR= Path(__file__).parent.parent / "data" def run(data_dir: Pa...
b69534efe103b4f89120bb2806bf477a12ad83cca8295fc69dfedde62162e8f4
Python
1,590
68
import itertools import numpy as np import pytest import pandas as pd def create_series(): return [ pd.Series(dtype=np.float64, name="a"), pd.Series([np.nan] * 5), pd.Series([1.0] * 5), pd.Series(range(5, 0, -1)), pd.Series(range(5)), pd.Series([np.nan, 1.0, np.na...
4009561acf2044a0a81f6767725fd131faff3b8a2cbcaa58314bc0994f4fa591
Python
1,591
48
from .data import RawData class Sample(): """ Representation of a MS sample contain in an experiment. Contains, peak and feature lists, raw_data object to store raw file and connect to appropriate backend reader. """ # Sample counter to automatically assign sample ids sample_counter = 0 ...
8026a7b3619617013565c77fd164e9ababde75bcd80db45d63688a1a9f3d2ad5
Python
1,592
57
import torch import torch.nn as nn import torch.nn.functional as F from darts.api import Model class MixedLayer(Model): """ A mixture of 8 unit types We use weights to aggregate these outputs while training. and softmax to select the strongest edges while inference. """ def __init__(self, c, str...
b2ab3cc607be7e6e9014314b889fb358833ce5c1ef33de40bd55f6399d3b87ed
Python
1,592
48
import hashlib import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Class representing sampleable neural network model """ def num_params(self): """ Get the number of model parameters. """ return sum(p.numel() for p in self.parameters()) def sum...
685eee467f5d354abd4c0c38e65d14f0c18b1b2e4f312528610e9a32d4670ce1
Python
1,593
64
from importlib.metadata import version from .dataio.data_factory import ( fetch_example_correlation_matrix, load_fcon1000, load_lnm, ) from .dataio.norm_data import NormData from .longitudinal import CorrelationMatrix, VelocityModel, ZDiffScore from .math_functions.basis_function import ( BsplineBasisF...
850c7960b0eee06d12c81227f8091fb1e37cbba48eb52752640a60b108a68977
Python
1,593
69
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 5 11:47:43 2023 @author: Noelia Martínez-Molina """ from numpy import genfromtxt import numpy as np import matplotlib.pyplot as plt import matplotlib.style as style import seaborn as sns import pandas as pd #PLOT INFORMATION ENCODING CAPABILIT...
c0c954922b5259651980c71ad2fac88cbba6e25ab68209f0d93ef8b2a5cbd589
Python
1,593
33
# Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
9ccecb71a3b59a941677f8002c51e3dc50e14274d841279841ad1b3c31131672
Python
1,594
54
#!/usr/bin/env python """The setup script.""" import pathlib from setuptools import find_packages, setup def read_requirements(file_path): with open(file_path, "r") as f: requirements = f.read().splitlines() return requirements requirements = read_requirements("requirements.txt") setup_requirements...
d132912ff1dcdff9f13a2e29ce9eec1caf48ed561c72132feb966dcfeda9c3a6
Python
1,594
47
import subprocess # brand-specific exceptions class GraphError(Exception): def __init__(self, message='', graph=''): super().__init__(message) self.graph = graph def __repr__(self): return f"GraphError(message={str(self)}, graph={self.graph})" class NodeError(Exception): def _...
88485e9ffe6cd560440c638a78060c95eed25a91b7dc77abb59cfe2ce5f4ac1e
Python
1,598
56
""" Check that doc/source/reference/testing.rst documents all exceptions and warnings in pandas/errors/__init__.py. This is meant to be run as a pre-commit hook - to run it manually, you can do: pre-commit run pandas-errors-documented --all-files """ from __future__ import annotations import argparse import ast...
8e14152688273ef93b81c2f334025b0ba3df7963bc6a646b63ccca699bc45dc7
Python
1,598
59
""" Entrypoint for testing from the top-level namespace. """ from __future__ import annotations import os import sys from pandas.compat._optional import import_optional_dependency from pandas.util._decorators import set_module PKG = os.path.dirname(os.path.dirname(__file__)) @set_module("pandas") def test(extra_a...
929c84a020747a674962b5d56a7199ec334acd2036c24b0e1f6975931f5b4d2d
Python
1,598
47
""" 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 import torch.nn.functional as F class Act(torch.nn.Module): def __init__(self, act, slope=0.05): super(Act, self)....
c9b11a8fe5f8ffb05f398e54bbf410f504ce55d6c310f5d273ba3c890f104778
Python
1,598
51
from functools import partial from fastai.distributed import * import importlib import json from fastai.learner import Learner from fastai.optimizer import Adam import torch import accelerate from pathlib import Path #use the parameter json to create the learner def json_to_learner(json_input): set_seed(json_inpu...
14cf4b6a3e59d889483f102f214f1164004ab33ab3aa63ec6a146dfcd6a729db
Python
1,599
61
import warnings import config import numpy as np from tensorflow.keras.models import model_from_json from utils import change_output warnings.filterwarnings("ignore") __all__ = ["change_output", "decrypt_file", "decrypt_oh"] def decrypt_file(file, net_list): net_list = np.load(net_list) dec_count = 0 w...
d41fa3c2102762bdea73b6d48f191a9a1fd63983ed4d0ce49e6d1a9eb5280d02
Python
1,599
70
""" Timedelta benchmarks that rely only on tslibs. See benchmarks.timedeltas for Timedelta benchmarks that rely on other parts of pandas. """ import datetime import numpy as np from pandas import Timedelta class TimedeltaConstructor: def setup(self): self.nptimedelta64 = np.timedelta64(3600, "s") ...
b52bad54b20ff103d849d5efc8566a6ff659b510a1ddd53f9fd61dcaf03b78a2
Python
1,601
38
#Run sweeps over number of fields import numpy as np from placerg.funcs import * from placerg.funcsrg import * from placerg.objects import * from placerg.runfunc import * N0 = 2048 # number of cells N = 512 # number of cells after removing silent ones percell= 1.0 # probability that each field is accepted phi=1.0 #...
b58f68a806ab61fda8f33124d139f4fb6985ee4644ff7ac3f9d32523840d210a
Python
1,601
51
# Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
487496080427a6594c97ae2735e68a77752b9aa391c0e3f0730321e3e52c6068
Python
1,602
55
from __future__ import annotations from functools import reduce from typing import ( TYPE_CHECKING, Any, ) import numpy as np from pandas._config.config import _global_config as config if TYPE_CHECKING: from pandas._typing import DtypeObj def ensure_decoded(s: str | bytes) -> str: """ If we ha...
98a3deed9d759f7abd0dc9344350eedbc3fefab6ef9c02ce65b5dc616f6e973d
Python
1,602
55
""" Series.item method, mainly testing that we get python scalars as opposed to numpy scalars. """ import pytest import pandas as pd class TestItem: def test_item(self): # We are testing that we get python scalars as opposed to numpy scalars ser = pd.Series([1]) result = ser.item() ...
af0ae4cb6011a4349be6fe1c70b53eea447cf4596df912707395a4e7bd637737
Python
1,602
57
# Copyright 2018-2021 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...
1dcd4433eed0de528b99240c86e61b45a16c8d27dbb328828972b0ab49ca169a
Python
1,603
32
# Copyright (c) 2018-2023, NVIDIA Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of condit...
a15aae9d90323bc0b85ee449d6cfc0dc8ba1ad59804dd46e238fc65609c2a999
Python
1,603
56
# Copyright 2018-2022 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...
c6bafe459830ccda68fa1ba89a438383df2d9942f90ed07da6b020b9b29df968
Python
1,604
55
""" vegas example from the Basic Integrals section of the Tutorial and Overview section of the vegas documentation. """ from __future__ import print_function # makes this work for python2 and 3 import vegas import math import numpy import sys if sys.argv[1:]: SHOW_GRID = eval(sys.argv[1]) # display picture o...
5d48e87799fdc12b591d0ee306491e70ebba5a600dbd6cbdc4bfde7ede836e13
Python
1,606
51
from functools import partial from fastai.distributed import * import importlib import json from fastai.learner import Learner from fastai.optimizer import Adam import torch import accelerate from pathlib import Path #use the parameter json to create the learner def json_to_learner(json_input): set_seed(json_inpu...
751815666a536577e88705c689161279e2985d001e087b75b008546931c3e7a4
Python
1,606
43
"""Public parser imports in fresh interpreters, including stream-first loading.""" import os import subprocess import sys import pytest from conftest import macs3_env @pytest.mark.parametrize('first', ['MACS3.IO.Parser', 'MACS3.IO.BAMStream']) def test_public_parser_imports_in_fresh_process(tmp_path, first): s...
8fddc71deb5e9afe8f7da7f0ca660f08d7f236a539422e488ac098d41df50c40
Python
1,606
62
# -*- coding: utf-8 -*- import warnings from functools import wraps import numpy as np __all__ = ["sample_ball", "deprecated", "deprecation_warning"] def deprecation_warning(msg): warnings.warn(msg, category=DeprecationWarning, stacklevel=2) def deprecated(alternate): def wrapper(func, alternate=alternat...
47d992f8cb5e492f00bde6075b0a01838d97f01da9d50c89fc72d45ed72468d1
Python
1,607
45
# -*- coding: utf-8 -*- import numpy as np __all__ = ["Move"] class Move(object): def tune(self, state, accepted): pass def update(self, old_state, new_state, accepted, subset=None): """Update a given subset of the ensemble with an accepted proposal Args: coords: The or...
b826cf6add064fea8e29a5aa70e3f3c62a234f844e05dca0519b4e368f424360
Python
1,607
47
#!/usr/bin/env python __version__ = '1.0' import os, sys from Bio.Seq import Seq from Bio import SeqIO import coordinate_mapper as sp import BioReaders ###### MODIFY FILENAME BELOW ####### #genome_file = 'hg38.fa' #sam_file = 'alz.rep.fq.sam' #sam_file = 'isoseq_flnc.fasta.sam' #output_err_corrected_fasta = 'alz.re...
bbad5e9408a63a729ed848ccd0ceb8f1eee23cb9d4edf1fd3f8d28e53f890078
Python
1,608
58
from abc import ABCMeta, abstractmethod import os class BasicAnalysisProcess: def __init__(self) -> None: pass @abstractmethod def initial(self, controller=None, config=None, streaming=None, messenager=None): # 3 essentials: controller, config, and data streaming client ...
38a2aeefa8556f55d36511c8199f4ad4840ab5ac019ab639be070443d0625365
Python
1,609
41
from sys import path as sys_path sys_path.append('..') sys_path.append('../base') import os import matplotlib if 'DISPLAY' in os.environ: matplotlib.use('qt5Agg') else: matplotlib.use("Agg") import matplotlib.pyplot as plt from base import loggingUtils from base.surfaces import Surface from base.kernelFunctions...
9e988883cd4658efdcb595994ae51d1afc63b5d3a2362625d6f263ab032e59e5
Python
1,609
66
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 27 09:53:30 2023 @author: nrq2 """ print("load libraries") import os import scenicplus import scanpy import pycisTopic ## 1. Initialize cisTopic object from pycisTopic.cistopic_class import * from pycisTopic.utils import * from pycisTopic.lda_models...
c7c9785c0a84e374c6e2a3a192ecf926eaff5596c412c7cbceae544ad86f0b27
Python
1,609
54
#!/usr/bin/env python import argparse import pandas as pd # Create a parser parser = argparse.ArgumentParser(description="Parameters for Demuxmix") parser.add_argument("--path_hto", help="cell hashing path, filtered HTO matrix") parser.add_argument( "--hto_name_gmm", help="a list of sample tags (HTOs) separate...
6dee02970ea9304f18824338841a520a11c098db5c4c4ebecfc91104e1d44d51
Python
1,610
48
"""There are three configurable things: predictors/models, data, training/evaluation. Only first two require factories. """ import os import torch import logging from progres.chainsaw.src.domain_chop import PairwiseDomainPredictor from progres.chainsaw.src.models.rosetta import trRosettaNetwork from progres.chainsa...
e3397759b05bc01f5ed82f87ba058e6d577f8a81c8b2026fc91f365864681b6c
Python
1,610
36
from Common import loggingUtils from Curves.curves import * from Common.kernelFunctions import * from Curves.curveMultiPhase import * def compute(): outputDir='/Users/younes/Development/Results/atlasSections49' if __name__ == "__main__": loggingUtils.setup_default_logging(outputDir, fileName='info') ...
3869c83003c26d71632e30bf62841aac32f9ff15e2a2536e1d130314a630264a
Python
1,612
49
import os import shutil import numpy as np import cv2 # Generic function to combine two images def combine_images (img_fold_A, img_fold_B, img_fold_AB): img_fold_A = os.path.expanduser(img_fold_A) img_fold_B = os.path.expanduser(img_fold_B) img_fold_AB = os.path.expanduser(img_fold_AB) # Setup a c...
b742efcde3283bf4e96c1601f3f8526b6d0e2987218b727d69052fd2bba2c14b
Python
1,612
48
##################################################################################################################### # Date created : 10/21/2022 # Date modified: 10/21/2022 # Purpose : To extract feature from DSSP file ############################################################################################...
e4b6d14e3cbf4641dd1255018e0aed603bebdeb4002e78ecddd3a3f7ea09a23f
Python
1,613
61
import sys srcPath, origPath = sys.argv[1:3] punc = ["-LRB-", "-RRB-", ",", "-", ";", ":", "\'", "\'\'", '\"', "`", "``", ".", "!", "?", "-RRB-", ",", "-", ";", ":", ".", "!", "?"] def depuncWrd(wrd): for p in punc: wrd = wrd.replace(p, '') return wrd with open(srcPath, 'rb') as f: srcTokMeasure...
f42712bd7a281ca02892de07fa7f1493d67c8646f6f610c1b710e8d81525b768
Python
1,613
52
import numpy as np import itertools from functools import partial from .utils import np_scatter permute_2 = partial(itertools.permutations, r=2) def line_graph(edge_index_G): """Return the (angular) line graph of the input graph. Args: edge_index_G (ndarray): Input graph in COO format. """ sr...