sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
33e584d847febf2d800f7d2001c8f10036063288905abefd447d48aa95328b08
Python
7,448
176
# 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...
3222692818e8c7cc789a5caa5042f6e978367b7f4606ea404c4c0e18bb5f33e0
Python
7,453
234
"""Base API client with common functionality for all bioinformatics databases.""" import asyncio import logging import time from abc import ABC, abstractmethod from typing import Any, Dict, Optional, Union from urllib.parse import urljoin import httpx import requests from requests.adapters import HTTPAdapter from url...
d9ad7bc6093f64b33bced36fb204270a481aec0d22422116dc28fe7ccc82763f
Python
7,453
151
# Usage: python get_xy_data_cnn_combine_from_database.py bulk_gene_list.txt sc_gene_list.txt gene_pair_list data_separation_index_list bulk_expression_data sc_exprsssion_data flag (0, no label. 1, label) # command line in developer's linux machine : # python get_xy_label_data_cnn_combine_from_database.py bulk_gene...
c04353045fdafde7db932585d0ec55a056dffbe4c57ac70695b6b81b7c9efe8e
Python
7,454
217
""" Mosaic for Horizontal Cells from (Keeley et al., 2020) Figure 8-1. """ from glob import glob import numpy as np import matplotlib.pyplot as plt from OPIPP import * CELLNAME = "Mouse Horizontal Cell" EDGE_LEN = 300 # the length of two sides scope = Scope(min_x=0, max_x=EDGE_LEN, # x-axis min_y=0, ...
0444ac961d9c39dd631887b9e4ef7c91d64923a44f44d7aeb86fad8fb1367a92
Python
7,455
225
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Read-only and placeholder tensor views for analog tile weights.""" from typing import Any, Callable, Optional from torch import Tensor from torch._C import ...
6bab909fdc53d41795f98306ea906e4e703da8914844500c24cdd1da45256b95
Python
7,455
179
#################################################################################################### # Copyright (c) 2020, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # Eleftherios Zisis <eleftherios.zisis@epfl.ch> # # This file is part of NeuroMorphoVis <https://githu...
e364cf5a33b7c7214a53acd3e1c7bea8ec1c241390e24615a2673a3f4403f66d
Python
7,456
157
import os os.environ['KMP_DUPLICATE_LIB_OK'] = 'True' import numpy as np import torch from model import Circuit, Circuit2D from utils import find_peaks, bin_traj from cluster_finding import find_cluster, find_cluster_2d from tqdm import trange import matplotlib import plt_config import matplotlib.pyplot as ...
0b212048cac7ca1f82ca5bf77cfaaa050805d30a37c2fc4ec0f6b67583070d58
Python
7,459
132
from collections import defaultdict from datetime import datetime import pickle from utils import str_to_datetime import pandas as pd def exclude(prescription_taken_by_patient, patient_dates, eligibility_criteria): # interval, followup, baseline, min_prescription): # patient_1stDX_date, patient_start_date # ...
d2898c2915243072afdbeb235576bd7bb79ed29e5cac0e5c30d8f465c9f31522
Python
7,459
216
# # Implement a a pipeline that re-tests significant associations but controlling for common variants import pandas as pd import pyranges as pr from pyarrow.parquet import ParquetFile import numpy as np import zarr from pathlib import Path from numcodecs import Blosc import logging from deeprvat.utils import pval_corr...
5d9a383282a1f0633ee5c4c8ffd070eb693a3f535bddc7e2bed75bc8017348c6
Python
7,460
161
import matplotlib.pyplot as plt import pickle import numpy as np import os from util import * from sklearn.metrics import auc, accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve, PrecisionRecallDisplay from sklearn import svm # define a function to calculate precision, recall, F1 score...
e50cc1d7f6ddfbd0a86583c1b3bca607fc3c73153cbe23ebec9418c5726f8b9e
Python
7,461
129
__author__ = "Simon Andermatt" __copyright__ = "Copyright (C) 2017 Simon Andermatt" import logging from copy import deepcopy import tensorflow as tf from tensorflow.python.ops import variable_scope as vs from mdgru.helper import compile_arguments, generate_defaults_info from mdgru.model import batch_norm from mdgru....
67dae589d0f688c00b1cef1bb368355979a021bae621b39bbdea0de0c5a80399
Python
7,464
260
""" 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 os from dataclasses import dataclass import numpy as np import torch from ase import Atoms from...
530cdabeda9a16907530a104818bd6a3ac5e4247d48577135dc6a518a345df4e
Python
7,467
224
import numpy as np import multiprocessing import xarray as xr from scipy.optimize import minimize import pandas as pd #from pybayesprism import process_input from .process_input import norm_to_one #from pybayesprism import references as rf from .references import RefPhi, RefTumor ###################################...
0a7091478a7f28cff55cc0445b514e3a5bf6f121051db587628095d3632c8b4f
Python
7,469
176
""" Uploaded August 2, 2023 """ import csv from itertools import zip_longest import shutil shutil.move("/PATH/inference_extraction.py", "/PATH/fastchat/serve/inference_extraction.py") from prompt_toolkit import PromptSession from prompt_toolkit.auto_suggest import AutoSuggestFromHistory from prompt_toolkit.completi...
b2b866ffdc55d796506392797ef1202f178a37f5a0a4ff4aac7b43ceb10fec6f
Python
7,470
352
# -*- coding: utf-8 -*- ### -------------- IMPORTS -------------- ### import numpy as np from numba import jit from scipy.signal import welch, hilbert from scipy.fftpack import fft ### ------------------------------------- ### @jit(nopython = True) def find_nearest(array, value): """ find_nearest(array, value...
bcf915246d50e90ef055fe0563002e3b7003a76e9c3399362687d1c2f5dc0a58
Python
7,475
143
import os import math import copy import pickle import numpy as np import pandas as pd from tqdm.auto import tqdm import dgl from .utils import preprocess_kg, create_split, process_disease_area_split, create_dgl_graph, evaluate_graph_construct, convert2str, data_download_wrapper import warnings warnings.filterwarnin...
a9105ab4f4281dc00852fdf6fe4afe47264d185d1b29fe82ed86dd963e2d9385
Python
7,476
243
# -*- 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. #...
aa63920e9fc41cd20eedd846096d49f0a8862ba2f1d002b5209c7fe2578bf445
Python
7,483
303
from typing import List, Tuple, Union import numpy as np from matplotlib.colors import ( LinearSegmentedColormap, ListedColormap, hex2color, to_rgba, ) from flyvis.analysis.visualization.plt_utils import color_labels from flyvis.utils.groundtruth_utils import polarity ON = "#af0019" # red OFF = "#00...
ab301f606145652b2e155179ed46a018d8331d83d71d03e1aa05ab4cdd58c9e3
Python
7,483
218
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from collections import OrderedDict from collections.abc import Callable from datetime import datetime, timedelta, timezone from typing import Any, TypeAlias, cast import attrs import cvat_sdk.auto_annotation as cvataa import PIL.Image from .agent_...
d5fce6d3c109f57272c6cd6f4f178a172f16d1a19cd62741679d3e1bd1f977bd
Python
7,485
170
from collections import defaultdict import logging from random import Random from typing import Dict, List, Set, Tuple, Union import warnings from rdkit import Chem from rdkit.Chem.Scaffolds import MurckoScaffold from tqdm import tqdm import numpy as np from .data import MoleculeDataset def generate_scaffold(mol: U...
cd9740a09f168a04cb2e6694fb46410447f94afd5fd1641cf5426d7ca2d89ee5
Python
7,488
204
import importlib.util from pathlib import Path import pysam import pytest MODULE_PATH = Path(__file__).with_name("merge_stripy_vcfs.py") MODULE_SPEC = importlib.util.spec_from_file_location("merge_stripy_vcfs", MODULE_PATH) assert MODULE_SPEC is not None assert MODULE_SPEC.loader is not None merge_stripy_vcfs = impo...
9bc64a1b2123361d30ec8923c0963f7b61da17ec6fef5484b5a1972db8a12cd4
Python
7,489
246
import numpy import plotly.graph_objects as go import matplotlib from matplotlib import pyplot from plotly.subplots import make_subplots from plotly import express from . import utils COLOR = "#87cdde" cmap = matplotlib.colors.LinearSegmentedColormap.from_list( name="space", # colors=["#45d7cd", "#ffc949"]...
99bd16a9535f7addffc27eb382d3e8bb94c821ecf2cf6c19a3f2f531daece48a
Python
7,490
248
# -*- 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. #...
5d68f9c265c483132a82a8ebd18f05b0b9eb7ee07ed85c3bdcdc53f6d4dbe10a
Python
7,493
231
"""Dataset utilities.""" from typing import List, Tuple import numpy as np from numpy.random import RandomState from torch.hub import download_url_to_file from torch.utils.data.sampler import Sampler import flyvis def random_walk_of_blocks( n_blocks: int = 20, block_size: int = 4, top_lum: float = 0, ...
b0888e2635855cbe54a89938c869dc86ee4e8f8571ff8e12459afbbbf0488c07
Python
7,493
224
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import time from util import log def initialize_weights(module): if isinstance(module, nn.Conv2d): nn.init.kaiming_normal_(module.weight.data, mode='fan_out') elif isinstance(module, nn.ConvTranspose2d): nn.init.kaiming_normal...
e54a2c80369e7f20e01016ef8316c91853dbe0ee2217f879886af872c15169f1
Python
7,495
228
# -*- coding: utf-8 -*- """ Created on Thu Apr 25 03:56:24 2024 @author: Leyang Xue """ import sys import numpy as np import matplotlib.pyplot as plt # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercolation as k...
4d9b8beb49096d028c06347cae2e96e131684e8caddc251b255394fc4b9f4918
Python
7,497
168
################################### # This python script plots the average score plot for the donors / acceptors # and their surrounding regions. ################################### import matplotlib.pyplot as plt import sys import numpy as np import os import pickle from sklearn.metrics import accuracy_score, confus...
2413c059aea127c2117a4a6da283e768d19e7d79fe1d8f5118e811de98547736
Python
7,498
291
import numpy as np from numba import jit from tqdm import tqdm import pandas as pd from scipy.stats import norm from scipy.sparse import issparse from statsmodels.stats.multitest import multipletests import multiprocessing from . import danb_model from . import bernoulli_model from . import normal_model from . import ...
3bceea91ef1e9140c213a245184be086dbbb27211c3ea89b6b2e3758123712ec
Python
7,498
183
import gym import numpy import random import os from gym import error, spaces, utils from gym.utils import seeding from matplotlib import pyplot from collections import OrderedDict import gym_sted from gym_sted import rewards, defaults from gym_sted.utils import SynapseGenerator, MicroscopeGenerator, get_foreground,...
d0a09a0b9a89acd03f094794ae6149141170596b667020340006019d06e03053
Python
7,498
223
import os from os.path import join import pickle import argparse import numpy as np import pandas as pd from tqdm import tqdm from pyplink import PyPlink from util import LATENT_DIR, get_latent_pkl, get_latent_bolt def main(): parser = argparse.ArgumentParser() parser.add_argument('geno_temp', type=str, ...
cf8b1df3687d256cc97a2ccda92a12b60b2ce8ab1efc00b2c42451f3a3d32324
Python
7,500
197
import asyncio import io import logging import os import sys from concurrent.futures import ThreadPoolExecutor import ray import ray._private.ray_constants as ray_constants import ray.dashboard.consts as dashboard_consts from ray._common.utils import run_background_task from ray._raylet import GcsClient from ray.dashb...
cef3d9d4711e9b2b16e019b175972747bf08ce5f4e3548fae44e2fa5faaf89e8
Python
7,503
136
# coding: utf-8 """ # # SCRIPT: IDENTIFY EEG-BASED REACTIVATION ONSETS IN REST # # PROJECT: FMRIREPLAY # # WRITTEN BY QI HUANG 2022 # # CONTACT: STATE KEY LABORATORY OF COGNITIVE NEUROSCIENCE AND LEARNING, BEIJING NORMAL UNIVERSITY """ # In[1]: import relevant packages import os import sys import warnings import numpy...
47f5800b0300fcc94acb0e92d514051dc1d5637ec31d00ae8795c01710483981
Python
7,506
226
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from enum import StrEnum from typing import cast from django.conf import settings from rest_framework.exceptions import PermissionDenied, ValidationError from cvat.apps.engine.models import Job, Project, Task from cvat.apps.engine.permissions impor...
9602ddce65434a5084184dab88ad851170ead3617b2310096ce94e3bfcaa96c7
Python
7,506
240
import warnings import tempfile import torch import numpy as np from rdkit import Chem from rdkit.Chem.rdForceFieldHelpers import UFFOptimizeMolecule, UFFHasAllMoleculeParams import openbabel import utils from constants import bonds1, bonds2, bonds3, margin1, margin2, margin3, \ bond_dict def get_bond_order(ato...
973e7ea66402a9c63e39e2b441748becbbc50b8952b5c6b9c87e073346f0adcb
Python
7,511
215
#!/usr/bin/env python from __future__ import print_function import re import argparse import logging # 3rd party import networkx as nx from networkx.algorithms.dag import descendants from networkx.algorithms.lowest_common_ancestors import lowest_common_ancestor from networkx.algorithms.shortest_paths.unweighted import ...
c769d911116ebc72cc339cba24915b190d3237071a157ca189b348a5e2c2b661
Python
7,514
154
#################################################################################################### # Copyright (c) 2016 - 2024, 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 fre...
595dc0db23f325a7bea7794caeb46b5920b12da3af193851b96820c01eeda580
Python
7,516
207
#################################################################################################### # Copyright (c) 2016 - 2024, 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 fre...
b8519eba170af269e8858588a601373084f0280c2624af3cf11d2a51ebb06033
Python
7,516
151
from pathlib import Path import argparse import json import os import random import signal import pickle import sys import warnings warnings.filterwarnings('ignore') # "error", "ignore", "always", "default", "module" or "once" import time import urllib import numpy as np from datetime import datetime from torch import...
1ce18ad0060ee2b8a0d00fe8f508e2ef07b0d530e0fa739ca111056796dc0d7c
Python
7,518
211
# -*- coding: utf-8 -*- """ Created on Sun Jul 1 17:15:00 2019 @author: ju-bar Cluster recognition tools This code is part of the 'emilys' repository https://github.com/ju-bar/emilys published under the GNU General Publishing License, version 3 """ import numpy as np # %% class cluster: ''' class cluste...
fc5f73ebbcae8e078649dc11d68cf32eade9084d0676b0015612ce15ae16757a
Python
7,518
167
import torch import numpy as np import h5py import pandas as pd from scipy import signal as sgn from src.dataset.batchdataloader import BatchDataloader from src.dataset.utils import compute_weights, remove_baseline_filter MIN_TRAIN_SET_SIZE = 1000 # the minimum size of the dataset before weight computation could beco...
7868eba08cbcf8816ac8d53a2b0d65cfcc7b7cd20a7b3b0cc5f644e586f06b04
Python
7,520
202
#!/bin/python import pysam import sys from collections import defaultdict from operator import attrgetter from itertools import combinations import svtk.utils as svu # Inputs VCF_PATH = sys.argv[1] BOTHSIDE_PASS_PATH = sys.argv[2] BACKGROUND_FAIL_PATH = sys.argv[3] DROPPED_RECORD_OUTPUT_VCF_PATH = sys.argv[4] if len...
4a699aa97c7ba2782514e0ae45ce6a9cef4287fde2a2284d6b31b32b3acb08a1
Python
7,528
208
# # 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...
59af865ae6a3e06a749ca061ce4fa87963b4660873a3f5e3059a6429ef8bb184
Python
7,529
235
# coding=utf-8 # Copyright 2022 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...
1814ef2d8ccf7d65fa117b62e4b6e65c9c2aaa86b9d18ad3f705e0551511f367
Python
7,533
176
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Complete pipeline for online processing using CaImAn Online (OnACID). The demo demonstates the analysis of a sequence of files using the CaImAn online algorithm. The steps include i) motion correction, ii) tracking current components, iii) detecting new components, iv...
0bf024ac0652e0bbff23d0bbb0bd9c2e1ca9b1754aec58ffa1e1f71797fc9e0b
Python
7,535
201
""" Memory(i.e.History)-based agent by Aditya Gilra, Sep 2021 """ import gym import numpy as np import gym_tasks import matplotlib as mpl import matplotlib.pyplot as plt # reproducible random number generation seed = 1 np.random.seed(seed) # if history, then store current and previous observations as state # else j...
2ff2a888c2a43e773e016a6d355c9c4a8ec15d9a6921d16903b09364c20ab27f
Python
7,537
206
import argparse import logging import os import os.path as osp import warnings from mmengine.config import Config, DictAction from mmengine.logging import print_log from mmengine.registry import RUNNERS from mmengine.runner import Runner from lqit.common.utils.lark_manager import (context_monitor_manager, ...
98929f971969e3cdca9619a27df6d3a3303588349b30cd6c0333a5cb607998d5
Python
7,537
223
import numpy as np from ml4h.TensorMap import TensorMap, Interpretation def _read_dataset(hd5, path): if path not in hd5: raise KeyError(f"Missing dataset '{path}' in {hd5.filename}") return hd5[path] def _read_ecg_2500_12(hd5): x = np.array(_read_dataset(hd5, "ecg/waveform"), dtype=np.float32)...
feae00679b4c1c20ddd4387657bd6e914bb6b9728111c897f7e49d16c5e03d75
Python
7,540
201
import nengo import numpy as np import nir model = nengo.Network(seed=3) with model: model.config[nengo.Ensemble].neuron_type = nengo.LIF(tau_rc=0.02, tau_ref=0) x = nengo.Ensemble(n_neurons=600, dimensions=3, radius=30) synapse = 0.1 def lorenz(x): sigma = 10 beta = 8.0 / 3 ...
74665d50ea6a6ee9e9683e752a427a97f8f75f372e39630a0e2dfdcec1cd7684
Python
7,541
188
""" 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. Tests: ASE vs LAMMPS energy/force agreement for a fairchem-backed calculator running NVE, NPT, and Langevin molecular dynamics ...
93e66665530baad0c7a25ba14e71cee1d26b520f68534e8ff9f1c5bd3c73f37c
Python
7,545
225
import argparse import time import numpy as np import torch import torch.nn as nn import torch.optim as optim from models import GNN from torch_geometric.data import DataLoader from torch_geometric.nn import global_mean_pool from datasets import MoleculeDataset_graphcl class graphcl(nn.Module): def __init__(sel...
50f41eb8ebeb0dea99f793d4c3239880b2cd847f37ce1c9957810f4c25ac2366
Python
7,547
234
import os import subprocess import spinnaker2.hardware from spinnaker2.configuration import ( Experiment, ExperimentConfig, MemoryRegion, PEConfig, ) from spinnaker2.coordinates import ( PE, ByteAddr, WordAddr, align_addr_to_next_multiple_of_other, ) from spinnaker2.helpers import read_...
b14e51395435466f937e2f671395ddb875760d4815ead11498afeed60f509333
Python
7,547
230
from pathlib import Path from typing import TYPE_CHECKING, Any import numpy as np import xarray as xr from numpy.typing import NDArray from PIL import Image from siapy.core.exceptions import InvalidInputError from siapy.entities.images.interfaces import ImageBase if TYPE_CHECKING: from siapy.core.types import Xa...
840df1bd81204362b648a5921546f01b4986645c51cf8bc8d7ce767b07b9b37e
Python
7,548
291
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. # Copyright (c) 2021 Qualcomm Technologies, Inc. # All Rights Reserved. # mypy: disable-error-code=attr-defined """Functions to manipulate the quantization sta...
3e7e2bc371e945d5b607e1cee085deab7064b74a70255aa6d5a6d5ab26979fd9
Python
7,549
194
import logging import platform import subprocess from typing import Dict, List, Optional, Tuple from ray._private.accelerators.accelerator import AcceleratorManager logger = logging.getLogger(__name__) class AppleGPUAcceleratorManager(AcceleratorManager): """Apple Silicon GPU (MPS) accelerator manager. Unl...
77925090d5d74432a3be2d24b15d914b646766dd9e683656b6c18166622713f1
Python
7,555
238
import unittest import numpy as np from neuron_morphology.morphology import Morphology from neuron_morphology.constants import ( AXON, APICAL_DENDRITE, BASAL_DENDRITE, SOMA ) from neuron_morphology.feature_extractor.data import Data from neuron_morphology.features.branching import bifurcations as bf from neuron_m...
f115205d5b1f25e4d43c7a6f0e6cfa8547a2bc8c93dce8c3760e1b89bdc4491d
Python
7,555
174
#!/usr/bin/env python #!/usr/bin/env python ''' Example of a single-layer bidirectional long short-term memory network trained with connectionist temporal classification to predict character sequences from nFeatures x nFrames arrays of Mel-Frequency Cepstral Coefficients. This is test code to run on the 8-item data se...
027b363f1f129826846c4053f6e60919753a80fa79e33383a9006e8131458a95
Python
7,556
207
import logging from json import loads from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple from urllib.parse import urlparse from urllib.request import getproxies import numpy as np import pyarrow as pa from ray.data._internal.object_extensions.arrow import raise_on_pickle_object_columns from ...
a59dce72f43718e52aa7fdf885ce72dcbda0baeec77396c181b7cf8b33ca840b
Python
7,557
177
import math import torch from torch import nn # from torch.nn import TransformerEncoderLayer, TransformerEncoder # from torch_cluster import knn_graph, radius_graph # from torch_geometric.nn import MetaLayer, voxel_grid, global_max_pool, max_pool, avg_pool # import torch.nn.functional as F # from torch_geo...
a3845ca44927ca669778ca7489a522f4f5138e8303c7efe6818a193e1b15d376
Python
7,559
299
# isort: skip_file from ray._private import log # isort: skip # noqa: F401 import logging import os import sys from typing import TYPE_CHECKING log.generate_logging_config() logger = logging.getLogger(__name__) def _configure_system(): import os import platform import sys """Wraps system configurat...
a91b040b5991f21add7acdcaf61668fa5037715926bc607565ed58d1e0c146ec
Python
7,561
227
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Tests for general functionality of layers.""" from torch import randn from aihwkit.inference import ( PCMLikeNoiseModel, ReRamCMONoiseModel, Cus...
976edfa5fde971b125cb20480140abac51785e19f862d7a17f348f8664f37b17
Python
7,565
208
#################################################################################################### # Copyright (c) 2016 - 2024, 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 fre...
391a7aef4bc6bf31716b1c265f935aa7e187eea9640233b799181152fcd569ef
Python
7,567
204
import h5py import numpy as np import pandas as pd import sys from optparse import OptionParser import json from scipy.sparse import csr_matrix, isspmatrix_csr, issparse from concurrent.futures import ThreadPoolExecutor from tqdm import tqdm from .._registry import register_function # Small number for checking intege...
c0d8a22b60fadb306839b71fa420fe2598d8d38beb5ce6eaeb2bb1c9c1bd7abc
Python
7,567
213
from itertools import cycle from datetime import datetime, timedelta import pytest import numpy as np from torch.utils.data import DataLoader import tensorflow as tf from ml4ht.data.data_description import DataDescription from ml4ht.data.sample_getter import DataDescriptionSampleGetter from ml4ht.data.data_loader imp...
8757d7f0956eb204d457b1d914f9335573314c54566ee106b1417d3383c25f2c
Python
7,568
235
""" Implementing "two networks with merging outputs" in https://github.com/synsense/sinabs/issues/181 """ import torch import torch.nn as nn from sinabs.activation.surrogate_gradient_fn import PeriodicExponential from sinabs.layers import IAFSqueeze, Merge, SumPool2d class SNN(nn.Module): def __init__(self, bat...
d5735780d2a983c5b3cbd8bf583a35f0ab0114e9e85ea5709665ef1f9111be9e
Python
7,568
214
from torch_pgn.data.dmpnn_utils import BatchProxGraph from torch_pgn.models.model import PGNNetwork from torch_pgn.args import TrainArgs from argparse import Namespace import torch import torch.nn.functional as F from scipy.stats import pearsonr from sklearn.metrics import r2_score from tqdm import tqdm import nump...
89296c26df3530c6c4ce082c19ef88fbb1e52313bfd968ccce8f445731ee9b91
Python
7,570
189
import torch from torch.utils.data import DataLoader, TensorDataset from transformers import AutoImageProcessor, AutoModelForImageClassification import torch.nn as nn import numpy as np def calculate_accuracy(outputs, labels): _, predicted = torch.max(outputs.logits, 1) correct = (predicted == labels).sum().i...
e494943c51051ae27ffd4536e39fd374f4414a50b42a5a5c073939a479eb7120
Python
7,571
206
"""Get event-related averages per stimulus duration""" import os import glob import nibabel as nb import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns ROOT = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti' # Define data dir DATADIR = '/Users/sebastiandresbach/d...
642c749d8b19e82a8a0df0e035005e0e8f5a5fc3b72a073a6e913b3073b66151
Python
7,572
241
"""File-backed analysis run store for OVAgent.""" from __future__ import annotations from dataclasses import asdict, dataclass, field import json import logging from pathlib import Path import time import uuid from typing import Any, Optional logger = logging.getLogger(__name__) from .workflow import WorkflowDocume...
c6034c65e0ec1a7d0cb74dba8dd9361c082689e23e5f14c97b9cbd0de901c08b
Python
7,572
264
import gym import numpy import random import os import queue import pysted.base from gym import error, spaces, utils from gym.utils import seeding from matplotlib import pyplot from collections import OrderedDict import gym_sted from gym_sted import rewards, defaults from gym_sted.utils import SynapseGenerator, Micr...
3602e620eb716e7565b7c840f77adfc298e9c5d589a45743da0739501b3cdd76
Python
7,574
207
"""Tests for fairchem.core.models.uma.compat — UMA generation classifier and in-place ``model_id`` back-fill. """ from __future__ import annotations import pytest from fairchem.core.models.uma.compat import ( UMA_1P1_MODEL_ID, apply_uma_compat_fixups, get_uma_version, ) from fairchem.core.units.mlip_unit...
43277a0a2e4485c5713c211c00e58bc387d1bf7eedc8a193ace1071a6eff73bb
Python
7,575
241
import os import tempfile import numpy as np import pytest import torch from torch import distributions, nn import pfrl from pfrl.envs.abc import ABC from pfrl.experiments import ( train_agent_batch_with_evaluation, train_agent_with_evaluation, ) from pfrl.experiments.evaluator import ( batch_run_evaluati...
b90c0d85cc30759e3e5b0e786c7266996de74571c2747fabaa214179967b8cc6
Python
7,576
188
import os import numpy as np import pandas as pd import opensim as osim from tqdm import tqdm from NeuroMotion.MSKlib.pose_params import RANGE_DOF class MSKModel: def __init__(self, model_path='/home/msh/git/NeuroMotion/NeuroMotion/MSKlib/models/ARMS_Wrist_Hand_Model_4.3.2', model_name='Tenodesis_Model_moreDoF.o...
bf7e997f1efef7238148e0dce3ab82c65fe30dba8c4cd4f76990e6848ba774cd
Python
7,578
228
"""Functions necessary for aggregating temporal features into single values.""" import logging import time from collections import defaultdict from functools import partial from importlib import import_module from pathlib import Path import numpy as np import pandas as pd from tqdm import tqdm from sklearn import pre...
5f604c7dfda9da964204d2235cdd8f56a39989afe4c18aa49061aa278001c546
Python
7,579
223
import matplotlib.pyplot as plt import nir_reference_impl import numpy as np import snntorch as snn import torch # NOTE: this requires snntorch Pull-Request #246 and nirtorch/feature-state from snntorch import export_nirtorch from torch import nn def compare_spike_counts(results): n_spikes_st = np.count_nonzero(...
af0c8de0cf4643bff72fe7e1d970eee26090f5820abbfcef1f43cf79bcd3acc1
Python
7,580
194
import logging from datetime import datetime from transformers import BertForSequenceClassification from agent.data.entities.config import DEV_LABEL, TEST_LABEL, EXTERNAL_LABEL, CTT3_LABEL, CTT3FR_LABEL, CTT3HEALTH_LABEL from agent.classifiers.tr_ffnn_ensemble_classifier import tr_ffnn from agent.classifiers.data.wra...
d9613fb8666b7b285074a69e153d32dd254861f9415a2905a898ca6b27d118a8
Python
7,581
196
import argparse import datetime import pickle import sys import time import numpy as np import os import pandas as pd from torch.utils.data import DataLoader, Dataset from torchnet import meter import torch from sklearn.model_selection import train_test_split from model import AIMP from preprocess impo...
8287339f92bf2ac53078259f1b5eb32bdcc3276dc8e5f9cdec6eb845aed5f6dc
Python
7,582
156
import torch from torch import flatten from torch import nn import torch.nn.functional as F # Training augments with the functions test-time augmentation uses, which live with the inference code (the built app predicts without PyTorch) from candycrunch.inference import transform_mz, transform_rt class SimpleDataset(t...
90dd3ae6d4938151843fcf9a7daa0def446b517abcb211c32915cab1f91de8f0
Python
7,583
232
import numpy as np import os from pynwb import NWBFile, NWBHDF5IO, image from pynwb.ophys import TwoPhotonSeries, OpticalChannel, ImageSegmentation, ImagingPlane from pynwb.file import Subject from pynwb.device import Device import math import statistics import pandas as pd import h5py #Provides methods to supplement ...
fd5b814def49c36f3b6b520f5d45e9ceafafa38901d82a77552221f32bd849a5
Python
7,584
192
import subprocess import argparse from tempfile import NamedTemporaryFile from collections import OrderedDict import gzip ############################################################################ # Functions for calling liftover to remap SNP coordinates from HG19 to MM9 #############################################...
036494b30e42ff059927ce6179c8cdf76793718911aaad1cd83b6f8c6d2abeef
Python
7,585
246
"""KEGG API client.""" import logging from typing import Any, Dict, List, Optional from .base import BaseAPIClient from ..config import settings logger = logging.getLogger(__name__) class KEGGClient(BaseAPIClient): """Client for KEGG REST API. KEGG (Kyoto Encyclopedia of Genes and Genomes) is a datab...
c67af8f8db4e5d3966149460a6322b6beda2737b7a6ff14d5cb322f8f5c11ad3
Python
7,587
246
"""KEGG API client.""" import logging from typing import Any, Dict, List, Optional from ..base import BaseAPIClient from ...config import settings logger = logging.getLogger(__name__) class KEGGClient(BaseAPIClient): """Client for KEGG REST API. KEGG (Kyoto Encyclopedia of Genes and Genomes) is a dat...
178e76c11b4081ceed4f6ba27aa56a0e08ab8fcfce6858aa04ebe39c4f88531b
Python
7,588
219
# Vendored from `decoupler` (https://github.com/scverse/decoupler) by # omicverse for in-tree GPU acceleration work. Original copyright by # the decoupler authors, redistributed under decoupler's GPL-3.0 # license. Cross-module imports rewritten from `decoupler.*` to # `omicverse.es.*` (see scripts/vendor_decoupler.py)...
cbda6dfac4372be7f34a6f3eea44c6c39b86df3b1bfdc73ae5bc96ab0d706655
Python
7,591
156
import h5py import glob import os.path import numpy as np import pandas as pd import argparse import glob import pdb def minimal_qtl_processing(QTL_Dir, OutputDir, writeToOneFile=True, compressed = False, overWrite=True, minimalPValue = 1, minimalFeaturePValue = 1, topMode = False, debugMode = False): qtl_results_...
8bd4c550a53879c31123f010a8666ef1f8f2bf5f79222c539b9b6447cdee28f5
Python
7,592
171
# Copyright 2023 ETH Zurich Computer Vision Lab and 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...
26ca2c037a37118480e165efd0aedfb3f720ead9a311fe218fcc8e4023618d0c
Python
7,593
195
import torch.nn as nn import torch from spikingjelly.clock_driven import layer __all__ = [ 'PreActResNet', 'spiking_resnet18', 'spiking_resnet34' ] class PreActBlock(nn.Module): '''Pre-activation version of the BasicBlock.''' expansion = 1 def __init__(self, in_channels, out_channels, stride, dropou...
7243bcb8dbdf190f4aff0c0618812b2d923c4d17e1067c6a791fe7f86d1629a6
Python
7,597
219
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import sys import numpy as np import pandas as pd from sklearn.ensemble import RandomForestClassifier from sklearn.preprocessing import LabelEncoder from sklearn.metrics import roc_curve def rf_classify(metrics, trainable, testable, features, labeler, cutoffs,...
d6f0ea38a9dca7ba73eef4300fb329a0705254d7f311c1fefcd51c5aaa302365
Python
7,597
253
from dataclasses import dataclass from typing import Any import numpy as np from .node import NIRNode @dataclass(eq=False) class CubaLI(NIRNode): r"""Current based leaky integrator model. The current based leaky integrator neuron model is defined by the following equations: .. math:: \tau_...
29e8a8e84cc312c5bbac7f1f023199444ceddfade04f105ab8faf2e5af166470
Python
7,600
222
# Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ) # # 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 #...
50921bb868acc3f8958654c18c17674a6f4b82c2e64db35b38fa0753aa1fda33
Python
7,601
185
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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...
e363899ade1924394c60964cf97ff9e86096de0f6e2f184cd4e3d6a5f59c953e
Python
7,601
209
"""Clustering of EV subpopulations for single-EV proteomics. EV-subpopulation discovery is the core of single-EV analysis: an EV x protein AnnData is partitioned into vesicle subpopulations that share a surface-marker profile. This module keeps only the EV-specific routines: * :func:`flowsom` — a native, pure-Python...
c6321e0d000500ef04a2c75f7b180ee33ef3dfda0d17fb063b3a64767923e9fc
Python
7,602
186
import numpy as np import torch import torch.nn as nn from typing import Union, Tuple, Optional from torch_geometric.typing import (OptPairTensor, Adj, Size, NoneType, OptTensor) from torch import Tensor import torch.nn.functional as F from torch.nn import Parameter from torch_g...
3b1e5bf804b8f5afbe45d99fc91a77d40c212b0c929c8bb8dc983b349618da99
Python
7,603
212
"""Screen frames follow recorded presentations, with one synthetic endpoint.""" import json from pathlib import Path import numpy as np import pytest import yaml from mozaik.tools.experanto_export import MozaikScreenExporter IMAGE_META = dict( condition_hash="image", image_size=[144, 144], modality="ima...
a88135e63879e2adc79d13938e9c73460d71dc65c274545e02b4170c09272112
Python
7,604
176
# hypertuning.py # Imports import logging from timeit import default_timer as timer import numpy as np import tensorflow as tf import kerastuner as kt import kerastuner.engine.trial as trial_module from tensorflow.keras.callbacks import EarlyStopping from kerastuner.tuners import RandomSearch, BayesianOptimization, H...
6f41b71b37236690e17d799f52ad1babc48ae6bff18207ee529f75e4e546e5d1
Python
7,606
166
import logging from datetime import datetime from agent.classifiers.tree_classifiers import tree_classifier from agent.classifiers.data.wrappers.count_features_fd_dataset_dev import get_raw_datasets as get_datasets_dev from agent.classifiers.data.wrappers.count_features_fd_dataset_test import get_raw_datasets as get_...
78f6921000f8a06e2c8190b7f70a46d9efeec822715f23a645c7a42be1032354
Python
7,606
171
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Python version: 3.10.9 pandas version: 1.5.0 seaborn version: 0.11.0 matplotlib version: 3.6.3 pingouin version: 0.5.3 """ #%% Import Modules import pandas as pd import seaborn as sns import matplotlib.pylab as plt import pingouin as pg from matplotlib.patches import ...
c0943decdcbf34edb1b75e56ab7ec57c05662cbcd4d53faf11718982b268600b
Python
7,610
200
# Copyright 2023 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
173cb1bb266b87faa7f56821cf734786db6df2fbf5a8804548508c052e1118f3
Python
7,612
168
import argparse import pickle from typing import List import numpy as np import torch from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct import lib.dataset_config_parser.dataset_config_parser as dcp from lib.dataset_config_parser.dataset_config_parser import read_config_file import lib.data_uti...
745d644af465c3521038c92d0c765f06ac8217dc5aa0328bd2973bbb4180a780
Python
7,612
192
import numpy as np import torch import torch.nn.functional as F from typing import List, Tuple, Dict, Callable import lib.data_utils.dynamic_data_util as ddu from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct FrameRateLNPSpikeTrains = List[torch.Tensor] def frame_rate_lnp_multidata_bin_spike...
abd4d1fec117554fba2b4b09579a182221ccb0fc789a2f304019979e787c674f
Python
7,612
220
""" 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 argparse import os import numpy as np import torch from fairchem.core.calculate.ase_calculato...
2fdd48d168882fb2efc56fa0b132518463b27147aae6f150aad2fde8eb191c99
Python
7,613
248
# # 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...