sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
f15ba9995b7ea59a87f3a437f3fa11f0b873cbeb2c61e7aa8202e6f39f2ba3fd
Python
8,701
249
from Bio import AlignIO from glob import glob from functools import partial import logging import multiprocessing as mp import numpy as np import os import pandas as pd from pathlib import Path import re import traceback from tqdm import tqdm logger = logging.getLogger("no_interpolation_ds") def read_genus_alignmen...
e6c06f1eb279e5753459d87eacc823392b35a1c6ab47b83c7ce346d76aa58d50
Python
8,710
252
""" Clustering and sampling of surface mesh points. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause from warnings import warn import numpy as np from sklearn.preprocessing import normalize from sklearn.cluster import AgglomerativeClustering from sklearn.cluster import k_means # fr...
e7487e607faef76a0f7987f1f9aae03e9587189ab864b7cc6a047381f9b15441
Python
8,711
198
############################################################################ # Copyright (c) 2025-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ """Tests for JointExonCounter: region-based exon quantificatio...
099dfbdae2a83a525878a019c4eea19dc4db7d7bede56e15b3e491d51d5294b4
Python
8,712
213
import batch_process.postprocessing.stim_response_util as stim_response_util import numpy as np import matplotlib.pyplot as plt def get_baseline_interval_start_times(stim_timestamps, timing_params): trains = stim_response_util.group_stim_pulses_into_trains( stim_timestamps, timing_params) ...
a9ae2138d3a81ace67c6eeec99b657660826781a7a213abc1516140628bbca1e
Python
8,718
287
""" Utility functions for templates. """ __author__ = "Fabi Bongratz" __email__ = "fabi.bongratz@gmail.com" import os from collections.abc import Sequence from copy import deepcopy import torch import torch.nn.functional as F import trimesh import numpy as np import nibabel as nib from trimesh.scene.scene import Sc...
4b4013c6f4fe9603489e8471956ea7dfc7a181190f5957bfda4efe5e6ddfd32e
Python
8,723
246
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
157a68e1c2274414aff005a47842bae52df843800ca779b4c429b40dd14eb362
Python
8,726
208
import torch import numpy as np import argparse as ap import os try: from models.gmx_ani import GmxANIModel except ImportError: GmxANIModel = None try: from models.gmx_mace import GmxMACEModel, GmxMACEModelNoPairs except ImportError: GmxMACEModel, GmxMACEModelNoPairs = None, None try: from models.gm...
dfcbe9dbe8ab8b568ff5af48673994a0514d091172b1d496366875f24029a85e
Python
8,734
202
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import anndata as ad import scanpy as sc from scipy.io import mmwrite, mmread import seaborn as sns import scipy np.random.seed(42) dir_path = "/home/nomura/Proj/mmvelo/experiments/Greenleaf_multiome_Cond_merged_all_missing/2024-01-19T11...
25d360daf2da56c79d535a9ac7eba5f0e8fd514dd8480e00fadf902846f814f3
Python
8,747
181
from typing import Union, List, Tuple from nnunetv2.configuration import ANISO_THRESHOLD from nnunetv2.experiment_planning.experiment_planners.default_experiment_planner import ExperimentPlanner from nnunetv2.experiment_planning.experiment_planners.residual_unets.residual_encoder_unet_planners import \ nnUNetPlann...
8324708fedee0b0af1cc9043f6b7eaeaf3bb44e6e64ba2b92e75a3771bf05cac
Python
8,747
173
''' Created on Jul 8, 2024 @author: voodoocode ''' import mne.io import os import csv import scrubber.core import pyexcel COLLECTION_META_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/data_collection_db2.csv" TGT_FS = 600 MIN_TIME_S = 30 MAX_TIME_S = int(5 * 60) - 30 # Max 5 min IN_PATH = "/mnt/data/P...
b528f027631555b4b04357d7f6f03274af036761e80b096ae8e4f239d6478576
Python
8,768
261
"""Figure S1 — Behavioral characterization. Panels: A: Response time histogram B: CDF of response times C: Psychometric curves (example session) D: Detection thresholds over weeks (individual animals) E: Response times over weeks (individual animals) Usage: python python/fig_s1/generate_figure.py """ im...
6e3e51b796e4319aa5c459a6553e2d98b759c3338bd082ac3376fb7350cae522
Python
8,774
207
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import math from typing import Any, List import torch from torch import nn from torch.nn import functional as F from detectron2.config import CfgNode from detectron2.structures import Instances from .. import DensePoseConfidenceModelConfig, DensePoseUV...
a676a98f7d717727f28f176a0770c314bfd321b34643acc8180fbe15502fb08f
Python
8,778
247
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Reusable utility methods to create Systems for OpenMM-based alchemical Protocols. """ from pathlib import Path from typing import Optional import numpy as np import numpy.typing as npt ...
4f720edfe119481cc70ce7354b1a6a3cae6fcb759db5f9c0bf7d2339ad937907
Python
8,780
217
from pathlib import Path import ast import hashlib import json import re import sys import joblib import pandas as pd import yaml ROOT = Path(__file__).resolve().parents[1] EXPECTED = [ "README.md", "MANIFEST.tsv", "CHECKSUMS.sha256", "run_windows.bat", "install_windows.bat", "requirements.tx...
99fd6a8606eeb92196039a3558481a33e63290eba917216dc776525381e4ab86
Python
8,797
238
"""Figure S9 -- Pop coupling panels (700ms, 120ms, control). Generates standalone pop coupling comparison panels for supplementary figure. Usage (from repo root): python -m python.fig_s9.generate_figure """ import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import ma...
6c48e372a34b19ffcd45d121db726f0e08a8864e0e477d40e836346288d97e7d
Python
8,798
298
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
e8e538f185c3b79e0b49d88260c5988f73fd29d4dc96b1ca76695fa85c4b8369
Python
8,798
138
# Copyright (c) Facebook, Inc. and its affiliates. import contextlib import copy import io import json import numpy as np import os import tempfile import unittest import torch from pycocotools.coco import COCO from pycocotools.cocoeval import COCOeval from detectron2.data import DatasetCatalog from detectron2.evaluat...
887acf18f7367289a6d0dbfbfc8ee6293682f0f1de3d46d39b1c8e07c88436a6
Python
8,803
187
"""Pair KNN and median/mode model-performance and SHAP sensitivity outputs.""" from __future__ import annotations import argparse import json from pathlib import Path import numpy as np import pandas as pd METRICS = ("r2", "mae", "mse", "rmse") def _metric_payload(cache: Path, model: str) -> dict[str, float]: ...
6e42c0669ab302f3ea33fcb2709930a74ed2f0e4cba60ec1dd318c20f9e879e8
Python
8,804
201
""" Skeletons ========= <!-- difficulty: intermediate --> Explore skeletons in an interactive 3D viewer - then render what you set up into a figure. Where [`plot2d`][navis.plot2d] fakes depth, [`plot3d`][navis.plot3d] has a real renderer: proper occlusion, proper perspective, and a camera you can throw around. The tr...
93716277a57f4108c9c163777db4c2178ddb50a1ac59da00385a0ad29ef84119
Python
8,807
209
# Copyright (c) Facebook, Inc. and its affiliates. import itertools import logging from typing import Dict, List import torch from detectron2.config import configurable from detectron2.layers import ShapeSpec, batched_nms_rotated, cat from detectron2.structures import Instances, RotatedBoxes, pairwise_iou_rotated from...
0ff238eb01a167f80cf6450f6598d2be01180d23397196222dad049c0c793a84
Python
8,813
307
#%% import pandas as pd import mne import scipy.signal as dsp import joblib from pathlib import Path from os.path import join import scipy.stats as stats import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pingouin as pg from fooof import FOOOFGroup from fooof.utils.params import compute_kne...
1ab943faffba46db12e9082397227471dcb1eff36a7eb2eded5045305062c210
Python
8,814
190
# ------------------------------------------------------------------------------ # Title: Summary of Commot Spatial Communication Results # Author: Yiran Song # Date: March 18, 2025 # Description: # This script extracts and summarizes pathway-level ligand-receptor interactions # from Commot spatial communication result...
f2cbd5eec3b6e1a80b309f4cc7f36080b57cdde2dc5bfef106d5e54234584e5a
Python
8,819
249
#!/usr/bin/env python3 """Computes PNG counts from hyperparameter sweep experiments. This script takes PNG detection databases from hyperparameter sweep experiments and computes counts per layer, outputting serialised results organised by hyperparameter value. The swept hyperparameter is automatically detected from t...
4eb017b27f1b27e0a2cbb76f95a3ccacce94280a42e0eb70bf8683e071f0c771
Python
8,829
263
# Copyright (c) Facebook, Inc. and its affiliates. import importlib import numpy as np import os import re import subprocess import sys from collections import defaultdict import PIL import torch import torchvision from tabulate import tabulate __all__ = ["collect_env_info"] def collect_torch_env(): try: ...
a514902954dff414a214e4f1931606a949a595de16ca117df371358bd6bf73c4
Python
8,830
254
import numpy as np from collections import deque from copy import deepcopy from matplotlib import pyplot as plt def firing_rate(v, beta): return 1.0 / (1.0 + np.exp(-beta * v)) class Neuron(): ''' A neuron class with simple continuous dynamics exhibiting firing rate adaptation ''' def __init__(sel...
42cd02857cbd53b00ef18883191bccb663083b3b32828a0e27b4d128312a375a
Python
8,837
305
# %% from __future__ import annotations import sys import matplotlib.pyplot as plt import mne import numpy as np import seaborn as sns from matplotlib import font_manager as fm from matplotlib.gridspec import GridSpec from mne.io import BaseRaw from mne_bids import find_matching_paths from mne_bids import read_raw_bi...
83bdda7536148fc87773fb80a42b21a314990215fccc073997d4f3aa994b2edf
Python
8,838
313
import numpy as np def freedman_diaconis_bins(x): """ Return the optimal number of histogram bins using the Freedman–Diaconis rule. Parameters ---------- x : array-like 1D array of samples. Returns ------- int Number of bins. """ x = np.asarray(x).ravel() ...
c127a31f67f9cc38e3fa31195312a23ffb7c959069857b1e6ce5500efa22ede6
Python
8,839
246
#!/usr/bin/env python3 # # Copyright (c) 2025 10X Genomics, Inc. All rights reserved. # """Generate library plots for multi web summary. For a single library, generate the barcode rank, jibes plots as plotly JSON, and barnyard count biplots, so that they can be passed forward to the WRITE_MULTI_WEB_SUMMARY stage and i...
ab4b55db4040c5a6d942fbde4a0b5e4f78a967bdb33dd09f74a490a3937e9eef
Python
8,840
245
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # Lightning Trainer should be considered beta at this point # We have confirmed that training and validation run correctly and produce correct results # Depending on how you launch the trainer, there are issues with processes terminating correctl...
c0fb5542ece58cda30688f1a272395b42b493c69deb12e2157fb633eede875b3
Python
8,841
266
""" Embedding alignment using procrustes analysis. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause import numpy as np from sklearn.base import BaseEstimator def procrustes(source, target, center=False, scale=False, return_transform=False): """Align `source` to ...
0359b586c082c5f83ec9d8dca44e8e14e3ffa61683a8ebd5cf4b925eaad58bd6
Python
8,866
259
from Bio import AlignIO from glob import glob from functools import partial import logging import multiprocessing as mp import numpy as np import os import pandas as pd from pandarallel import pandarallel from pathlib import Path import traceback from tqdm import tqdm logger = logging.getLogger("balanced_interpolatio...
50e3a8fa5148623192e0c88ef71ba2b591723351d11f1b40b420e5d1e3ebae98
Python
8,884
243
# Copyright (c) Facebook, Inc. and its affiliates. import io import unittest import warnings import onnx import torch from packaging import version from torch.hub import _check_module_exists from detectron2 import model_zoo from detectron2.config import get_cfg from detectron2.export import STABLE_ONNX_OPSET_VERSION ...
3cf38b57215a85828662ac453b98c82806fbc336a8a645755869d65c5c706457
Python
8,885
265
#%% from pathlib import Path import sys sys.path.append('/mnt/obob/staff/fschmidt/cardiac_1_f') from utils.data_loading import data_loader import bambi as bmb from scipy.stats import zscore import arviz as az import pingouin as pg import pandas as pd import joblib import numpy as np import pymc as pm import matplotlib...
123011374b8db75f056952dba05726f91fd82f991a3fd9011d7ac92b7f5a8c8f
Python
8,905
250
from typing import List import torch import stoic.model as model_module from stoic.model import Stoic class DummySeqEmb(torch.nn.Module): def __init__( self, model_name: str, max_seq_len: int = 8, full_length_inference: bool = False, max_inference_seq_len=None, fi...
ed7c7242b8e792d4fcd6bd807399daea945a6543da791b8bfaa688f846df6f88
Python
8,906
253
#!/usr/bin/env python # # Copyright (c) 2019 10x Genomics, Inc. All rights reserved. # from __future__ import annotations import json from typing import TYPE_CHECKING import martian import numpy as np import cellranger.constants as cr_constants import cellranger.matrix as cr_matrix import cellranger.rna.library as...
849ff643eed26c0b125b3d0de093b9758a352e15b9d90e0e9fd8c137626d1ec9
Python
8,907
193
from matplotlib import pyplot as plt import numpy as np import os import pickle from scipy.signal import savgol_filter as sg from rCPGswCPG.utils.gen_utils import get_project_root from rCPGswCPG.utils.utils import get_val_of_param from rCPGswCPG.model_params.config_loader import load_model_cfg_file, model_params_from_c...
92ba95e6f6950d9e8021358346ea35e194b492a7c96bf20551b78b6dca82fb80
Python
8,923
265
""" Created on May 14, 2025. @author: voodoocode """ import pyvista import numpy as np import scipy.ndimage import shutil import finnpy.misc.external_calls as ex_c import os import finnpy.visualization.volumetric_plots as vp np.random.seed(0) STRUCT_PATH = "/mnt/data/Professional/projects/finnpy/DISTAL (Ewert 2017)...
a593014c47d83762b3a8a4cb1071e937327beab3f8c57745dcfc4af95a5a4936
Python
8,928
289
import numpy as np from PIL import Image import matplotlib.pyplot as plt from glob import glob from scipy.io import loadmat def createFlowDataset(categories, topdir, mydirs, orig_shape, input_shape, scl_factor, N_INSTANCES, trial_len, stride): scld_shape = tuple((np.array(orig_shape)*scl_factor).astype('int')) ...
321b180ea0802182ff4d17b5c363805ce11c1a501b92a9e8727b94e9cfe3bb12
Python
8,930
260
""" Test null models """ import pytest import numpy as np from scipy.spatial.distance import pdist, squareform from tempfile import gettempdir from os.path import join, exists import vtk from brainspace.vtk_interface import wrap_vtk from brainspace.vtk_interface.pipeline import to_data from brainspace.mesh import me...
bcb151e77ae3b3820408b0477eb93d204b51dcbb92504fc1b42d20e824615f74
Python
8,930
213
import torch import torch.nn.functional as F from stoic_train.losses import ( ComplexProductLoss, FocalLoss, ResidueWeightFocalLoss, ResidueWeightKLLoss, ResidueWeightL1Loss, SparsityLoss, ) def test_focal_loss_reduction_none_returns_per_sample_vector() -> None: inputs = torch.tensor([[2....
c3f25ae759f8d7a9c3a26d81e06006f43c7c73e0d1c39699f6b97d9054070f65
Python
8,930
379
open_images_unify_categories_for_coco = { '/m/03bt1vf': '/m/01g317', '/m/04yx4': '/m/01g317', '/m/05r655': '/m/01g317', '/m/01bl7v': '/m/01g317', '/m/0cnyhnx': '/m/01xq0k1', '/m/01226z': '/m/018xm', '/m/05ctyq': '/m/018xm', '/m/058qzx': '/m/04ctx', '/m/06pcq': '/m/0l515', '/m/03m...
aad6cc841345eea47d168cf35c408d546f6e4d9e5a73b52031a0980ebaeb0d7d
Python
8,941
274
import torch from stoic.feature_pooling import ( AveragePooling, MaskedInstanceNorm1d, SelfAttentionPooling, ) def test_masked_instance_norm_preserves_shape() -> None: norm = MaskedInstanceNorm1d(num_features=4, affine=True) x = torch.randn(2, 4, 6) mask = torch.tensor( [[False, False...
9d5fd523c0b72f685512535137a41b575f109d6ac5f6f567a3a3f3c099141896
Python
8,944
232
#!/usr/bin/env python3 ############################################################################ # Copyright (c) 2023-2026 University of Helsinki # # All Rights Reserved # See file LICENSE for details. # Author: Andrey Prjibelski ############################################################################ import ar...
a7d0efd5ad9f4b8fee58456848ca810fb0c754190ee1fccaef952bcc017a021d
Python
8,945
254
# --- Python 标准库 --- import gc import warnings # --- 第三方核心科学计算库 --- import numpy as np import pandas as pd # --- 生物信息学与数据分析库 --- import anndata as ad import scanpy as sc import seaborn as sns import matplotlib.pyplot as plt # --- 深度学习库 (PyTorch) --- import torch import torch.nn.functional as F # --- 脚本级别的设置 --- war...
f80b86de65bec65368f55f83a6226a5e9e4efc5b30dbdeb572e6fe856106d8fc
Python
8,950
240
# Copyright (c) 2019 10x Genomics, Inc. All rights reserved. from __future__ import annotations import csv import os from collections import Counter from typing import TYPE_CHECKING import numpy as np from six import ensure_binary, ensure_str if TYPE_CHECKING: from collections.abc import Iterable, Mapping cla...
caedae4269b3d5d2220cf63ce6b7bca9d22e3d06b2d483801f71d84d5e7716c3
Python
8,953
247
# Copyright (c) Facebook, Inc. and its affiliates. import logging import math from bisect import bisect_right from typing import List import torch from fvcore.common.param_scheduler import ( CompositeParamScheduler, ConstantParamScheduler, LinearParamScheduler, ParamScheduler, ) try: from torch.opt...
48f23dab7b983e9ae023f72ba6a671182aa403cdc8cad198844776fdb8989d8f
Python
8,956
197
from typing import Union import numpy as np import tifffile import torch from .unet3d import UNet3D from ..progress import ProgressNotifier from ..utils import save_as_tif, get_device class Predict: """ Class for prediction of movies or 3D stacks with 3D U-Net 1) Loading file and preprocess (normalizat...
c12af987b74bf151096e9d7a9e3c29d1c9e01bf78553b05ba50c6dc839cb0ce1
Python
8,959
284
"""tests for matplotlib components.""" import networkx as nx import pytest from matplotlib.figure import Figure from mesa import Model from mesa.discrete_space import ( CellAgent, HexGrid, Network, OrthogonalMooreGrid, VoronoiGrid, ) from mesa.visualization.components import AgentPortrayalStyle, P...
5ca8cdb352f35ec30dab3af4698e362d304996e3b847565d976d233b1f22b490
Python
8,960
223
#!/usr/bin/env python # # Copyright (c) 2016 10X Genomics, Inc. All rights reserved. # from __future__ import annotations import csv import os import shutil import martian import tenkit.bcl as tk_bcl import tenkit.lane as tk_lane import tenkit.preflight as tk_preflight import tenkit.samplesheet as tk_sheet __MRO__...
f844d7b95a0382560477cbf21cd271510c89a1c5f64248bda2b4796a6b90ba3c
Python
8,965
218
# -*- coding: utf-8 -*- """ Figure 5: Receptor x Cognition PLS analysis Note: to load pls_result: pls_result = pyls.load_results(path+'results/pls_result.hdf5') """ import numpy as np import pandas as pd import pyls import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap import seaborn as sns from...
48a2da4fee36113bc44a7c6f2eb14206eb64038cc99f60d4b7dcbad0d75ed636
Python
8,966
267
""" CASCADE built-in self-test ========================== Generates a synthetic MEA recording and runs every core module. No real data files required. Usage: cascade --test """ import sys import traceback import numpy as np from cascade.utils.common import MEARecording # ── terminal colours ───────────────────...
4cd44410ab2aa000f3c8fa954e02cc502e883b8f1e43c2e8942af78444c87326
Python
8,966
205
# -*- coding: utf-8 -*- """ Save output from readCMRRPhysio.py in BIDS format, taking number of skipped volumes in FMR into account. This script runs with physiological data (pulse and/or respiratory) saved as _Info.log, _PULS.log, _RESP.log or for physiological data saved in DICOM/IMA As input it requires the physio...
b073a2a841e17f6dfa081ac83b4f5c661e3cb99cab6212d82dd8f2f01eac5540
Python
8,969
221
"""Bundle save/load round-trips for all three model families. The bundle is the interface between training and inference, and Stage 2 changed its dispatch: the MLP branch was removed and a VAE branch added. These tests pin down that ``config_type`` still routes correctly, and that the legacy architecture aliases keep ...
50f1e8c1763fef86c5df624d0af330898555cf6d18b7dc8e925aedb6a76ec8ee
Python
8,977
228
# Copyright (c) Facebook, Inc. and its affiliates. import copy import json import os from detectron2.data import DatasetCatalog, MetadataCatalog from detectron2.utils.file_io import PathManager from .coco import load_coco_json, load_sem_seg __all__ = ["register_coco_panoptic", "register_coco_panoptic_separated"] d...
34a0add1293f3a15960a388fe975e668d5f69b6a458c4572999a415fa63f2528
Python
8,997
286
from __future__ import annotations from collections.abc import Iterable, Iterator, Mapping from typing import Literal, TypeVar, overload import more_itertools as itx from snakebids.types import ZipList, ZipListLike from snakebids.utils.containers import ContainerBag, MultiSelectDict, RegexContainer T_co = TypeVar("...
a12b24134b37216d4dab5e92acb725eecd119a8c3a591c818cedd5297066f483
Python
9,002
251
"""Behavioural contracts for the morphometrics fastcore implements. Replaces `tests/test_fastcore.py`, which was entirely differential: every test computed a quantity with navis-fastcore and again with it monkeypatched away, and asserted the two matched. With fastcore a hard requirement there is no second implementati...
02864d52100e38ecb9ee6e31b05c4397b6318dfacd17c5fbfdf2056fd3a9307c
Python
9,003
315
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Reusable utility methods to validate input settings to OpenMM-based alchemical Protocols. """ from typing import Optional from openff.units import Quantity, unit from openfe.protocols....
800a86187759d9323fca39a9aae12251b893d587c018dbbbd774dbf892384c1e
Python
9,003
255
"""Loss functions for stoichiometry model training.""" from typing import Dict, Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F class FocalLoss(nn.Module): """Focal loss for addressing class imbalance (Lin et al., 2017). Down-weights well-classified examples so the model ...
b2b1d8df9870977fef1192406aa7336916b63f4982dba97da748c70504033b22
Python
9,004
243
""" =============================================================================== additional_classes.py - Provides EnzymeDatasetAACoarseGrain, a lightweight PyG Dataset that builds coarse‑grained amino‑acid graphs from mmCIF files. - Each residue becomes one node (centroid of its atoms), features are [coords or...
6d169f4bf4b4b4d12417fb12acadeb4b51164d906113b0142be55884c81016ef
Python
9,008
235
# Copyright (c) Facebook, Inc. and its affiliates. import numpy as np from typing import Any, List, Tuple, Union import torch from torch.nn import functional as F class Keypoints: """ Stores keypoint **annotation** data. GT Instances have a `gt_keypoints` property containing the x,y location and visibilit...
eef5c8f2d8510204c1c1ffa216b92f11413f33cec3a26347ac48b6b63e9ab98c
Python
9,013
255
# --- Python 标准库 --- import gc import warnings # --- 第三方核心科学计算库 --- import numpy as np import pandas as pd # --- 生物信息学与数据分析库 --- import anndata as ad import scanpy as sc import seaborn as sns import matplotlib.pyplot as plt # --- 深度学习库 (PyTorch) --- import torch import torch.nn.functional as F # --- 脚本级别的设置 --- war...
be837c1382768df158c3d20be5758aa76b58d56d1853ff472392c49730282fca
Python
9,015
171
""" Standalone pass that builds the foreground sampling location store for a preprocessed configuration folder. This is deliberately separate from preprocessing: * it only reads the stored ``_seg.b2nd`` files, never the image data. On TotalSegmentator v2 that is 0.24 GB rather than 45 GB, so a full re-extraction...
d1ac40e1583274cadf1b88d6899c402f01b08c61fec214d508347cb2bd2807a5
Python
9,018
198
import csv import os import random from pathlib import Path import nibabel as nib from batchgenerators.utilities.file_and_folder_operations import load_json, save_json from nnunetv2.dataset_conversion.Dataset027_ACDC import make_out_dirs from nnunetv2.dataset_conversion.generate_dataset_json import generate_dataset_j...
62b5cc534aab925735b3dc4d6c9363efdd9cea513b04fb35c6e828023436870c
Python
9,028
226
import os import numpy as np import pandas as pd import anndata as ad import numpy as np import scanpy as sc import time import matplotlib.pyplot as plt from .TSvelo_utils import run_paga, run_palantir, get_colors, show_imgs, show_imgs_simple, show_imgs_alpha_s, sigmoid, relu, leaky_relu from scipy.stats import pears...
12d3b7dd3cb3ae13c839a35df588b3758a107a2ec6f1951d679f9b6e93d0b895
Python
9,046
286
#!/usr/bin/env python # # Copyright (c) 2020 10X Genomics, Inc. All rights reserved. # """Slice the filtered matrix into per sample matrices.""" from __future__ import annotations import csv import gc import json from typing import TYPE_CHECKING import martian import cellranger.cr_io as cr_io import cellranger.matr...
fbb771dff81602d4c5e85f40c176e2fac36c94037ea9b6de5b229db5d2420509
Python
9,060
316
#!/usr/bin/env python3 """Downloads IMGT sequences and creates a FASTA file suitable for input into `cellranger mkvdjref --seqs`. Creates two files: <prefix>-imgt-raw.fasta <prefix>-mkvdjref-input.fasta Where <prefix> is the string given via the --genome arg, *-imgt-raw is the IMGT segments translated to FASTA, ...
57378dbb895fd2e2f4350e10d589eabc3d0f9ee164be6051865fca080e25a60d
Python
9,070
283
"""Tests for `navis.heal_mesh`. Note that the example mesh genuinely consists of several connected components (one main body plus a handful of small bits), so it doubles as a real-world fixture here - no artificial fragmentation needed. The exact counts depend on whatever mesh is currently vendored, so the tests below...
71b2898edf171c328885c82345aa7b4d73a8131882359290846148810e499a4b
Python
9,075
258
""" Test whether the NestML implementation of the Triplet synapse (with TM dynamics) follows Python implementation. """ import matplotlib.pyplot as plt import pandas as pd import numpy as np import nest from test_utils import generate_code, generate_regular_spike_train, generate_poisson_spike_train nmodel = "../netwo...
781796ab09c5021fd56f7435fe3b8515b47dc1119d8dc31eddc8ea99fdf08865
Python
9,088
239
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
620266ec8186dfb8b5faa9fb63ece8e76aa90978f69a4d7acd6d2151b4177c27
Python
9,113
210
import pickle import os import numpy as np from scipy.optimize import fsolve from tqdm.auto import tqdm import numdifftools as nd import warnings from rCPGswCPG.Network import firing_rate from rCPGswCPG.Network import construct_model from rCPGswCPG.model_params.config_loader import load_model_cfg_file, model_params_fro...
5b354116186593f549776afbd46612d1dc19d3a57de60569725ac9b13f78c860
Python
9,117
222
"""MolGpKa protonation backend (new default, v1.3.0). MolGpKa predicts a per-atom micro-pKa on the *neutral* molecule, independently for each ionizable site. Applying Henderson-Hasselbalch to those independent values over-protonates molecules with coupled ionizable centres (e.g. piperazine would come out doubly proton...
055460e65efebbe679918816234339d6b660412ca749a5e8e22036bd26191400
Python
9,122
272
#!/usr/bin/env python # # Copyright (c) 2020 10X Genomics, Inc. All rights reserved. # """A helper stage to put all of the per sample outputs together into a struct.""" from __future__ import annotations import os from typing import TYPE_CHECKING, Any import martian import cellranger.cr_io as cr_io from cellranger....
9ba94687c11df4a4d8e567193d51cbf1e77d59c949665f84d7d8f2a62b0f0d2b
Python
9,124
230
"""Speaker diarization using Silero VAD + Resemblyzer embeddings.""" import csv import numpy as np import torch from scipy.cluster.hierarchy import fcluster, linkage from scipy.spatial.distance import pdist, squareform from .audio import load_audio_16k from .config import TAPAConfig def load_silero_vad(): """L...
d7be8733781b2248f3020a8b5b9941f3559ec7f53c34b0d6a78f0595a850ca10
Python
9,127
221
############################################################################ # Copyright (c) 2023-2026 University of Helsinki # # All Rights Reserved # See file LICENSE for details. ############################################################################ """ Memory-efficient k-mer indexers using 2-bit DNA encoding...
f974b6be09c24dce0da7a4a883d0cadf24ffffcfbb1ed4a2faf069743a3dbcaf
Python
9,137
254
""" PyTorch implementation of Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization [Huang+, ICCV2017] This code is based on the following github repo: https://github.com/naoto0804/pytorch-AdaIN (cloned on 22nd Feb 2018, commit 1a059f43ef5f67eb42daacb60869ed04b7c4c4c7) """ import os import sys im...
8d9814bcf2787f28f7660a579750db0afcb02c79ca164938d4d45cd911a64fac
Python
9,147
217
#!/usr/bin/env python # # Copyright (c) 2026 10X Genomics, Inc. All rights reserved # """Compute the per-barcode reduction plan for the CRISPR perturbation sufficient-statistics split. `SPLIT_PERTURBATION_MATRIX` (Rust) streams the feature-barcode matrix once and emits, per MEASURE chunk, the sSeq differential-expres...
f73b33df4af69aac163eea4a2a722ef78fca9ba66e7771e613d5160bb934246f
Python
9,181
288
""" Molecular featurisation for GNN models. Converts RDKit molecule objects into PyTorch Geometric graph Data objects. VAE featurisation lives in :mod:`nfml.data.vae_featurisation`. """ import logging from typing import Any, Dict, List, Optional, Tuple import numpy as np import torch from rdkit import Chem from rdkit...
e364f62693e1c43356560fe655a77f75c5f325a4af721c8371c19055e5db3578
Python
9,190
215
from pathlib import Path import json from datetime import datetime import matplotlib.pyplot as plt import shutil import numpy as np import torch import torch.nn as nn from tqdm import tqdm from torch.utils.tensorboard import SummaryWriter from model import MultiModalTransformer, MultiModalConv from data2 import dataloa...
65ee851e5bec0fe1ece0523c6dc9446748922031c515cf0bc47c968e1b5bb634
Python
9,201
253
############################################################################ # Copyright (c) 2023-2026 University of Helsinki # # All Rights Reserved # See file LICENSE for details. ############################################################################ """ Basic k-mer indexers for barcode calling. KmerIndexer: ...
d7c50027d3f12698b19b9956044f881ca84c37727a53116f3bb323ffc1026497
Python
9,204
198
import glob import os from typing import Union import tifffile import torch.optim as optim from torch.utils.data import DataLoader, random_split from tqdm import tqdm from .losses import * from .predict import Predict from .unet import Unet from .attention_unet import AttentionUnet from ..utils import init_weights, g...
fd0f456028fb37f83cf257b00d76c151d16a4d6140c3485617c4b3d8bb6fd2e5
Python
9,208
255
""" Created on 11/09/2023 @author: Marc Schneider Neuroimaging & Neuroengineering Department of Neurology University Hospital Cologne """ import nipype.interfaces.fsl as fsl import os, sys import nibabel as nib import numpy as np import applyMICO import shutil #makes sure to import bet.py sys.path.insert(0, os.path...
f0016e9124b030d8e76b2a6731dbfeef499b5c17ee732cc2acc1665dfb54b219
Python
9,210
230
# Copyright (c) Facebook, Inc. and its affiliates. import copy import logging import os import torch from caffe2.proto import caffe2_pb2 from torch import nn from detectron2.config import CfgNode from detectron2.utils.file_io import PathManager from .caffe2_inference import ProtobufDetectionModel from .caffe2_modelin...
d6aecd2b13f7b6119a163aeb279b668127fb1ac6b789af7dd36fc0cd8a4e5d39
Python
9,211
265
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. import functools import inspect import logging from fvcore.common.config import CfgNode as _CfgNode from detectron2.utils.file_io import PathManager class CfgNode(_CfgNode): """ The same as `fvcore.common.config.CfgNode`, but differe...
9c803d0e72bff22c9b4fde9c71420b41f998c3ea255f85d59b017afcbe2d0d3c
Python
9,221
254
"""Timestamped run folders under ``output/`` for analysis artifacts (not raw CZI inputs).""" from __future__ import annotations import io import json import os import zipfile from datetime import datetime from typing import Any, Iterator OUTPUT_ROOT = "output" CHANNEL_MAPPING_CONFIG_FILENAME = "channel_mapping_confi...
bdc8f7b09d55f475e57279d54d5bcb906853db39cf33b4bb930f19afadf3ed73
Python
9,240
280
from sklearn.decomposition import PCA import umap import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit import pandas as pd from spikeinterface import full as si from pathlib import Path import pickle import batch_process.util.template_util as template_util def get_trough...
88fcc184f8b2edcb216c6b1ef321c23a228a20421a11bc2a2814c69aed3b60a8
Python
9,248
258
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ #!/usr/bin/env python3 import os import argparse import nump...
3f87aaf9198b84052e8b16a23376a59a3f248de28d625cb297453e3a531a06ba
Python
9,251
285
""" Class for Pseudobulking """ from typing import Optional, Union, List import itertools as it import numpy as np import pandas as pd import anndata as ad from tqdm import tqdm class ADPBulk: def __init__( self, adat: ad.AnnData, groupby: Union[List[str], str], method: str = "sum"...
95f0a1ab608b995188b2704069d4b83f8015dca1976055c27bc3aaa89c77f367
Python
9,261
315
import os import time import random import numpy as np import pandas as pd import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader, TensorDataset from collections import Counter from typing import Optional import scanpy as sc import anndata as ad import ...
cd5d1f120ba848ecf6975e13b0d0b04ddf3b81b549c5c5baa4f3ed09dff0465a
Python
9,262
195
""" Skeletons ========= <!-- difficulty: intermediate --> Fine-tune skeleton figures: radii, tapering, halos and depth sorting. [`Skeletons`][navis.Skeleton] are lines, and lines are what `matplotlib` is best at - so [`plot2d`][navis.plot2d] gives you considerably more control here than any of the 3D backends. If you...
a475b08266ff8ac76d7da4d44faf6b74aebbe2d7e75e372aeee685869810977c
Python
9,272
231
#!/usr/bin/env python # # ############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2019-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. ####################################################...
3baee372779ab756adf9262b2b36cfa0d34d0f38dea066437fe07f59ef9cf41c
Python
9,275
218
""" If you use this code, please cite the first SynthSeg paper: https://github.com/BBillot/lab2im/blob/master/bibtex.bib Copyright 2020 Benjamin Billot 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 ...
a91834e6a93964e36334d94c812a7d11eca4dda0c672bf9eb39096018750721d
Python
9,283
259
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import logging import os from typing import Any, Dict, Iterable, List, Optional from fvcore.common.timer import Timer from detectron2.data import DatasetCatalog, MetadataCatalog from detectron2.data.datasets.lvis import get_lvis_instances_meta from dete...
2c1fb6c6597843cf503aace527c846e0f30d9f134e23262d76ee9c97c6e30950
Python
9,308
239
from collections.abc import Iterable, Sequence, Sized import copy from enum import auto import logging from astartes import train_test_split, train_val_test_split from astartes.molecules import train_test_split_molecules, train_val_test_split_molecules import numpy as np from rdkit import Chem from chemprop.data.data...
f71ce0ec78824b13c238710d11a60a49065c486bd982dc5900bb13ccee96d218
Python
9,308
336
"""Agent.py related tests.""" from typing import ClassVar import numpy as np import pandas as pd import pytest from mesa.agent import Agent from mesa.model import Model class AgentTest(Agent): """Agent class for testing.""" def get_unique_identifier(self): """Return unique identifier for this agen...
98171b5331d958ef9843d9c0d68ccc082bfcaa193f66216fb07be27a420354ed
Python
9,316
238
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2017 Philipp Schlegel # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of...
3f7cf66782e95c60a046ea43afb99e3e7a20a4a9909504a07b8003415fa4c15e
Python
9,326
300
""" Cortical Neurons ================ <!-- difficulty: advanced --> Recreate a published figure of cortical GABAergic neurons arranged by soma depth. In this exercise we will visualize morphological data from ["Integrated Morphoelectric and Transcriptomic Classification of Cortical GABAergic Cells"](https://www.cell...
da1b3da72695cc0984f1899ef450656d60af13b48624e7a5466475e0b8db0817
Python
9,332
215
from typing import Union, Tuple, List import numpy as np import torch from batchgeneratorsv2.helpers.scalar_type import RandomScalar from batchgeneratorsv2.transforms.base.basic_transform import BasicTransform from batchgeneratorsv2.transforms.intensity.brightness import MultiplicativeBrightnessTransform from batchgen...
fc036704a8f78ec4ca7223316ef7c9d6431088791cd9116062d4678afe30a145
Python
9,333
277
# -*- coding: utf-8 -*- import math from typing import Optional, Literal import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F # ---------- Preprocess: EEG -> (B, 128, H, W) spectrogram tensor ---------- class Spectrogram128(nn.Module): """ Converts EEG (B, 128, T...
30f6cd0da5df0e2e2badde9182baada42e53c9a27a396a569c4c1ecaa726d3e3
Python
9,343
262
#!/usr/bin/env python # Copyright 2017-2021 Biomedical Imaging Group Rotterdam, Departments of # Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
60ed29fd061159a148a273d874422969aa57b1823dd9d602a0a621db437bcabe
Python
9,351
272
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Scaling Parameter and Vocabulary Computation Script This script computes scaling parameters and vocabularies needed for data transformation: 1. Min/Max values for numeric features (num_claims, backward_citation_count, etc.) 2. Global Min/Max for text embeddings (text_...