sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
cd589c1017043ffaaa38244461cfe8cf915054e70c00fa3ce6bb26b333701ca2
Python
8,926
213
import os import sys import numpy as np import scipy.sparse as sp import pandas as pd import torch import snf from sklearn.neighbors import kneighbors_graph from utils import sparse_mx_to_torch_sparse_tensor, normalize, encode_onehot, prepare_data, diffusion_fun_improved_ppmi_dynamic_sparsity from runR2 import...
6c90245ad78533d7224281b38e7389de3d0ead09d29a3d5eba2f6c748259f055
Python
8,934
216
import unittest from datetime import datetime import os.path import numpy as np from dateutil.tz import tzlocal, tzoffset import numpy.testing as npt import h5py from pynwb import get_manager, NWBFile, TimeSeries from pynwb.ecephys import ElectricalSeries, Clustering from pynwb.ophys import OpticalChannel, TwoPhotonSe...
95e4630ca468b83efeaae2f49888b9a18b6a37ae49643192b98f81b7bdecc8a2
Python
8,935
212
""" 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 bisect from typing import TypeVar import numpy as np from omegaconf import DictConfig, OmegaCon...
a1b091adcbfe26cb0e22c07c2a558d1e08701ad36636eb06ea349ba6f8cd11b5
Python
8,937
277
# %% # making new target data for a simple sensitivity analysis. import SSN_model_funcs as ssn import numpy as np import matplotlib.pyplot as plt import matplotlib # import matplotlib.patches as patches import seaborn as sns from importlib import reload from scipy.signal import butter, lfilter from scipy.ndimage impo...
b33768fa7f2875615b4dcb281639b3d96109413bb9c259d2323f868dc59fc851
Python
8,939
207
from torch.nn import Conv2d, Linear, BatchNorm2d from torch import where, rand, topk, long, empty, zeros, no_grad, tensor from math import sqrt import torch import sys from torch.nn.init import calculate_gain def get_layer_bound(layer, init, gain): if isinstance(layer, Conv2d): return sqrt(1 / (layer.in_c...
e5c310fa6bc41dbf1ac2980aa83bb41a747bc076a1e87166767fc31eeef98e74
Python
8,939
268
import numpy as np import pytest from datamate import set_root_context from flyvis.datasets.sintel import MultiTaskSintel, RenderedSintel, sintel_meta def test_rendering(mock_sintel_data, tmp_path_factory): """Test rendering with mocked Sintel data.""" with set_root_context(tmp_path_factory.mktemp("tmp")): ...
e623a65c9a4896362f369af893263ebcc81e8fa58db3bd54a0585a04951d5bd6
Python
8,939
226
import numpy as np import brian2 #brian2.BrianLogger.log_level_debug() import spinnaker2.neuron_models import copy # Leaky integrate and fire model eqs_lif = ''' dv/dt = -v / tau + i_offset/dt: 1 v_th : 1 i_offset : 1 v_reset : 1 tau : second ''' eqs_lif_curr_exp = ''' dI_syn_exc/dt = -I_syn_exc/tau_exc : 1 dI_syn_i...
032f5eee234216a186f9efe5b29f959646a3f002549b61d88f9070a31db1fc0a
Python
8,942
243
from __future__ import annotations from typing import Tuple, Optional, Sequence, Literal import numpy as np import scanpy as sc from anndata import AnnData import squidpy as sq import pandas as pd from ..preprocessing import FlowSigConfig def _make_flow_adata( adata: AnnData, config: FlowSigConfig, var_mas...
2eef8017634edcc78ae5fbeff59cd191b40d5910731aef1bdd02dd9e2cebbd7c
Python
8,947
260
"""KEGG data collector.""" import logging from typing import Any, Dict, List, Optional from src.api.kegg import KEGGClient from src.models.pathway import Pathway from src.models.genomic import Gene from src.models.protein import Protein from .base import BaseCollector from config.config import settings logger = log...
554a7e6b1cdbad035de08c773fc55ecbdecce258b3733139c830bd329a0b809e
Python
8,948
269
""" Data structures for validation results. This module defines the data structures used throughout the DataStateInspector system to represent validation results, data checks, and suggestions. """ from dataclasses import dataclass, field from datetime import datetime from typing import List, Dict, Optional, Any, Lite...
26da82525867360975bcc3457936740e7ab65cf06bb2dc45ff0044f5b5b686c2
Python
8,950
207
# -*- coding: utf-8 -*- """ # # SCRIPT: THE FUNCTIONS OF IDENTIFYING REPLAY AND REACTIVATION IN TASK AND REST # # PROJECT: FMRIREPLAY # # WRITTEN BY QI HUANG 2022 # # CONTACT: STATE KEY LABORATORY OF COGNITIVE NEUROSCIENCE AND LEARNING, BEIJING NORMAL UNIVERSITY """ # get the number of scans of task for each run: def...
3745880e4c6ddd86837e19d3cbc060f396546922a0594c1de000ad5603449b28
Python
8,955
202
# -*- coding: utf-8 -*- # @Time :2024/6/6 9:56 # @Author :MENGLong Li # @File :AbaqusModelCreate.py # @Software:PyCharm # from abqpy import * import numpy as np from abaqus import * from abaqusConstants import * from scipy.spatial import KDTree import os def output1(name, Location, element): with open("%s...
8a367dd4fb9e97cde0e5a0850a1b94fe6b11ba0bcd269c48cb45a39099e05efd
Python
8,955
222
import torch import torch.nn as nn import math # Function to initialize weights for convolutional and linear layers def weights_init(m): if isinstance(m, nn.Conv2d): m.weight.data.normal_( 0, math.sqrt(2.0 / (m.kernel_size[0] * m.kernel_size[1] * m.out_channels)) ) if m.bias is...
5d6b169698915621f4df3d45ff9a156729aa7b6027a4148dc49408747b00d77f
Python
8,957
225
import os import numpy as np import pandas as pd import pickle from matplotlib import pyplot as plt import seaborn as sns import statsmodels.api as sm import pingouin as pg from pcntoolkit.normative import estimate, predict, evaluate from pcntoolkit.util.utils import compute_MSLL, create_design_matrix, calibration_des...
de32f05db3d8260c9efd6968dcc1d51f07b6da38300795876081a24d43072fb1
Python
8,959
197
# -*- coding: utf-8 -*- """ @author: Valeria Fascianelli """ import pickle import numpy as np import matplotlib.pyplot as plt import random from sklearn.preprocessing import PolynomialFeatures import scipy.special import statsmodels.api as sm def get_multi_linear(correct_trials,rt,conditions): number_cor...
74b41c09e4aa56544c26aee81bc64669fc8ab5c97e34b2a4c00855016d258455
Python
8,961
244
# 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...
eaf8b334fcb199098bcc4634b13df2854be669bdc724421f8382b4f566cf35a6
Python
8,961
181
import numpy as np import pytest import copy import warnings import re def matching_import(pattern, module, globals): """ Imports only elements from a module that match the given regular expression (credit: https://stackoverflow.com/a/17226922) :param pattern: regular expression that describes the des...
08e414c450ad5b4a473a90d16b2373b352d1bd6df4bcc798594d9c6254e9eb95
Python
8,962
288
#!usr/bin/python """Rank genes on the precomputed integrated trajectory.""" # -------------------------------------------------------------- # Compute an integrated UMAP across all neuron subtypes: # Updated: 03/01/22 # -------------------------------------------------------------- import re import logging from time im...
1ecfe294fc88649a49fb5b0b96c270fecff9177d42454d6b3fbb1b5711275db8
Python
8,964
298
import keras from keras.utils.np_utils import to_categorical # used for converting labels to one-hot-encoding from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPool2D, BatchNormalization from sklearn.model_selection import train_test_split from scipy import stats from skle...
56271a187cbc9b643b28117fd65b4032b36a8324ceb444d6bcb5ed22af1f6930
Python
8,966
210
#################################################################################################### # 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...
c69b24415c1da459b1950881af2fe26ac9c8e3f8fa018ba0ae32edb47b3b54e4
Python
8,973
267
"""HexScatter animation.""" from typing import List, Optional, Tuple, Union import numpy as np from matplotlib import colormaps as cm from matplotlib.axes import Axes from matplotlib.colors import Colormap from matplotlib.figure import Figure from flyvis import utils from ..visualization import plots, plt_utils fro...
63a7ad4c05f0e3e93ec8d2a34d0d7d7930fa8d6f60479465cdcb719add87a08e
Python
8,974
210
from typing import List import torch def _movie_spatial_stimulus_contrib_gensig(spat_filt_w: torch.Tensor, time_filt_applied: torch.Tensor) -> torch.Tensor: ''' :param spat_filt_w: shape (1, n_basis_stim_spat) :param multimovie_filtered_list: shape (n_basis_sti...
b47060714f7b074dfa9f82602454f2f42859214374730781af4dd8ce5c94ef69
Python
8,978
273
# type: ignore # pylint: disable-all # -*- 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://w...
628b0181a4e4a2a07d18aefe1eeb8a88a0b95ab109b792c0be2666c2eca90cb5
Python
8,982
306
import copy import json import logging import os from typing import Any, Dict import yaml from ray.autoscaler._private.loader import load_function_or_class logger = logging.getLogger(__name__) # For caching provider instantiations across API calls of one python session _provider_instances = {} # Minimal config for...
74810cfd794b97264acfc6ad89d6a06b31e25fd517e30945b05fce7a2c504c0a
Python
8,982
330
"""This is the script for `ray microbenchmark`.""" import asyncio import logging import multiprocessing import numpy as np import ray from ray._private.ray_client_microbenchmark import main as client_microbenchmark_main from ray._private.ray_microbenchmark_helpers import timeit logger = logging.getLogger(__name__) ...
69a278520cabfae0b8af74703246b065b7c6935f91c31a958c723de0b9410413
Python
8,984
212
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class DPMSolverSinglestepSchedulerTest(SchedulerCommonTest): scheduler_classes = (D...
59bc5463f02045b8175e15cd85f0c0423341fccdffad450741f21950f765c251
Python
8,990
173
#!/usr/bin/env python2.7 # tool_versions.py v1.1 Creates "SW" versions json string for a particular DX applet. # Write request to stdout and verbose info to stderr. This allows easy use in dx app scripts. import sys import argparse import json import commands # APP_TOOLS is a dict keyed by ap...
96314c6d127df416bb0433b2f10752b92c8f6b07f5f34e25010f66278ff917f4
Python
8,991
241
#!/usr/bin/python """Class for handling correlations in scdemon.""" # -------------------------------------------- # Class for handling correlations in scdemon: # Updated: 07/02/21 # -------------------------------------------- from .utils_correlation import ( calculate_correlation, calculate_correlation_estima...
efed44b81ce89d986d9870589096b9bbdb577eb5afcc0336b3df3c710784f501
Python
8,992
317
import argparse import os import shutil import numpy as np import torch import torch.nn as nn import torch.optim as optim from PIL import Image from torch.autograd import Variable from torchvision import transforms import cv2 import time import argparse from scipy.io import loadmat from torch.nn import functional as F ...
59855255a2a8c0cbfa2abfe77c8413797ba58458d2e52daf30130c550a4b2ea2
Python
8,993
254
import functools import numpy as np from scipy.ndimage import uniform_filter from skimage._shared import utils from skimage._shared.filters import gaussian from skimage._shared.utils import ( _supported_float_type, check_shape_equality, warn) from skimage.util.arraycrop import crop from skimage.util.dtype imp...
1cc85e23c503f0c8dcf397420d0a86db2415a773002dbf4ddc0610961fc569f5
Python
8,994
249
# Copyright (c) OpenMMLab. All rights reserved. import argparse import glob import json import os.path as osp import shutil import subprocess import torch from mmengine.config import Config from mmengine.fileio import dump from mmengine.utils import mkdir_or_exist, scandir def process_checkpoint(in_file, out_file): ...
9c7804c432b00d5d77e905836844e7baf0eebb50d9c7cb42fa93f37107c47018
Python
8,994
320
import argparse import os import numpy as np import torch import torch.nn as nn import torch.optim as optim from PIL import Image from torch.autograd import Variable from torchvision import transforms import cv2 import time import argparse from torch.nn import functional as F import csv from DM import DMData from...
d217f2145a75e2fbc002882d4e8eaf8e87cad712be00833e0a60c3390b0f25ea
Python
8,995
200
import sys from typing import TYPE_CHECKING, Iterable, List, Optional, Union from ray.data._internal.object_extensions.arrow import raise_on_pickle_object_columns from ray.data._internal.tensor_extensions.arrow import pyarrow_table_from_pydict from ray.data._internal.util import _check_pyarrow_version from ray.data.bl...
2faa2f7a6acd350840022e074f8aff68be22ba3598bb1869ff9a1f79eafe8e5a
Python
8,999
273
import numpy import os import yaml import copy import sklearn import h5py import shutil import time from matplotlib import pyplot from scipy.spatial import distance from collections import defaultdict from tqdm.auto import tqdm, trange BOUNDS = { "Resolution" : { "min" : -numpy.inf, "max" : 140.,...
ec511669b71063192995cc02edfdc36e16485598b7daabf463449b581ac04e61
Python
9,000
294
import socket import struct import numpy as np import pdb import time from tqdm import * import matplotlib.pyplot as plt from power_readout import * import scipy.io from scipy.optimize import fsolve from awg import * from channnel_shift import ChannelShifter import pyautogui import torch def isnan(input...
f499d68a77400864fa81ffed8ecb5f64c4f9d20925f0cc83d2cb4c0396cf4ab9
Python
9,009
261
import warnings warnings.filterwarnings("ignore") import argparse import json # import matplotlib # import matplotlib.pyplot as plt import math import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch import cuda import sys, os import random import numpy as np from sklea...
6110a00b19c6d677543d5e6a59aef9ba7c7bc8459c46e1ccb095a5840ab89d55
Python
9,012
264
#################################################################################################### # 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...
91b2eb3cddef4b7d2f981c46367997c9fffc832f3a5fa3379e741cd3e0aff891
Python
9,012
331
import datetime import numpy as np import pandas as pd import pytest from visions.test.utils import ( contains, convert, get_contains_cases, get_convert_cases, get_inference_cases, infers, ) from data_profiling.config import Settings from data_profiling.model.typeset import Prof...
f8dc7e34c460cb49b3c40d457e09a3ef1627c9b796745110ba38ed204aa6d725
Python
9,013
195
""" analysis/processing.py: part of expfactory package functions for automatically cleaning and manipulating experiments by operating on an expanalysis Result.data dataframe """ import pandas import numpy def drop_null_cols(df): null_cols = df.columns[pandas.isnull(df).sum()==len(df)] df.drop(null_cols,ax...
5141e1944080d1eafccbd4cb2f47cc525a2301832ef5c07396274810b39762ce
Python
9,015
314
# Copyright 2021 Google Research. 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 applicable law...
30f23dc8a05dd4ea81452c4eee88ca39f6468d831d5340f61b6ac8704ff322f6
Python
9,020
246
import numpy as np import pandas as pd from anndata import AnnData from typing import Union, Sequence def get_top_nmf_genes(adata: AnnData, gems: Union[str, Sequence[str]], n_genes: int, gene_type: str = 'all', model_organism: str ...
5f76d848283c55a21ea221345bc76d48cb1a488dde381637a4dea5a0651c53d4
Python
9,022
259
import numpy as np class PEKNNCRP(): '''a prediction error based 1NN if PE is high, it make a decision between - assigns new input to the cloest exisiting cluster - or create a new cluster else, it assigns new input to the previous cluster use PEKNN to compute likelihood and combine w...
cdb43c43fc58a2e1f1a8e43dd8dd8f682aee0d5d348d7265c473f5ced0445d91
Python
9,024
246
import numpy as np import pandas as pd import scanpy as sc from typing import Union, Sequence def get_top_nmf_genes(adata: sc.AnnData, gems: Union[str, Sequence[str]], n_genes: int, gene_type: str = 'all', model_organism: str = 'hu...
efb936a935dd88d1780aaeab183bd4b88c0bfde34da52b4598ab68e173712458
Python
9,027
237
import asyncio import logging import os import time from collections import OrderedDict, defaultdict from concurrent.futures import ThreadPoolExecutor from datetime import datetime from itertools import islice from typing import Dict, List, Union import aiohttp.web import ray import ray.dashboard.optional_utils as da...
b25cd445b1b5123598c84563f20b0c96c809f74af1330690cff7150ff21e4e21
Python
9,038
207
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) import numpy as np from lifelines import CoxPHFitter import pandas as pd import pickle from model import utils from matp...
de45385057b1081c3d4bf9933bde66d727046435016cde0e31c03803ae85b142
Python
9,038
245
"""HiveServer2 connection, schema, and row conversion helpers.""" import re from contextlib import suppress from typing import Any, Callable, Iterator, List, Optional, Tuple import pyarrow as pa from ray.data._internal.datasource_v2.formats.hive.hive_contract import ( HiveReadSpec, ) _FETCH_ROWS = 1024 _DECIMAL...
476cf35b8ef8bc17328f8feba90b41945c87b072118b366f0ba383935f3a1717
Python
9,039
278
import numpy as np import matplotlib.pyplot as plt from .utils.tf import K, IS_TF_1, tf if IS_TF_1: from skimage.measure import compare_psnr, compare_ssim else: from skimage.metrics import structural_similarity as compare_ssim from skimage.metrics import peak_signal_noise_ratio as compare_psnr d...
7a5c3b8753db9db0022b85d1f5ab1027c9b3a800966f862747fc62c4ffb340c9
Python
9,040
196
import os import neuron_morphology.swc_io as swc from neuron_morphology.morphology import Morphology from neuron_morphology.marker import Marker from neuron_morphology.constants import * test_pia_transform = { "id": 611512262, "tvr_00": -0.984586262715884, "tvr_01": 0.174899660580482, "tvr_02": 0.0, ...
4bd572ad4a224b67852cdec743f8f6a22fe0ebfee836ae728f93861a35fabeac
Python
9,042
238
# Crystal structures are saved in 'mp-####.cif' files; # Other properties are saved in 'mp-####.pickle' files; import functools import warnings from abc import ABC, abstractmethod from pathlib import Path from typing import List import io import torch import pickle import ase import numpy as np from torch import tenso...
95b381de78b076080101197429dc498a149819819c7ecf609affc3e48d05255c
Python
9,042
211
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) from matplotlib import pyplot as plt import numpy as np from tqdm import tqdm import concurrent.futures from model impor...
830eeb03d8a1dd8599b12be1f95ff5c64d5c7c9021e3a9e1de94ff3216bb68a9
Python
9,044
219
"""Diagnostics for a stalled dashboard-agent asyncio event loop. The dashboard agent runs a single asyncio loop that serves metric ingestion, event aggregation, and the ``POST /api/jobs/`` submit handler, so a stall in that loop hangs job submission while the dashboard head stays healthy on its own loop. ``EventLoopM...
886af50b89b8b9f93894888c8b09bec4f3f9978c6a2fda6432395f14b26598fc
Python
9,049
273
"""Function to plot cell-type annotation.""" from __future__ import annotations import os import matplotlib.backends.backend_pdf import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from sklearn.metrics import confusion_matrix def _sample_report(adata, cell_type_key, score_ke...
cb4aff0ba1c79d48e42ceaffe07bd202b755cffe8892a5658353dedf7f400812
Python
9,056
297
# -*- coding: utf-8 -*- """ Created on Mon Jan 22 13:47:12 2024 @author: Leyang Xue """ import sys import matplotlib.pyplot as plt import numpy as np from collections import Counter # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from ut...
4099be764baa565be65c1adc53e419d40482132c0cbd58c8dd3d53565fe1bb43
Python
9,058
230
import warnings from typing import Dict, List, Tuple, Union import torch from mmengine.model import BaseModel from torch import Tensor from lqit.common.structures import DataSample, OptSampleList, SampleList from lqit.edit.structures import BatchPixelData from lqit.registry import MODELS from lqit.utils import OptMul...
7906fe50fdc58db20e09acd90ab80559b7dbcf1ce3d0952a44a7aa313fc0d841
Python
9,065
124
import os import argparse import easygrid # Stages MAKE_TEMPLATE_FILES = 'make_template_files' TRAIN_MODELS = 'train_models' SCORE_SUMSTATS = 'score_sumstats' GATHER_SUMSTATS = 'gather_sumstats' if __name__ == '__main__': parser = argparse.ArgumentParser('Script to generate LD score regression scores and plot res...
9956c3aa3ef9d0c54adeec3e3099a38b3ea30ac1c6f0e2319e473810d8b97efc
Python
9,065
227
# built-in dependencies import os from typing import Any, Dict, List, Optional, Union import zipfile import bz2 # 3rd party dependencies import gdown import requests # type: ignore[import-untyped] # project dependencies from deepface.commons import folder_utils from deepface.commons.logger import Logger from deepfac...
194e6e7826101db463600f90bfda1e270eeb06eaf067ef01b2caf0787c5689ae
Python
9,068
173
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, CTT3SIM_LABEL, CTT3HEALTH_LABEL from agent.classifiers.transformer_classifier import transformer_classifier from a...
5fff34447d4e0e857a1a0200ef0eb1f6c040c3618bc2fee2bfc068134a22ee83
Python
9,068
213
import numpy as np from packaging.version import Version from dipy.data import get_sphere, HemiSphere from dipy.reconst.shm import real_sym_sh_mrtrix from dipy.utils.optpkg import optional_package from dipy.reconst.shm import sph_harm_ind_list cvxpy, have_cvxpy, _ = optional_package("cvxpy") sphere = get_sphere('symmet...
52579bf2b1930efa6b6e09855f9cbbe33cc80be2c9cd23f077076066863c414d
Python
9,070
235
"""Anthropic Messages API adapter helpers for OmicVerseLLMBackend. Internal module — import from ``omicverse.utils.agent_backend`` instead. """ from __future__ import annotations import json import logging from typing import Any, Dict, List, Optional from .agent_backend_common import ( Usage, ToolCall, C...
00799fae9090d97d513a891355dc1b1856a5b2808f8dafd16ce1382b5f9b009e
Python
9,075
273
# __worker_def_start__ import tempfile from typing import Dict, Any from starlette.requests import Request from starlette.responses import StreamingResponse import torch from transformers import TextStreamer import ray from ray import serve from ray.util.queue import Queue from ray.runtime_env import RuntimeEnv @ra...
2613fa12226346eb5e7b5ce112260a5cfb7d751ad63623e9892fa1480cbd6703
Python
9,082
292
""" This is the code for global-local transformer for brain age estimation @email: heshengxgd@gmail.com """ import torch import torch.nn as nn import copy import math class convBlock(nn.Module): def __init__(self,inplace,outplace,kernel_size=3,padding=1): super().__init__() self.relu =...
5e5be219b0dc2e1ee1136f04316b264f5c38eb217cdcfba9ee8506f43626a3d1
Python
9,088
204
from suite2p.extraction import dcnv import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA from matplotlib import use use('qt5agg') import core.util as cu #%% Param settings # Spike detection parameter ca_tau = 0.5 # Replace with the real tau time of your calcium indi...
42af6c576597e6366ab306f0b51c470b44d3f27ef8155fe2f31fdfbefe8d6a64
Python
9,090
255
# 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)...
0cb3b685c2d7add8d0cb2376d2021ace6d551591a2a31bfbd44a0281efe187c7
Python
9,092
224
''' Scoring functions between a reference annotation (ground-truth) and hypotheses (e.g. ML output). ''' __author__ = "Jonathan Dan, Una Pale" __email__ = "jonathan.dan at epfl.ch" import numpy as np from .annotations import Annotation class Scoring: """" Base class for different scoring methods. The class pro...
8eef8d895b01cc4d4a8a2221fc7ef64064ca7221606082f08f9e57303ed0b206
Python
9,095
216
import numpy as np import pkg_resources from os.path import join from packaging.version import Version from dipy.data import get_sphere, HemiSphere from dipy.reconst.shm import real_sym_sh_mrtrix from dipy.utils.optpkg import optional_package from dipy.reconst.shm import sph_harm_ind_list cvxpy, have_cvxpy, _ = optiona...
a705282ab6de91e2177314a452305bf6054d9f69a66e17e20ad484843d1e250e
Python
9,105
312
"""JASPAR API client for transcription factor binding profiles.""" import logging from typing import Any, Dict, List, Optional from .base import BaseAPIClient from ..config import settings logger = logging.getLogger(__name__) class JASPARClient(BaseAPIClient): """Client for JASPAR REST API. JASPAR is ...
f2d1667175534a6a03bc828941359f6df4650a2f64618f8d6ce16cefece9f254
Python
9,105
233
import numpy class RewardCalculator: """ Base class for the reward calculator """ def __init__(self, objs, *args, **kwargs): """ Instantiates the `RewardCalculator` :param objs: A `dict` of objective """ self.objectives = objs def evaluate(self, sted_image...
391bd131a51edf54a152159fff6ae2bb965af59192d303ac58c0648a62010343
Python
9,106
163
import os import click import torch import itertools import numpy as np import pandas as pd from Bio import SeqIO from scripts.model import SPIRED_Fitness_Union from scripts.utils_train_valid import getDataTest amino_acid_list = list("ARNDCQEGHILKMFPSTWYV") amino_acid_dict = {} for index, value in enumerat...
b7f34d7f60a5148abf4cb4c0ed07d93e64b1e0d34e7f90b23359eb4b5ab30388
Python
9,107
312
"""JASPAR API client for transcription factor binding profiles.""" import logging from typing import Any, Dict, List, Optional from ..base import BaseAPIClient from ...config import settings logger = logging.getLogger(__name__) class JASPARClient(BaseAPIClient): """Client for JASPAR REST API. JASPAR i...
50a9b6794ff4c6a52e338d09799dc55607a7457f5d995a2f4a76b7be63ed91ff
Python
9,109
228
import matplotlib import numpy as np import matplotlib.pyplot as plt from easydict import EasyDict as edict import sys sys.path.append('.') from BioMime.utils.params import coeff_a, coeff_b from NeuroMotion.MNPoollib.mn_params import DEPTH, ANGLE, MS_AREA, NUM_MUS, mn_default_settings class MotoneuronPoolStatus: ...
4fdf3c4b618de9b35de38f67b4baadd163196b9e0345fa16f50845f7c71acf28
Python
9,111
237
#################################################################################################### # 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...
ba9ebd940bcf62111852daa3bc68d5881f0eafa93627075d2705d47895b9a841
Python
9,113
258
"""Pseudo-bulk aggregation and bulk-style DE for single-EV proteomics. Single-EV proteomic atlases hold 10^4-10^6 vesicles; collapsing the per-EV signal to a sample x protein matrix recovers a classic "bulk" measurement on which moderated-t / OLS differential expression can be run for biomarker discovery. * :func:`ps...
e455fc89a22df487f86b118c13bac3c72e5e0eb71020a6abdc691b8cb1131fd5
Python
9,114
241
# -*- coding: UTF-8 -*- from datetime import datetime import argparse import logging import os import sys root_dir = os.path.abspath(os.path.dirname(__file__)) sys.path.append(root_dir) sys.path.append(os.path.join(root_dir, "models")) from models.FCN import FCNs,VGGNet from models.UNet_5 import UNet from models.segn...
0554a431ed0cbf9079bc17ac1369a8c4a97ff179a7480633ba473aab0a39d757
Python
9,115
200
#------------------------------------------------------------------------------------------------------------------------ #Author: Brandon S Coventry # Date: 08/23/2022 # Purpose: This program is a modified port of my previous heirarchical linear regression programs, updated for pymc (v4) # Revision History: Based ...
8b2b7dd3a3d7f5ccebe0b66f7fdbb122cbbd0ef2014a793dadafc85a1970dc75
Python
9,116
284
from typing import Tuple, Union import pandas as pd import numpy as np import torch.nn.functional as F # noqa from torch import ( nn, from_numpy, Tensor, no_grad, nan_to_num ) from python.utils import custom_logger from config import ( TARGETS, FORECAST_HORIZON, NEEDED_OUTPUT_COLUMNS, ...
e379fcf1f75296b4c098b82a588b13ff1cd23ace438f0ee1e4ff317b7fafdec7
Python
9,118
219
#################################################################################################### # Copyright (c) 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 free softw...
26c95fc760ca90139bc97dbeb50a8115b7fe1c1616f07a0cc35c9f63758a7fd9
Python
9,120
263
import warnings warnings.filterwarnings("ignore") import argparse import json # import matplotlib # import matplotlib.pyplot as plt import math import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch import cuda import sys, os import random import numpy as np from sklea...
3fe7ba18db5c4490cc99cd740d510045f56447398b0ca9f77c1841ba56803022
Python
9,125
236
"""Combines json files into a single .tsv table for analysis.""" import argparse import json import logging import os import pathlib import sys import pandas as pd logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s: %(message)s") def parse_args(args_list=None): """Parse command-line args...
7d53b8a9017011d00b05bd2724a222e064aaa120f665ebeaaa93f81bd5dbffa2
Python
9,125
197
import matplotlib.pyplot as plt import numpy as np def plot_signal(config, data, key, on, off=None, ax=None, xlabel=True, ylabel=True, twinx_label=True, labelsize=14, fontsize=24): if ax == None: ax = plt.gca() if off == None: off = on + config.window if config.sampling_freq == None: ...
ff565fba730fdd275db41d0426816dfb5a685867548640e4c9e6fe13f2c985f8
Python
9,125
230
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 19 11:18:43 2022 @author: sam BRANCHED FROM 04.19.22 """ import os import numpy as np import tensorflow as tf import keras from keras import backend as K import matplotlib.pyplot as plt def fit_script_stage123(folder,connectivity, noise=1e-4,syn_f...
10029d7445a60910d72138597592ac9bfc856032fd6603531d00b3ace6cd7b34
Python
9,126
261
""" Module defining a custom combo box containing checkable items. *** built as part of the Russell Ray Lab Breathing And Physiology Analysis Pipeline *** Breathe Easy - an automated waveform analysis pipeline Copyright (C) 2022 Savannah Lusk, Andersen Chang, Avery Twitchell-Heyne, Shaun Fattig, Christopher Scott ...
2511e929fee511ec7f5c8544a91c1a763df65d3a8f80f717f68ded8b085ae984
Python
9,128
362
import pytest import ray from ray.dag import ( PARENT_CLASS_NODE_KEY, PREV_CLASS_METHOD_CALL_KEY, InputNode, MultiOutputNode, ) @ray.remote class Counter: def __init__(self, init_value=0): self.i = init_value def inc(self): self.i += 1 def get(self): return self....
2a873a108dd2b36a893e077c4e1cb4ad7abe76165cc7ca15320b7ec1ea0592ad
Python
9,139
215
import numpy as np import os import utils import pandas as pd import random import torch import torchvision import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import Dataset, DataLoader from torchvision import datasets, transforms from torchvision.transforms import T...
77040b2a3154e9c733d04f22b4710f50039af5e39083171a794ff8794b4a5cbf
Python
9,140
239
# Modified from https://github.com/open-mmlab/mmdetection/tree/3.x/ import argparse import copy import os import os.path as osp from mmdet.engine.hooks.utils import trigger_visualization_hook from mmdet.registry import RUNNERS from mmengine.config import Config, DictAction from mmengine.dist import get_dist_info from ...
39e53d661ebc09a41d772f500d40f9173fee676eed3ab15c792557737816570c
Python
9,141
261
import logging import os from collections import deque import numpy as np from pfrl.experiments.evaluator import Evaluator, save_agent def train_agent_batch( agent, env, steps, outdir, checkpoint_freq=None, log_interval=None, max_episode_len=None, step_offset=0, evaluator=None, ...
4450831a875817d99dfae3bb3664ad66450a319251ec98ade110f639440488c6
Python
9,147
216
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from typing import Any from django.contrib.auth.models import Group from rest_framework import status from cvat.apps.engine.tests.utils import ApiTestBase from cvat.apps.iam.models import User class TestQualityRequirementApiForDeletedAttributes(A...
32aefdabae93b55c63adf19677093572ebf2c50c4a11d636dd001b4caa10f55e
Python
9,151
226
"""Pseudobulk aggregation of single-cell data. ``ov.single.pseudobulk`` collapses a single-cell AnnData into per-sample (optionally per-sample-per-celltype) pseudobulk profiles — the correct unit for cohort-level differential expression with DESeq2 / edgeR / limma (``ov.bulk.pyDEG``). The API mirrors :func:`decoupler...
98b11003b3434d9da5492e0dc56960087def09c4d554b7a54166c57abe221225
Python
9,151
228
from dataclasses import dataclass from typing import TYPE_CHECKING, Optional from ray.data._internal.datasource_v2.interfaces.pushdown import ( ListFilesPushdown, SupportsColumnPruning, SupportsFilterPushdown, SupportsLimitPushdown, SupportsPartitionPruning, ) from ray.data._internal.planner.plan_e...
bbf8d19b1ad95e33dd8d6627b541af131e964bd2a3fe6721fd9d7a7355cd10c0
Python
9,152
236
import torch import torch.nn as nn import torch.nn.functional as F from .swin_transformer import SwinTransformer,SwinTransformerBlock, BasicLayer, PatchMerging, PatchEmbed from timm.models.layers import DropPath, to_2tuple, trunc_normal_ from sleep_models.hypResnet import HypResnet class Mlp(nn.Module): de...
c19d8f90b8f889d87bce68eb0d5c14c80ff4e1c9208ecc206007e630945fd13c
Python
9,153
308
# Copyright 2026 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
9770c392b5762a312ba63ea8e91bfc128c6e36ca367eaa1fc29eb51d836b12a1
Python
9,162
292
""" This script simulates the structure-function mapping hypothesis for a varied number of angles (using the parameter 'phbins'). The results are plotted and saved. The saved figure is used in figure 4 (panel 'T') of the manuscript. """ from utils.grid_funcs import ( gridpop_clustering, gridpop_conj, gridpo...
7c897ccfa85838f42bdf29a92a7802d72a752f73acceee1a6fac0eccad59a0ac
Python
9,163
313
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """aihwkit example 20: MNIST training with PyTorch Distributed Data Parallel (DDP). MNIST training example based on the paper: https://www.frontiersin.org/artic...
bb3354da2ae12dc4a3d1b43955052066348436f6e6d91727d8af457ce391d562
Python
9,164
325
"""Utility functions for the project.""" import logging from functools import cache import numpy as np import pandas as pd from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem.Descriptors import ExactMolWt from scipy.stats import linregress, pearsonr, spearmanr from sklearn.metrics import mean_absolu...
954972a09fa2224f5632de708ad5d498343e13bcc9069274fe97926ddfd61593
Python
9,165
256
from dataclasses import dataclass from pathlib import Path from typing import Any, Iterable, Sequence import numpy as np import pandas as pd from numpy.typing import NDArray from siapy.core import logger from siapy.core.exceptions import InvalidInputError, InvalidTypeError from .pixels import CoordinateInput, Pixels...
7e3f4cb4813b72e16d1159df3f524a0e16c7a4f93f53a1c7394bc495458fda30
Python
9,166
272
import random from tkinter import W import brainrender as b import numpy as np from brainrender.actors import Point from brainrender import _utils #Find cell coordinates import csv as c file = open("CN_neuron_coordinates_allcells.csv") csvreader = c.reader(file) # Skip first line to get to get to data next(csvreade...
0b89e6892e6a2f7edefa25a8e8e342e043694727a7c94123fb77b6640c6ed141
Python
9,170
227
# -*- 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. #...
b76696b6f4b4444c3267529c0a8a177f44c73c04b848ee3c53f3afd8d652ab46
Python
9,171
295
"""RegulomeDB API client.""" import logging from typing import Any, Dict, List, Optional from .base import BaseAPIClient from ..config import settings logger = logging.getLogger(__name__) class RegulomeDBClient(BaseAPIClient): """Client for RegulomeDB regulatory variants API. RegulomeDB is a database...
5a91115c60b0caf941df50b7804aa40bb2415f346260bf984304d4f20e3eecec
Python
9,173
295
"""RegulomeDB API client.""" import logging from typing import Any, Dict, List, Optional from ..base import BaseAPIClient from ...config import settings logger = logging.getLogger(__name__) class RegulomeDBClient(BaseAPIClient): """Client for RegulomeDB regulatory variants API. RegulomeDB is a databa...
63237789c52291d1b835918c2dc538166ef79b38b0b36c1dd7054bc9498ccdab
Python
9,178
267
# -*- 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. #...
43311dffb87ad0b86d5ae69ba480d2a4c07cc68da7f0da9bfc4276ead46f7302
Python
9,179
215
import os from GNNSubNet import GNNSubNet as gnn import ensemble_gnn as egnn from sklearn.metrics import balanced_accuracy_score from sklearn.metrics import accuracy_score from sklearn.metrics.cluster import normalized_mutual_info_score from pickle import dump from typing import Union def getGraphs(model: egnn.ensem...