sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b921de5c6cc97c0d021d0c4dee95285d997bc6c677578dafe50bf00326d5786d
Python
4,017
91
""" Module for opening and processing raw recording data from .h5 files. This module contains a function to open and process raw recording data, particularly from files generated by Multi Channel Systems (MCS). It handles large files by processing data in chunks to avoid memory limitations. Functions: file_opener...
d9d9c66be175521afb44543de859687d2221b4d5311a178e48ea308f34ef04c8
Python
4,017
159
import pdb from matplotlib import pyplot as plt import numpy as np import ray import yaml from yaml.loader import SafeLoader import torch from ray import tune from ray.air import session from ray.tune.search.hyperopt import HyperOptSearch from latent_time_stepping.AE_models.VAE_encoder import VAEEncoder from latent_...
54a17eb62d63947fc69e5591cbd758e844dcf96f598ad7d0a0d8e6ac5010c6e5
Python
4,021
124
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
4189249e7b176a62679bbc8f8bfc139a698d7c49edce6411f851141e7408b1bf
Python
4,022
121
import numpy import random import sys sys.path.insert(0, "..") from scipy import stats, special from sklearn.preprocessing import PolynomialFeatures from matplotlib import pyplot import matplotlib; matplotlib.use("MacOSX") from banditopt import algorithms # numpy.random.seed(42) # random.seed(42) class Sampler: ...
f3b9cba2a981e1a95d38be14dd5b32bab9b19781e1d69b8f461cb3386049ad0a
Python
4,022
110
import torch from torch import nn import torch.nn.functional as F class BatchDiscriminator(nn.Module): def __init__(self, input_dim, hidden_dim, hidden_layers, dropout, target_classes): super(BatchDiscriminator, self).__init__() self.layers = nn.ModuleList() for i in range(hidden_layers - 1...
77ce9c6ac2b193ad0fab1059a112e691d7af4794f5bb79354209af478792722c
Python
4,023
120
#!usr/bin/python """scDRS on each cell type alone.""" # wget https://figshare.com/ndownloader/articles/19312583/versions/1 # ---------------------------------------------- # scDRS (v1.0.2) scores on the multiregion data: # Updated: 06/21/23 # ---------------------------------------------- import os import scdrs import ...
1d406d2548de1b4eb6cc9c4ee17b8702676c48bc2127d3f21ac2ff1eaa95f316
Python
4,024
95
import argparse import scipy.stats as sts import numpy as np import pickle import functools as ft from datetime import datetime import general.utility as u import swap_errors.circus as swc def create_parser(): parser = argparse.ArgumentParser(description='fit several modularizers') parser.add_argument('-o', '...
250f94e9c401198752838bdf9813b54aea711ac2249222158222e51605eb1059
Python
4,024
116
# coding=utf-8 # Copyright 2023 HuggingFace 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 ag...
899df8bac64c502b1056fd330c2f09d449aae79fd11e0e6883d0b6fa6a808edc
Python
4,024
132
from data_profiling.config import Settings from data_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent from data_profiling.report.presentation.core import ( Container, FrequencyTable, FrequencyTableSmall, Table, VariableInfo, ) from data_profiling.report.presentation.frequency_table_...
06a89ba3c42b5fca72dfb15932ccbf857528137b350ab236007171750ba90ed5
Python
4,025
75
import os import argparse import subprocess from utils.tools import ROOT_PATH, absolute_path """ Train and test the SNN on a single run. The input directory must contain the datasets (training, validation, test) to the format <X_{set}.bin>, <y_{set}.bin>. Please see README for more details. The configuration paths mu...
f97a00b8128f4a95e18e00dfddc4190cd42e3fcb58a447b6ad9e247925ed7c62
Python
4,025
118
""" _*_ coding: utf-8 _*_ """ import pandas as pd import numpy as np import scipy.stats as st def hyper_geometric(distribution, sample_size, N_0, N_1, N_2, idx): x_0 = distribution.loc[idx, 'cluster_0'] x_1 = distribution.loc[idx, 'cluster_1'] x_2 = distribution.loc[idx, 'cluster_2'] n = distribution....
a6a98980ffa4f1b9bf3f104508459415863130008d68b50de66b90de04e30748
Python
4,026
85
import torch as th import numpy as np import scanpy as sc import scipy as scp from sklearn.model_selection import train_test_split from .utils import normalize, sparse_mx_to_torch_sparse_tensor from .dataloader_utils import handle_adata_view, ensure_csr_csc class ANVIDataset(th.utils.data.Dataset): def __init__(...
135aaabf74547e5c7aa71e8a3e45b87ee4c68eda663cf8d99b55a23608f65461
Python
4,028
93
"""Columns a reader appends to each batch instead of reading them. ``include_paths=True`` adds a ``path`` column and ``include_row_hash=True`` adds ``row_hash``; a checkpoint ID column is the next one. Each used to be a boolean on the reader plus four hand-written steps: advertise the column in the schema, keep pyarro...
2ae9ca8181f3a1e79c9f3e9c6471ca109b34669967ebc82c7ca3b40e106df01f
Python
4,031
123
from typing import List, Optional from data_profiling.config import Settings from data_profiling.model import BaseDescription from data_profiling.report.presentation.core import Container, CorrelationTable, Image from data_profiling.report.presentation.core.renderable import Renderable from data_profiling.visualisatio...
5f4b02de9784a6c6fd4c7298103d7e9aa981f37b55e5a1b46563a227bab3c890
Python
4,031
117
r"""Sample normalization for metabolomics. All methods scale each **sample** (row) to make inter-sample comparisons valid despite differences in dilution, injection volume, or total extracted material. They do NOT touch between-feature scaling (that's `_transform.py`). Methods ------- - **PQN** (Probabilistic Quotien...
2c7bcc38894e0a74fe775e558bf6297d69c795f504b836477a938b95946729d9
Python
4,032
153
#! /usr/bin/env python # altschulEriksonDinuclShuffle.py # P. Clote, Oct 2003 # NOTE: One cannot use function "count(s,word)" to count the number # of occurrences of dinucleotide word in string s, since the built-in # function counts only nonoverlapping words, presumably in a left to # right fashion. import sys,rando...
b7b6c0b01324449539a66bb988310106000e2e711e239fba78aa9fd583afa5cd
Python
4,032
105
from scipy.sparse import csr_matrix,issparse import numpy as np import os from tqdm import tqdm import pandas as pd from .._registry import register_function @register_function( aliases=["CAST", "空间CAST", "CAST整合", "spatial_cast", "空间样本嵌入"], category="space", description="Learn shared spatial embeddings ac...
f7d984a8565d4fe3ed5dd5835e62f4e3c54339d603b270ce6f63b9f1183ce0fa
Python
4,033
110
from pickle import FALSE from datagenerator_pd import DataGenerator from sklearn.metrics import confusion_matrix, accuracy_score from tensorflow.keras.utils import to_categorical import matplotlib.pyplot as plt import seaborn as sns import SimpleITK as sitk import pandas as pd import numpy as np import random ...
45e7c04980f5b12b85556c3633a05be9dd59538063c177e6ebb35ae842f16fd9
Python
4,035
113
# MNIST Hand written digit tensor maps import os import sys import gzip import pickle import logging from typing import Dict import h5py import numpy as np import tensorflow as tf from skimage.transform import resize from ml4h.TensorMap import TensorMap, Interpretation from ml4h.normalizer import ZeroMeanStd1 def i...
c67cbc57b8394359296fe767cfebf9933b665099503943f122ffda3fe740a50c
Python
4,035
137
import unicodedata import string import re SOS_token = 0 EOS_token = 1 class Lang: def __init__(self, name): self.name = name self.word2index = {} self.word2count = {} self.index2word = {0: "SOS", 1: "EOS"} self.n_words = 2 # Count SOS and EOS def addSentence(self, ...
753e378df366f18b00bd095f1984400e972c11d0275be54fcdf3cd6508dafad3
Python
4,036
103
# In[ ]: import os from numpy import interp from scipy.stats import stats import tensorflow as tf from tensorflow.keras import initializers from tensorflow.keras.layers import Layer, InputSpec from tensorflow.keras import backend as K from tensorflow.keras.layers import * from tensorflow.keras.models import ...
8b90922e468678a5969368e6664ea90a9d2be95938a01dc3db2f36da4b00c2c9
Python
4,036
102
# __replica_rank_start__ from ray import serve @serve.deployment(num_replicas=4) class ModelShard: def __call__(self): context = serve.get_replica_context() return { "rank": context.rank.rank, # Access the integer rank value "world_size": context.world_size, } ap...
6174593707a1f0d46aa1ca79ae2378212f27c846993a79b476e7820973cb4118
Python
4,037
112
import numpy as np import pytest from siapy.entities import Pixels, Shape, SpectralImage from siapy.utils.signatures import get_signatures_within_convex_hull from siapy.utils.plots import display_image_with_areas def test_get_signatures_within_convex_hull(configs): raster = SpectralImage.rasterio_open(configs.im...
654f3083d4114af371fa610fefd706cebcff8afe63567a0896ae103e906ab421
Python
4,038
153
import pdb import numpy as np import matplotlib.pyplot as plt import ray from data_assimilation.particle_filter.base import BaseForwardModel from data_assimilation.test_cases.multi_phase_pipeflow_with_leak.PDE_model import PipeflowEquations def compute_forward_model_PDE( forward_model, state: np.ndarray, ...
6f57c7736c8869c5f745f30b03c38f81564e7494e12a40710caad9313b33a39d
Python
4,041
88
import os import json import numpy as np import pandas as pd import nibabel as nib from permutations_stats.permutations import friedman from scipy.stats import wilcoxon tissues = {'WM':3,'CGM':2,'DGM':4,'CSF':1} titles = {'WM':'White matter','CGM':'Cortical gray matter','DGM':'Deep gray matter','CSF':'Cerebrospinal fl...
5163ec328863744e236476dddba95a55f9144850912c2cb9ce410616a70f63bf
Python
4,043
104
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals, absolute_import, division from collections import OrderedDict from warnings import warn from ..utils import _raise from ..utils.six import Path from ..utils.tf import keras_import get_file = keras_import('utils', 'get_file') _MODELS = ...
64744e4eac0e415d7e206aa7bcd9131f7cda7fa0ca12c115c2812ffe6217eeb8
Python
4,044
113
""" Created on Fri Jan 14 19:26:23 2022 @author: trmabdelaal """ import scvelo as scv import scanpy as sc import numpy as np import pandas as pd from matplotlib import pyplot as plt from sklearn.metrics.pairwise import cosine_similarity import sys sys.path.insert(1,'SIRV/') from main import SIRV # lo...
8baa391e63340023a1aa6be7edccbab7a27b553ca15a40091752de7c498071c4
Python
4,045
111
# coding=utf-8 # Copyright 2023 HuggingFace 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 ag...
d3245aacd26dc4c5a3d21d71cb8b5b03ba1b83d5dded0e004cce2353ac3ec998
Python
4,045
78
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 22 11:06:59 2022 @author: YaoMeng script for fetching neuromaps images and transform to MNI 152 2mm space. """ from neuromaps import datasets, nulls, transforms from neuromaps.datasets import fetch_annotation from neuromaps.parcellate import Parcel...
3085aad1da0785564f351268f9c2797e5cf132a7749479400665842ac6e21ce3
Python
4,046
125
import os import numpy as np from spinnaker2 import hardware, snn from spinnaker2.mla import conv2d, mla_helpers def test_conv2d_if_neuron_rate_code(): rng = np.random.default_rng(42) # fails for seed = 12 # parameters of convolution layer in_width = 28 in_height = 28 in_channels = 1 out_ch...
d83d2ff2dcfa688fd12cfff164dfc87d0012c596bab1155a9e7d7ee5312c6e18
Python
4,048
127
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. # pylint: disable=too-many-instance-attributes """Forward / backward / update related parameters for resistive processing units.""" from dataclasses import dat...
8dcc8caf85159b0a031b3ba0c23f4fceb409ef647efb6c1d53f9229c254fb8ec
Python
4,049
171
#!/usr/bin/env python # coding: utf-8 # In[1]: import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from allensdk.brain_observatory.ecephys.ecephys_project_cache import EcephysProjectCache # In[2]: # this path determines where downloaded data will be stored manifest_path = os.path.j...
bbc053eafcea2f82fe1ba3a6bc77aa32f152bb4932687835a44d0939c20b0018
Python
4,049
118
from typing import Optional, List import numpy as np from neuron_morphology.feature_extractor.data import Data from neuron_morphology.features.statistics.coordinates import COORD_TYPE from neuron_morphology.feature_extractor.marked_feature import marked from neuron_morphology.feature_extractor.mark import Geometric ...
4f511857e9ff2d734af2d7d24eeafd7cc25b017f2dcd5af68a5086389f7ca690
Python
4,050
121
import argparse import numpy as np import optuna from optuna.integration import SkorchPruningCallback import skorch import torch import torch.nn as nn import pandas as pd from sklearn.datasets import fetch_openml from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split device = "...
2167f3127e2f25540b0c9b7c8dbfecd8fb0fb950a2ed5e384abfb0007110b81e
Python
4,051
110
import numpy as np import torch import argparse import pickle from eval_fns.eval import batched_compute_convolutional_masked_ms_ssim, Masked_MS_SSIM, \ batched_computed_convolutional_masked_LPIPS from lib.data_utils.sta_metadata import compute_convex_hull_of_mask from lib.dataset_config_parser.dataset_config_pars...
94421706613d3890e66d3106b105523a756cf61f158710d9f0e0dbf1012dde41
Python
4,051
112
import yaml import scipy import pickle import argparse import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt def bootstrapped_return(x, y, stride, total_steps, confidence_level=0.95, to_bootstrap=True): assert len(x) == len(y) num_runs = len(x) avg_ret = np.zeros(total_steps // stride) ...
4fd4cbf2c03633c2b77ed543fcb3dea7c4375e52d388ad02bf47a4566b3fb4ae
Python
4,052
120
#!/usr/bin/env python from __future__ import print_function # batteries import sys import gzip import argparse import logging from time import time # 3rd party from lxml import etree # argparse desc = 'Convert UniRef XML to fasta. Mostly to rebuild previous UniRef databases' epi = """DESCRIPTION: A simple script to co...
9872a39492a2c5e91ed4b7d7b1cc95c5d78ab9d99bb4331bcc20c95308e6d17c
Python
4,052
135
# -*- coding: utf-8 -*- import numpy as np import sys import os from pathlib import Path from vtkplotlib.plots.BasePlot import ConstructedPlot from vtkplotlib import nuts_and_bolts class Surface(ConstructedPlot): """Create a parametrically defined surface. This is intended for visualising mathematical funct...
5ff2a424a75b3345f3b336f32192fd9520fa1fe5305c7cbd6f7d209c527eece8
Python
4,054
85
from loguru import logger import os import numpy as np from deltasplice.utils import parse_bed_line import json def annotate(Lines, WDict): for line in Lines: Fa, Chr = line[:2] if Fa not in WDict: WDict[Fa] = {} if Chr not in WDict[Fa]: WDict[Fa][Chr] = {} ...
d5ca5f0e1a6535e0c6644e4ce33f7418025be668d9d382bd081d4d026b95223d
Python
4,054
114
from __future__ import annotations import logging from pathlib import Path import numpy as np import pandas as pd import scanpy as sc import scipy as sp from ._config import CauchyCombinationConfig from ._style import Colors, EMOJI logger = logging.getLogger(__name__) def acat_test(pvalues, weights=None): """...
66db9281e6722aa1898adeeca296783f9d3cd95d9320d6b6b0be4e32d5e56228
Python
4,055
120
import nibabel import numpy as np from numpy.random import default_rng from nilearn.maskers import NiftiMasker from numpy.testing import assert_array_almost_equal def zero_mean_coefficient_determination( y_true, y_pred, sample_weight=None, multioutput="uniform_average" ): """ Calculate ratio for y_true, y...
366fde268f7990275fe3038837eb139139534883a2d8312a443458162c4abb11
Python
4,058
122
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
25314abdde5575d07ba66274bf4d7961c2924130cd1750a0cd8fa7c8954c1d00
Python
4,060
91
from multiprocessing import Pool import os,time,random import datetime import numpy as np python_file=r"/mnt/disk1/scfan/software/anaconda3/envs/ImputeHiFI/bin/python" def run_with_one_function(title,args_list,p_num=1): from datetime import datetime # print('start run step one prepare data spatial_dist_bin_p...
e5b8d89b1473255df3286bad4bdafb8038900d075ec38c16a5a5d0c205244651
Python
4,060
131
# -*- coding: utf-8 -*- """ Created on Mon Jul 10 14:49:57 2023 @author: Leyang Xue """ import sys import numpy as np import os # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercolation as kp # Import custom util...
ae6f168db14c9b35b315aadb43787dd285b61f720638670e26123840f9522939
Python
4,062
121
_base_ = [ '../../_base_/datasets/urpc2020/urpc2020-validation_coco_detection.py', '../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py' ] # model settings model = dict( type='FasterRCNN', data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 10...
2f6f0da3f1f4d140b186db89b678df7804f2d96c3f749502de50c88c9476d6d9
Python
4,063
117
import pandas as pd from typing import List import copy # func_name: func_name is process each element in each column, instead of the whole column def process_col(input_df: pd.DataFrame, col_name: str, func_name): if col_name in input_df.columns: input_df[col_name] = input_df[col_name].map(func_name) ...
6a748b5a83d0fede4269f20036d42c3fa25961b3a5ad5802601fc158dc036e9d
Python
4,063
102
import numpy as np from typing import List, Callable, Tuple, Union, Dict NSCENES_STIXEL_SIZE = 2 def make_upsample_wn_to_nscenes_noflip(upsample_factor: int) -> Callable: ''' Makes a callable function that upsamples a filter matrix from STA coordinates into nscenes stimulus coordinates :param up...
65e70122f41355b8a8313272734902cd020293df8f160a1df5115544f964317d
Python
4,064
85
import numpy as np import oddt from oddt.utils import is_openbabel_molecule from oddt.interactions import close_contacts from oddt.fingerprints import _ECFP_atom_repr import torch_pgn.graphs.graph_utils as gu """ Functions to output basic atom representations. """ def featurize_atoms_ECFP_like(molecule, index_list,...
764268c8d9a2954c2e3ca2e7929bf9134564dbe05a239bf3fc5d293e216a46eb
Python
4,064
132
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import importlib.util from pathlib import Path import pytest # Import docs/check_links.py directly by...
a3008af77294dfb0d3b7adc868f3fe570fcc84b268f24182d5702a02191cd20c
Python
4,064
147
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import importlib from copy import copy from pathlib import Path from typing import Any, Self import rq from rq import Retry from rq.job import Job as RQJob from rq.job import JobStatus from cvat.apps.redis_handler import signals class DetachedJob...
f58b362c763be0a53116a5400a49ad930cd69b2f8ad3c425f635b8658ae08373
Python
4,064
117
#!/usr/bin/env python # -*- coding: utf-8 -*- # freq """ """ import argparse from collections import deque, defaultdict import numpy as np import pandas as pd import pysam import svtk.utils as svu def process_metadata(vcf, outlier_sample_ids): n_samples = len(vcf.header.samples) called_counts = dict() ...
769ca3709cf2ebd7f29a8d01626198a81aadec078a2cbba6da1e25f2b7e893a3
Python
4,065
136
""" Test for issue 1429: https://github.com/Data-Centric-AI-Community/data-profiling/issues/1429 """ from typing import List, Optional, Tuple import numpy as np from pyspark.sql import DataFrame, SparkSession from pyspark.sql import types as T from data_profiling import ProfileReport from data_profiling.config import...
cf12b1c3b23c8be826e849b7c3743e1d1536de18d41e32706773bd4136ed12da
Python
4,066
92
import sys, os import argparse import concurrent.futures as cf import numpy as np import pandas as pd import torch os.environ.setdefault('PROJECT_DIR', ".") sys.path.append(os.environ['PROJECT_DIR']) from src.models.model_whole import prepare_model, add_model_args from src.features.tokenizer import load_tokenizer from ...
19a0223482a0854dd1cbcf22d111693fca415f680638454b0cbaeac316886640
Python
4,068
128
import numpy as np import warnings from ..utils import coms_list_to_matrix __all__ = [ 'symmetric_jaccard', 'overlapping_nmi', ] def symmetric_jaccard(coms_1, coms_2): """Quantify agreement between two community assignments based on symmetric Jaccard similarity. Computed as in the CESNA paper as ...
6f445d69ec2e49e4ed9d8922369c8f5181d47245d9b892a365eaec99a9e701fa
Python
4,068
127
import subprocess from datetime import datetime, timedelta from typing import Any, Dict, List, Optional, Tuple from pybuildkite.buildkite import Buildkite BRANCH = "master" BLOCK_STEP_KEY = "unblock-me" class GapFillingScheduler: """ This buildkite pipeline scheduler is responsible for scheduling gap fillin...
eb8dbda3e8d5dbfb8b5864661ea525e1b5e16e81a4ae410faa0c5cffbe624517
Python
4,068
123
# -*- coding: utf-8 -*- # Development work, e.g. for higher level functions. # These functions are not intended to work on any machine or pass the tests. # They are early drafts (e.g. of higher level workflows) intended to be shared among select collaborators or multiple machines of one collaborator. # Please don't ed...
81c2382f3af6dae41437f1e9dd7f31c9a4d585347d62869cd6f223b2bf2a57a5
Python
4,069
121
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
ee23639e79f5e8ec62fd7f0b2a3bf47dbe64b9a5e653c1d4f0b9e6ef5779442b
Python
4,070
117
import numpy as np import torch import torch.nn as nn from .layers import * from .modules import * class RepeatedModule(nn.Module): def __init__(self, n_layers, d_model, n_head, d_k, d_v, d_inner, dropout=0.1): super().__init__() self.linear = nn.Linear(128...
c58218a9daebccb8aa267b1337e539390b84611a8e2596f005fb5d4231de13e6
Python
4,071
131
from unittest.mock import patch import pytest from flyvis_cli.flyvis_cli import ( SCRIPT_COMMANDS, filter_args, handle_help_request, main, ) def test_filter_args(): # Test filtering out commands from arguments argv = [ "--ensemble_id", "0001", "train", "--task...
d333f15dc6dc55ce297d3aff240b3645bd31e8251270ec6b5b7e3557f9a2fc82
Python
4,071
111
#################################################################################################### # Copyright (c) 2020, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is free softw...
d602e900dd9946524ebb80862d4e781913019734ed2d9f1bedef1fafa20e50bc
Python
4,072
116
from keras.utils import Sequence import numpy as np from csbdeep.models import CARE from csbdeep.utils import _raise, axes_check_and_normalize, axes_dict import warnings def augment(x, y): rot_k = np.random.randint(0, 4, x.shape[0]) X = x.copy() Y = y.copy() for i in range(X.shape[0]): if np...
efb7adabfc09933249e05636fb11d934abd158e4c5e70c5105537f0f7e45dc3a
Python
4,074
121
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
68615c629a17d44c5f004880da935f9a8163c2d326b099678545af8a399abb44
Python
4,075
128
import os import numpy as np import pytest from scipy.special import logsumexp from endstate_correction.smc import SMC from .test_system import setup_ZINC00077329_system @pytest.fixture def _am_I_on_GH() -> bool: # will return True if on GH, and false locally if os.getenv("CI") == None: return Fals...
cf3b1660c8d610f60a69a48cb1b3db4f7cd60701bdc876118b23f18dc23b2627
Python
4,076
106
from typing import Optional import numpy as np from ray.data._internal.datasource_v2.common.file_reader import FileReader from ray.data._internal.datasource_v2.interfaces.file_manifest import FileManifest from ray.data._internal.datasource_v2.interfaces.in_memory_size_estimator import ( InMemorySizeEstimator, ) f...
c7f4cec5ba0cf342b60353cadbf4a0675115c5030c4e0aaf369ec5264123b14a
Python
4,077
122
import nir import torch import torch.nn as nn import sinabs.layers as sl from sinabs import from_nir, to_nir def test_iaf(): batch_size = 2 iaf = sl.IAFSqueeze(batch_size=batch_size) graph = to_nir(iaf, torch.randn(batch_size, 10)) converted = from_nir(graph, batch_size=batch_size) assert len(gr...
a5896be0882dcc3547d5a318942ee18469ccbeb158b717b7fdbd13dd823479c8
Python
4,078
107
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
1b6d84d43b5e60fa93fa807f6cc542775159fecde2c79c293711c54003535915
Python
4,079
176
# flake8: noqa # __begin_starlette__ import starlette.requests import requests from ray import serve @serve.deployment class Counter: def __call__(self, request: starlette.requests.Request): return request.query_params serve.run(Counter.bind()) resp = requests.get("http://localhost:8000?a=b&c=d") asser...
ccea855446b5d95d43220747731fb741e5d4b6b64cddef05301586b4bd3c6c02
Python
4,079
101
import torch import logging import re from torch.utils.data import TensorDataset from sklearn.model_selection import train_test_split from agent.data.entities.config import FD_CLASS_VALUES, ITEMS_TABLE from agent.data.entities.config import TRAIN_ITEM_FILTER, TRAIN_LABEL, TEST_ITEM_FILTER from agent.data.entities.con...
3bf2ed33241307be73d296643d6e6555082cccef95baf29d516628ff7cfb749f
Python
4,080
114
import numpy as np def toUint8(data): data=np.real(data) data=data.astype(np.double) ma=np.max(data) mi=np.min(data) data=(data-mi)/(ma-mi)*255 data=np.clip(data,0,255) data=data.astype(np.uint8) return data def toUint16(data): data=np.real(data) data=data.astype(np.double) ...
9899f09c1af8fbced269f51ffefadc868bd9966daf966ec7ae80a7e981d282e5
Python
4,082
111
"""MAFFT wrapper for multiple sequence alignment. Wraps the real ``mafft`` CLI (https://mafft.cbrc.jp/alignment/software/). Install via ``conda install -c bioconda mafft``. Input: one FASTA with the sequences to align (typically ASV centroids produced by :func:`omicverse.alignment.vsearch.unoise3` / ...
a6d8354ac13ff108857d01f6198f764284821acb007ef26ba83968601b84af70
Python
4,083
110
import rdkit import rdkit.Chem as Chem import numpy as np elem_list = ['C', 'N', 'O', 'S', 'F', 'Si', 'P', 'Cl', 'Br', 'Mg', 'Na', 'Ca', 'Fe', 'As', 'Al', 'I', 'B', 'V', 'K', 'Tl', 'Yb', 'Sb', 'Sn', 'Ag', 'Pd', 'Co', 'Se', 'Ti', 'Zn', 'H', 'Li', 'Ge', 'Cu', 'Au', 'Ni', 'Cd', 'In', 'Mn', 'Zr', 'Cr', 'Pt', 'Hg', 'Pb', '...
9934556d06c552d1a8ce23dec6e72d3aa04eb040dc0d213ee9b84dd96c981d9e
Python
4,084
116
"""An explicitly supplied zero threshold is distinct from the default.""" from types import SimpleNamespace import cv2 import numpy as np import pytest from deepface.modules import modeling, recognition, verification from deepface.models.FacialRecognition import FacialRecognition @pytest.mark.parametrize("threshol...
888efdcc4bd7280d2ba24fe223def9bb3d1198a54709e9d491a10eeefa1073f4
Python
4,085
124
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations import torch EPS = 1e-7 class Safeacos(torch.autograd.Function): @staticmethod def forward(c...
dbdc1a31dde4aaba2cef9641223066653c46c33fe2c8bd7786cafa2611e1a773
Python
4,085
135
from __future__ import annotations from typing import TYPE_CHECKING import torch from torch import nn from torch.profiler import record_function if TYPE_CHECKING: from fairchem.core.models.allscaip.configs import ( GlobalConfigs, GraphNeuralNetworksConfigs, MolecularGraphConfigs, ...
11bec089a339f9298c7735726077643b02a19fd28501c1d61af7541794fbd3eb
Python
4,086
110
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
bcc160d9ddae34002b151921aaf29f9422539a621ab7a7bea42971f4bececcb1
Python
4,086
106
import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd import os def handle_duplicate_names(path): # pre: path has '/path/to/file(optversion).ext' filename, extension = os.path.splitext(path) count = 1 while os.path.exists(path): path = filename + '(' + str...
014067f85df1b634984834f0f1cceb321b7f48c5bf327e9737a0cfffa7844afa
Python
4,087
114
#Test generate from src import generate import glob import geopandas as gpd import pandas as pd from deepforest import main import rasterio import pytest import os import distributed import numpy as np def test_predict_trees(rgb_path, plot_data): m = main.deepforest() m.use_release(check_release=False) box...
8f45feac70ff960840f2b0136ea053c8358aad18d8b0b96dfeb6e10dce545a69
Python
4,088
117
import numpy as np def uot(mu, nu, c, epsilon, niter=50, tau=-0.5, verb = 1, rho = np.inf, stopThr= 1E-7): lmbda = rho / ( rho + epsilon ) if np.isinf(rho): lmbda = 1 mu = np.asarray(mu, float).reshape(-1,1) nu = np.asarray(nu, float).reshape(-1,1) N = [mu.shape[0], nu.shape[0]] H1 ...
24f2f426cd8aca981a7c47702e2557af957f0e274237b6a047df5b27f2974fc4
Python
4,089
139
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import logging import numpy as np import plyfile import skimage.measure import time import torch import deep_sdf.utils def create_mesh( decoder, latent_vec, filename, N=256, max_batch=32 ** 3, offset=None, scale=None ): start = t...
9687d7510f5a64ceb61817cc3e06b567668de51a82816b8ee53155faed660f6e
Python
4,089
152
from __future__ import annotations import warnings from typing import Optional, Union import numpy as np import scipy.sparse as sps from anndata import AnnData from scipy.sparse import spdiags from ._utils import sample_obs_key, spatial_connectivity_key, str2list def _aggregate_mean(adj, x): return adj @ x d...
e0337f92dd675a10ad0d9b225d0d2c8612ce713fbf4a8e40ea8deee395aae2c9
Python
4,089
115
# modified from https://github.com/facebookresearch/deit """ Train and eval functions used in main.py """ import math import sys from typing import Iterable, Optional import torch from timm.data import Mixup from timm.utils import accuracy, ModelEma import utils def train_one_epoch(model: torch.nn....
384d8c6fc919b94b781df9ec9f832d46c97cb2162bc1b851ec4de34e78a7c031
Python
4,091
130
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations from dataclasses import MISSING, dataclass, field, fields, is_dataclass from typing import Literal @d...
47b3ce26bf3447c6776cde607760f1aa7bc3b2441dfb0e5a1418fc379cfc06c8
Python
4,091
125
#!/usr/bin/env python """ Collect bincov matrix metrics. Writes stats to stdout. Metrics: bincov_matrix_intervals : number of intervals (rows) bincov_matrix_intervals_all_samples_zero : number of intervals that were 0 across all samples bincov_matrix_intervals_at_least_one_zero : number of intervals with 0 in a...
85a1776d918b466693f3fba3f4e4b3e09145c63801302ffb39b234d9fb18d285
Python
4,091
121
''' Created on Sep 15, 2015 @author: jivan ''' import re valid_amino_acid_chars = 'acdefghiklmnpqrstvwyACDEFGHIKLMNPQRSTVWY' class FASTASequenceInput(object): @staticmethod def valid_sequence_text(text): ret = True if '>' not in text: ret = False sequences = text.split('>')...
274b9cbca5fa4b547f56db677a4d59f5626aee8a489b7355d54d8aee64ff5718
Python
4,092
122
import numpy as np import os from .loadNetworkForAnalysis import loadNetwork from ..analysis import parse_activity from ..io import SAVED_DIR def spike_rates(activity, window_size=20, start_time=0, end_time=300): n_units, n_trials = activity.shape n_bins = int((end_time - start_time) / window_size) firing...
61dc7123b8388fb81d644ff52fbbb79dc01589b0e7a7f2b4554d0001869d229b
Python
4,093
92
from collections import deque from typing import Dict, Optional from ray._private.telemetry.open_telemetry_metric_recorder import ( OpenTelemetryMetricRecorder, ) from ray.core.generated import events_event_aggregator_service_pb2 from ray.dashboard.modules.aggregator.constants import AGGREGATOR_AGENT_METRIC_PREFIX...
807e0fc2d96e319dd00e3ada04105fe704ff6c778cd1db8fa50433401453a4bb
Python
4,093
86
import pandas as pd import dill as pickle from lib5c.util.system import check_outdir from hic3defdr.analysis.core import CoreHiC3DeFDR from hic3defdr.analysis.analysis import AnalyzingHiC3DeFDR from hic3defdr.analysis.simulation import SimulatingHiC3DeFDR from hic3defdr.analysis.plotting import PlottingHiC3DeFDR cl...
e1aad79e8a749ecf176df3d09d3c5b2ddf4afcd44e1e72fbad340b2f0cd3c9fd
Python
4,093
99
# Auxiliary functions import pandas as pd def process_response(response, fail_msg, ret_format=None, attribute_ids=None): if response.status_code == 200: if response.text and response.text != '[]': # Check if the response body is not empty try: data = response.json() ...
4a53f22b0bb268bc47d4172305f102447cf2ff931e3a287c72953098b16ba560
Python
4,094
119
""" This module contains functions to load and clean the human experimental data from the data/paths directory. """ import os import numpy as np import scipy.io import random def load_data(): """ Loads all available subject path data from the data/paths directory and returns the data as two dictionaries, ...
c3db119a5cb7fe57430e650339927f5488a5b48f4172577b4c45f8d5359f7df3
Python
4,095
119
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class EulerDiscreteSchedulerTest(SchedulerCommonTest): scheduler_classes = (EulerDiscreteScheduler,) num_inference_steps = 10 def get_scheduler_config(self...
3ce2b03af2af65ec1a35c4fdb15d22984c40424919d084625856a5cb4a438c55
Python
4,099
123
import numpy as np import torch from torch import nn class GaussianHeadWithStateIndependentCovariance(nn.Module): """Gaussian head with state-independent learned covariance. This link is intended to be attached to a neural network that outputs the mean of a Gaussian policy. The only learnable parameter t...
47f800d76d9cfb366c3c06408bd8dcdf50de97b27e599db7d08b030d24f2d32c
Python
4,100
130
import importlib import importlib.machinery import sys import types from stl._compat import ascii_read, ascii_write, has_speedups def test_has_speedups_returns_bool(speedups): result = has_speedups() assert isinstance(result, bool) def test_ascii_read_type(speedups): # ascii_read is either None (no spe...
f0f5e449c366983142208e42dd2429a12de1c828530f8668db5b5d809564c7a8
Python
4,100
112
import yaml import scipy import pickle import argparse import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt def bootstrapped_return(x, y, stride, total_steps, confidence_level=0.95, to_bootstrap=True): assert len(x) == len(y) num_runs = len(x) avg_ret = np.zeros(total_steps // stride) ...
9124485083ba4528848a5a86ffcdc2ed5612ace65aaf7c7c8b311ab401ff19c3
Python
4,101
145
import argparse from collections import defaultdict import sys from Bio.SeqIO import parse import matplotlib.pyplot as plt from os.path import * import numpy as np def main(): args = parse_args() fqs = [(basename(fq),parse( fq, 'fastq' )) for fq in args.fastqs] plot_fqs( fqs, args.output ) def plot_fqs( i...
0264e03adb1bd02be952db7bc53444f4a866faddc4c25732589260214df527c9
Python
4,102
136
import os import boto3 import json import configparser from zipfile import ZipFile, ZIP_DEFLATED from io import BytesIO from argschema import ArgSchemaParser from neuron_morphology.pipeline._schemas import InputParameters def get_credentials(credentials_file): """ get credentisals from credentials_file Pa...
7c5e6cde8d433a1ad5e0f8cf86bdbb2af39513c742cb774e8de0c9ef68f0647a
Python
4,102
150
import nir # import nirtorch import torch # import numpy as np import lava.lib.dl.slayer as slayer import snntorch as snn import numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [10, 2] plt.rcParams["figure.dpi"] = 200 dt = 1e-4 scale = 1 << 6 # general params lif_size = 2 vthr = 1.0 # ...
94a6bd9021799909d4a0eb8b1e8b1bdfe762e5b0fab211e2d24ce1a8bb7a360a
Python
4,103
114
import os from importlib import resources as impresources from pathlib import Path from string import Template import pandas as pd from ... import bids from ...bids.convert2bids import BidsConverter from ...eeg import Eeg from ...load_annotations.chbmit import loadAnnotationsFromEdf BIDS_DIR = impresources.files(bid...
0d41c617ada58f9ce4352569bb56b6416fd10db7f8c8c26ce407ffa870bd5b3b
Python
4,104
114
from __future__ import annotations """Training helpers for the vendored gsMap graph attention model.""" import logging import time try: import torch import torch.nn.functional as F _TORCH_AVAILABLE = True except ImportError: _TORCH_AVAILABLE = False from tqdm.auto import tqdm from .._style import Co...
0e5d92c6402704d98c3ecbd8a062fbafeff6a3b5df0eb3b36330b61f215519c4
Python
4,106
126
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code adapted from GCPNet (https://github.com/BioinfoMachineLearning/GCPNet): # ---------------------------------------------------------------------------------------------...
4aed9b3d17597a1b3ed105c49ac54da7318dd351ddc35bde92f8ec61a194b50e
Python
4,107
116
CODE_DIR = '/home/kelarion/github/' SAVE_DIR = '/mnt/c/Users/mmall/Documents/uni/columbia/assignment_errors/' import socket import os import sys import pickle as pkl import numpy as np import scipy as sp import scipy.linalg as la import scipy.io as sio from sklearn import svm, manifold, linear_model from sklearn.mode...