sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
b908b921035979be40fcf37050db3729372723054f712db128510a114377207f
Python
22,160
394
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2020-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. ############################################################################ ...
98ab45853b30d3014274b29fad583e2991efd0d9ac144e869c3e0d4e14bc2512
Python
22,215
602
""" Loss function collection for convenient calculation over multiple classes and/or instances of meshes. Notation: - B: batch size - S: number of instances, e.g. steps/positions where the loss is computed in the model - C: number of channels (= number of classes usually) -...
346e63e87915b8e911cd97d4da74b36021acdff23d35c6a01478604081a55115
Python
22,223
613
"""Grid-based cell space implementations with different connection patterns. Provides several grid types for organizing cells: - OrthogonalMooreGrid: 8 neighbors in 2D, (3^n)-1 in nD - OrthogonalVonNeumannGrid: 4 neighbors in 2D, 2n in nD - HexGrid: 6 neighbors in hexagonal pattern (2D only) Each grid type supports o...
f301f605d3f5303fd9927eb020c7138c78c5eb4b0af1d220a4d6721ab2fa19b9
Python
22,238
650
# -*- coding: utf-8 -*- import numpy as np import cv2 import torch from functools import partial import random from scipy import ndimage import scipy import scipy.stats as ss from scipy.interpolate import interp2d from scipy.linalg import orth import albumentations import ldm.modules.image_degradation.utils_image as ...
bd21bcea05b9a5ef87ac70e24edf55e8f775c9be009a126bf77ced36c548e33e
Python
22,289
652
#!/usr/bin/env python3 # # Copyright (c) 2014 10X Genomics, Inc. All rights reserved. # # Utilities for manipulating fasta and fastq files # from __future__ import annotations import glob import gzip import os import re import sys from typing import IO, TYPE_CHECKING, BinaryIO, Literal, TextIO, overload import numpy...
20d941bd3e1b94c150a267609c237ee0c920df5dadaa2ce682c5ddb20482bbbe
Python
22,292
512
from __future__ import print_function import json, time, os, sys, glob import shutil import numpy as np import torch from torch import optim from torch.utils.data import DataLoader from torch.utils.data.dataset import random_split, Subset import torch.utils import torch.utils.checkpoint import copy import torch.nn as ...
d43d0c6d71066530dd6001504fa37fe5bfc943165830f79d7800d0fe0353c7ac
Python
22,294
621
# -*- coding: utf-8 -*- """Functionality for transforming files between spaces.""" import os from pathlib import Path import nibabel as nib from nilearn import image as nimage import numpy as np from scipy.interpolate import interpn from neuromaps.datasets import (ALIAS, DENSITIES, fetch_atlas, ...
8aa9842905fdb5013f741c793ec76e1430a635b32de4d2255d3ed9ce2c730141
Python
22,356
732
""" Base wrapper for VTK objects. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause import numpy as np import vtk from vtk import (vtkAbstractArray, vtkStringArray, vtkIdList, vtkVariantArray, vtkDataArray) from vtk.numpy_interface import dataset_adapter as dsa from ...
79c6091310ce368cc35aeb4e7d2c21d143376e4c5b0dbbb5ace949200098efd0
Python
22,383
569
from __future__ import annotations import io import logging from typing import Iterable from lightning import pytorch as pl import torch from torch import Tensor, nn, optim from chemprop.conf import LIGHTNING_26_COMPAT_ARGS from chemprop.data import BatchMolAtomBondGraph, BatchMolGraph, MolAtomBondTrainingBatch from...
457840952069d4f3f064b7ea7f6ca5cb2858dd19fbe63a6e5ab2f17b6309a7fa
Python
22,409
661
""" Created on Mon Sep 15 11:49:07 2025 @author: dcupolillo """ from __future__ import annotations import pandas as pd import numpy as np from spyne.core.spines.analysis.spatial_distances import ( distance_along_neurite, get_path_to_root, path_distance, prepare_neurite_distance_tools) from typing import T...
8a90c5277aea7e73c3e7233238552d62bf71c3498110237a053a3a266fe71bcd
Python
22,450
625
#!/usr/bin/env python3 ############################################################################ # Copyright (c) 2025-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ """ Barcode calling quality assessment ...
2fcd2076338511af24d2b55b31dffd6072734184efa5334f57e6a2ab4cd4980b
Python
22,456
625
#!/usr/bin/env python3 ############################################################################ # Copyright (c) 2025-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ """ Barcode calling quality assessment ...
776572f713d6eef4bebc050437e6019387aa667853baade0ddb117e2ab31c188
Python
22,457
570
""" This code is taken from kalmax.kde (https://github.com/TomGeorge1234/KalMax/blob/main/kalmax/kde.py) and modified by masahiro Nakano """ from typing import Callable import jax import jax.numpy as jnp from jax import vmap, jit from kalmax.utils import gaussian_pdf from kalmax.kernels import gaussian_kernel from f...
95c056a92d672516850ae2e4cd3fc9add8a3f979843a4c1c5b89cf40e934fd30
Python
22,497
576
# Copyright (c) Facebook, Inc. and its affiliates. import math from typing import Dict import torch import torch.nn.functional as F from detectron2.layers import ShapeSpec, cat from detectron2.layers.roi_align_rotated import ROIAlignRotated from detectron2.modeling import poolers from detectron2.modeling.proposal_gen...
b5e10bda04c6a4adc501307d4ee89fc6f3c762148e9f42ef68bdabd2b0e8520d
Python
22,505
650
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Cox Cure Rate Model Training This script trains a Cox proportional hazards model with cure fraction (cure rate model). The model assumes that a portion of the population will never experience the event (cured), while the remaining population follows a Cox proportional...
0aed6248fece3909d1a80728e7b6fea28c67c054d086a2b3036db451f1cbfb53
Python
22,521
455
from copy import deepcopy from typing import Literal, Tuple, Union, List import torch from batchgenerators.utilities.file_and_folder_operations import isfile from dynamic_network_architectures.architectures.abstract_arch import AbstractDynamicNetworkArchitectures from torch._dynamo import OptimizedModule from nnunetv2...
67859afe90fa340592e6921d1e190f41bb1da87630a2f8e05126c9a3588e210f
Python
22,581
440
import os import numpy as np import pandas as pd import umap import matplotlib.pyplot as plt import anndata as ad import scanpy as sc import scvelo as scv import multivelo as mv from scvelo.preprocessing.moments import get_moments # load anndata dir_path = "/home/nomura/Proj/mmvelo/experiments/multiome_brain_rep_wo_IN...
aedd8170ebfd72a54de9fd0432c19546a5024607584dd9fd31171dcbc2b1fe98
Python
22,618
478
import numpy as np import pandas as pd import mrcfile from skimage.morphology import skeletonize_3d, medial_axis, remove_small_objects from skimage.color import label2rgb from scipy.ndimage import morphology, label, binary_erosion, convolve from scipy.spatial import distance from scipy.interpolate import splprep, splev...
8520fd77e5d2c1f69985e3f02483f131dc225e1d4c1d43317ccb45006a7dfcec
Python
22,653
482
"""Stage 4: compute dN/dS from the annotated final table. Reads ``snv_table_final.tsv`` + the reference from the group dir; writes ``dNdS_out/data_dNdS.npz``, the same numbers as ``dnds_genomewide.tsv``, and the per-gene breakdown ``dnds_per_gene.tsv`` to the analysis dir. Includes the mutation-spectrum / expected-vs-...
3d7b98a567f83fe93763d49298f70b9d9a538ef3382b35b7c48409b10b1f17da
Python
22,697
639
"""Behavioural contracts for the graph primitives fastcore implements. These were differential tests: every function was run with and without navis-fastcore and the two answers compared. Both fallbacks and oracle are gone (fastcore is a hard requirement now) - and the oracle was the weaker one anyway, since two implem...
1ccad474820ab9238281b8284ecda478cb2a4856b7c877dbc17a0b590ee0c81a
Python
22,698
550
from matplotlib.gridspec import GridSpec from matplotlib.widgets import CheckButtons from sklearn.neural_network import MLPClassifier from xgboost import XGBClassifier import batch_process.util.template_util as template_util import batch_process.util.curate_util as curate_util from spikeinterface import full as s...
c96caf6378efa5f5c3992d9037d87b1187cebf0ac9929efe44b74442bd90bcc4
Python
22,712
552
#!/usr/bin/env python # # Copyright (c) 2023 10X Genomics, Inc. All rights reserved. # """Code to produce isotype control plots for the websummary.""" from __future__ import annotations from collections import OrderedDict from typing import TYPE_CHECKING import altair as alt import numpy as np import pandas as pd fro...
608314fd9a203af9133f2830794d7609660371bbcbd3b78cec57e486db5ec1ff
Python
22,737
561
#!/usr/bin/env python3 """Consistency checks for timestamped output folders and a one-image pipeline smoke test.""" from __future__ import annotations import json import os import sys import tempfile import unittest import zipfile from datetime import datetime from io import BytesIO ROOT = os.path.abspath(os.path.jo...
34ade6b68670c0585d2102c43726a874b7016a8c01ae699e34eacf444057d435
Python
22,839
588
"""Code taken from Azimuth panhuman. Azimuth Cell Annotation: Neural network-based hierarchical cell type annotation for single-cell RNA-seq data. This module provides tools for hierarchical cell type annotation and interpretation based on single-cell RNA-seq data using the Azimuth neural network model trained on ann...
0b4dfb97f7ae5ad697f11aa68f93df918179a835f389e2a0edac8b9ffe6436ad
Python
22,963
549
#!/usr/bin/env python # Copyright 2016-2026 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...
b6b638614e661cfff6d637ac2a06a223469990a4f2e138c5d22070d3d853646b
Python
22,996
549
#!/usr/bin/env python3 import os, re, glob, argparse from dataclasses import dataclass from typing import List, Tuple, Dict, Optional import numpy as np import pandas as pd from tqdm import tqdm import matplotlib.pyplot as plt import freesasa from Bio.PDB import PDBParser, Selection MAX_ASA_TIEN = { "ALA": 129.0...
f6b8ad45e226787b1cfb5d90c5730d0c1ae38036266b04626fa9e35143695675
Python
23,032
589
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 def scv_analysis(adata, figure_folder=None, recompute_velocity=True): if recompute_velocity: selected_genes_mask = adata.var['selected_genes'] a...
c11c331e52deb8aa2e3f1759a5a99cae8e9df451ba9fde8ff7ec9c88dce69efd
Python
23,077
528
import os import numpy as np import pandas as pd import umap import matplotlib.pyplot as plt import anndata as ad import scanpy as sc import scvelo as scv import cellrank as cr import scanpy.external as sce from scipy.io import mmwrite, mmread import statsmodels.api as sm np.random.seed(42) # peak-gene linkage matrix...
e0b11941b53a21e72dfadf4a38dfa043184e48f543179880b22f5f05c828b619
Python
23,147
611
"""Tests for the mesh operations that are not rebuilds - `fix_mesh`, `smooth_mesh` and `points_to_mesh`. For `fix_mesh` there are two things worth pinning. One is the trimesh-version gate: `Trimesh.remove_duplicate_faces`/`.remove_degenerate_faces` were replaced by `.unique_faces()`/`.nondegenerate_faces()` in trimesh...
67f3060582058017f1e3b44d996f86819cfdcb65fcb6bcab8649bfbf4d753727
Python
23,152
644
import logging from os import PathLike from typing import Literal, Mapping, Sequence import numpy as np import pandas as pd from torch import nn from chemprop.data.datapoints import ( LazyMoleculeDatapoint, LazyReactionDatapoint, MolAtomBondDatapoint, MoleculeDatapoint, ReactionDatapoint, ) from c...
8203b03eaa57d66817aac85ee2d84060f528f9ddf7973bfc94984a0e06406641
Python
23,166
662
""" If you use this code, please cite one of the SynthSeg papers: https://github.com/BBillot/SynthSeg/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 Lice...
5a7a57f11f2eb67bf7a7fb686818029b3e20c48b267ee144cb6b54aa8a1f9fc5
Python
23,173
688
####### DISCLAIMER ############ # All the code below was adapted from https://github.com/Pella86/DenoiseAverage # It contains helper functions for handling images, computing their Fourier transforms, # and applying masks to them to implement the low-, high-, and band-pass filters. # -*- coding: utf-8 -*- """ Created ...
5fb573adf4a93a7aa3b4278581e5404e5357de4b7a7e0b0a320ee8867b13a048
Python
23,177
620
import os import copy import torch import random import logging import numpy as np import torch.nn as nn from scipy import stats from torch.utils.data import Dataset, DataLoader from importlib.resources import files from accusnv.downstream import snv log = logging.getLogger('accusnv') def setup_seed(seed): torch....
843c7faee5913e82b78c218ed5aecc5a96f766bfcb974f9b6b49d57b1bcb4142
Python
23,209
735
# %% from __future__ import annotations import numpy as np from joblib import delayed from joblib import Parallel from numpy.typing import NDArray from scipy.stats import kendalltau from scipy.stats import spearmanr from tqdm_joblib import tqdm_joblib # %% class RSA: """Perform RSA between RDMs. Parameters ...
51a5a996e8d347ad58657ccc3fbeff749ed205196eb615243ce5427cb3e7733a
Python
23,261
613
"""Tests for the element-axis schema (`navis.core.schema`). Two kinds of test live here: - `test_schema_is_complete` guards the schema itself. Missing a field in an `AXES` declaration means that field silently survives a subset unfiltered, so the schema being complete is a property worth checking mechanically rat...
28e4fd6bc2b34689b5f074c1461e27ac777d60772bf2f7cd7949547e34db7f4e
Python
23,263
638
import argparse, os, sys, datetime, glob, importlib from omegaconf import OmegaConf import numpy as np from PIL import Image import torch import torchvision from torch.utils.data import random_split, DataLoader, Dataset import pytorch_lightning as pl from pytorch_lightning import seed_everything from pytorch_lightning....
79576cdad97b04c1f712eb8342b53d76880aea1c5e17eddb500307d2f42ec4b9
Python
23,330
662
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. """ Common data processing utilities that are used in a typical object detection data pipeline. """ import logging import numpy as np from typing import List, Union import pycocotools.mask as mask_util import torch from PIL import Image from d...
ac5a1d228cd1bcd24b2005100de2b2e0cd6b3fa4a3421d1131351b83037f40d3
Python
23,348
762
from pathlib import Path import matplotlib.pyplot as plt import matplotlib import numpy as np import pandas as pd import seaborn as sns import matplotlib.patches as mpatches from scipy.stats import mannwhitneyu, pearsonr from sklearn.metrics import roc_curve, r2_score, mean_squared_error, roc_auc_score, auc, \ pre...
7fe45dbd4837411d301479b11f251287c6aa957a689d6016efc6aec0c7f3e784
Python
23,375
640
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import math import pandas as pd from sklearn.model_selection import train_test_split from PIL import Image import tqdm import cv2 import os #tf.enable_eager_execution() #eager execution """ 设置使用GPU """ gpus = tf.config.experiment...
bc63b21a340a33a3555525d3caa489aa1211e7cd01414abd0d9781ce7e388198
Python
23,401
520
import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt import anndata as ad import scanpy as sc import scvelo as scv 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_...
8eb1a33a961ff0ad31f7232c9aa60ba486b1bdc59d53aa500df932983e60a551
Python
23,412
567
""" IVSCC morphometrics on EM data ============================== <!-- difficulty: advanced --> Turn MICrONS reconstructions into something [`navis.ivscc_features`][] can measure. !!! important "This example is not executed" Like the [IVSCC tutorial](zzz_tutorial_morpho_05_ivscc), this one is *not* run when the d...
8b236f376117591a3408c1b9e28513327ff2285a747f8df535c31cce380a7d99
Python
23,449
595
# uv add xlrd openpyxl # uv run pepIntSum.py # # REPL-friendly MaxLFQ trace script. # # Purpose: # Trace every step from an exported MaxQuant peptide table to reconstructed LFQ, # then compare against proteinGroups.txt. # # Designed for your small last example: # peptides opy.txt # proteinGroups - Copy.txt # #...
8ffcabd3ce772bebf429589210c1ba6c61a7f6feaae89b9b00994836d9a29042
Python
23,461
589
#!/usr/bin/env python3 """ normalize_intensity - Percentile-based Intensity Normalization for MRI Data Part of the micaflow processing pipeline for neuroimaging data. This module performs intensity normalization on MRI data using percentile-based clamping and rescaling. Intensity normalization is crucial for improvin...
d4a8cfe1793a9079ac33a41b9836c18ac4c54d42d3533a8c442822f09ee751c0
Python
23,509
546
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2020-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. ############################################################################ ...
4d45bc4b3928244de76e24acaf937f097ef0e313dc883b557036fc0e9ac3e5ff
Python
23,513
572
# Copyright (c) Facebook, Inc. and its affiliates. import numpy as np from typing import Callable, Dict, List, Union import fvcore.nn.weight_init as weight_init import torch from torch import nn from torch.nn import functional as F from detectron2.config import configurable from detectron2.data import MetadataCatalog ...
e31c7396299b707f259827966636c373ea3499c03509f81e64a2c3616452938e
Python
23,540
607
#!/usr/bin/env python3 """ Batch experiment orchestrator for Bielschowsky axon segmentation. Reads axon_inference_instructions.csv and processes every block in three phases: Phase 1 – Inference Runs inference_wsi.run_axon_infer() on each block's Data/CLAHE-Enhanced/wsi_clahe_enhanced.npy → writes Data/A...
52a47ca717ff7cf84fd3dc6a180eaa2d693676ed611b81af63c01033ab1c1a67
Python
23,575
643
""" This function trains a regressor network to predict Dice scores between segmentations (typically obtained with an automated algorithm), and their ground truth (to which wwe typically do not have access at test time). If you use this code, please cite one of the SynthSeg papers: https://github.com/BBillot/SynthSeg...
fbfd29019000f9f81c72c297f3366e600183bc557c24e8799626d5774f4591ca
Python
23,612
701
#!/usr/bin/env python # Copyright 2016-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...
d0b42e0da1964aeb4a3d6c05a2ecdf2c96ca5c2472110601b51fcc8ff38e26b9
Python
23,631
556
# Copyright (c) Facebook, Inc. and its affiliates. import contextlib import datetime import io import json import logging import numpy as np import os import shutil import pycocotools.mask as mask_util from fvcore.common.timer import Timer from iopath.common.file_io import file_lock from PIL import Image from detectro...
276cd5d4ece258652e28930f423cb638c3e12cbb59acfdb2bd1718ea6247420c
Python
23,654
561
from __future__ import annotations from dataclasses import dataclass import numpy as np from bpnn_batch import evaluate_candidate_matrix from bpnn_training import BPNNTrainingConfig, SingleHiddenBPNN, flatten_model_parameters @dataclass(frozen=True) class GAGPUConfig: population_size: int = 30 generations:...
999f3471e04f9edce81c586cf58f5bebe3a99447a8f9ddb4d3a5236ead71af7b
Python
23,656
694
# Copyright (c) Facebook, Inc. and its affiliates. import numpy as np import fvcore.nn.weight_init as weight_init import torch import torch.nn.functional as F from torch import nn from detectron2.layers import ( CNNBlockBase, Conv2d, DeformConv, ModulatedDeformConv, ShapeSpec, get_norm, ) from...
c7ca538141f52f5affd5ea411b5b09bb0ed8444429672a45c36998a88339c920
Python
23,667
584
"""Dr.VOT backend for stop-VOT measurement. Replaces TAPA's Praat-based ``measure_vot`` with the deep-learning Dr.VOT model (MLSpeech/Dr.VOT, Shrem et al. 2019) while keeping TAPA's per-token output schema so downstream averaging/CSV/JSON code is unchanged. Workflow per recording: 1. For every stop token TAPA's se...
8de4c56beaa85240a799d8dbc3739a5ac0f2cb5a42d5da1183d00a888a844f9b
Python
23,684
630
############################################################################ # Copyright (c) 2025-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ """ Tests for molecule structure parsing and element types. T...
51100d1b866a2db2e11ef8fc5dbf9ab5abd81577d4e88b243171925d790fa921
Python
23,698
631
"""Streamlit-free per-image NMJ analysis and NMJ_Plot PNG rendering (shared by batch UI and CLI regen).""" from __future__ import annotations import gc import os from dataclasses import dataclass from typing import Any import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from ...
9893740ee23b472fbc43d1cfb06744ede723e21316acee9b5fde5bc06f82d89b
Python
23,736
685
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Classes for applying restraints to OpenMM Systems. Acknowledgements ---------------- Many of the classes here are at least in part inspired from `Yank <https://github.com/choderalab/yank...
7ea98f9b46f8e9d18bae85010baacad57c3308e37c6f8fadc50a854835ae7aca
Python
23,740
581
''' (c) 2014 Brendan Bulik-Sullivan and Hilary Finucane This module deals with getting all the data needed for LD Score regression from files into memory and checking that the input makes sense. There is no math here. LD Score regression is implemented in the regressions module. ''' from __future__ import division imp...
fa2c32b0cb305a9f4738b4b0e2a8c9d2e62afc32d0e4a45ff41db76caa3ebeca
Python
23,776
477
""" SlotDeconv: Spatial Transcriptomics Deconvolution via Slot-based Reference Learning """ import os import warnings import numpy as np import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from scipy.spatial.distance import cdist from scipy.optimize import ...
21437d93fad02ba0eef236c1a297c62af37adcc96183d3bd1c968ae55567ba7c
Python
23,814
533
# Copyright (c) Facebook, Inc. and its affiliates. from typing import Dict, List, Optional, Tuple, Union import torch import torch.nn.functional as F from torch import nn from detectron2.config import configurable from detectron2.layers import Conv2d, ShapeSpec, cat from detectron2.structures import Boxes, ImageList, ...
c2edb4f4842fa6fe74c7b35c869b51b4d1210c3a5ba364a3098e7b769f3524ee
Python
23,870
645
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import math import pandas as pd from sklearn.model_selection import train_test_split from PIL import Image import tqdm import cv2 import os #tf.enable_eager_execution() #eager execution """ 设置使用GPU """ gpus = tf.config.experiment...
95b4485cca38da4afafdf30ffab54398d7a36011cca4f4d62a35445f874d9392
Python
23,887
1,017
"""This tests the CLI functionality of training and predicting a regression model on a single molecule. """ import json import sys import pytest import torch from chemprop.cli.hpopt import NO_HYPEROPT, NO_OPTUNA, NO_RAY from chemprop.cli.main import main from chemprop.cli.train import FoundationModels, TrainSubcomma...
7ef72ae90708ecbe18c1a2522a660fa8f6299ba1e7d1735992fa1954144213c2
Python
23,915
661
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import math import pandas as pd from sklearn.model_selection import train_test_split from PIL import Image import tqdm import cv2 import os #tf.enable_eager_execution() #eager execution """ 设置使用GPU """ gpus = tf.config.experiment...
ed19a2f7bd0db2f686e5a484df78aa1146d6e65ab4af00714301b9be1501c895
Python
23,930
639
import pytest from isoquant_lib.fusion.fusion_metadata import FusionMetadata class FakeDetector: """Mock detector for testing FusionMetadata.""" def __init__(self): self.fusion_candidates = {} self.fusion_breakpoints = {} self.fusion_metadata = {} self.fusion_assigned_pairs = ...
fdfda3c1b404789cfd4cbdba2fe41d59ba16e0e3d5cf5cbc1baabd2fe245464d
Python
23,933
556
import sys import numpy as np import torch from torch import nn import torch.nn.functional as F import torch.distributions as dist from torch.nn.parameter import Parameter from torch.nn import init import pytorch_lightning as pl from pytorch_lightning.callbacks.early_stopping import EarlyStopping sys.path.append("./sr...
8deece92f4d3b2e026e17e4555028eee970c309902dca9d438aa4426b159f16c
Python
23,970
738
# 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...
cff4bf81352e19ab5bf96aff72859eaffb20536a9487383eb6691d80218f90fc
Python
24,312
655
import torch import torch.nn as nn import torch.nn.functional as F import math from torch.autograd import Variable from utils import my_softmax, get_offdiag_indices, gumbel_softmax _EPS = 1e-10 class MLP(nn.Module): """Two-layer fully-connected ELU net with batch norm.""" def __init__(self, n_in, n_hid, n_...
a0e90a624223cf5dfde1f09588c5a7ea560a2cec6a106948c8253ebded924d3a
Python
24,321
692
from abc import abstractmethod from typing import Literal import numpy as np from numpy.typing import ArrayLike import torch from torch import Tensor from torch.nn import functional as F import torchmetrics from torchmetrics.utilities.compute import auc from torchmetrics.utilities.data import dim_zero_cat from chempr...
33b0030cff7e34b84d1858dd6cd7aaa376df7589c2bdd3b166c78a82ef4619d4
Python
24,323
508
import os import numpy as np import pandas as pd import matplotlib 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 from arboreto.algo import grnboost2 import pickle import collections import pycistarget import pyranges as p...
f37a76e11aa206fd68c2eff0883e71002f4734cd6f33ea245ddcbc0d3539b38a
Python
24,338
712
# SPDX-License-Identifier: MIT """ Spatial plotting utilities for long-read spatial transcriptomics data. This module provides functions to visualize spatial transcriptomics data as hexbin overlays, read tree-traversal isoform results, and generate heatmap tiles with accompanying bar plots. """ import os import numpy ...
3ef2302edb73fda9e462066224caa61569bd3ec09aeaa41ff38c66fe877393eb
Python
24,411
591
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from torch import einsum from einops import rearrange class VectorQuantizer(nn.Module): """ see https://github.com/MishaLaskin/vqvae/blob/d761a999e2267766400dc646d82d3ac3657771d4/models/quantizer.py _____________________...
a2bb834d8a772ea47fab4281ddc83444d80d194ee84be53ee4ef6e689829695e
Python
24,441
492
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://w...
35115c2d77e420045fa2d6ba2702a3e3b9c9541322442bb4fb875bc4ea11ba71
Python
24,461
574
import sys import numpy as np import torch from torch import nn import torch.nn.functional as F import torch.distributions as dist from torch.nn.parameter import Parameter from torch.nn import init import pytorch_lightning as pl from pytorch_lightning.callbacks.early_stopping import EarlyStopping sys.path.append("mmVe...
01e551bcb642e5b0eb70524dfe855100aa701b8fb8d5c50361ffc2f7b4de7737
Python
24,469
512
from copy import deepcopy import os import shutil from typing import Literal, get_args import torch import numpy as np # from numpy.core.multiarray from nnunetv2.preprocessing.preprocessors.default_preprocessor import DefaultPreprocessor from nnunetv2.utilities.plans_handling.plans_handler import ConfigurationManager...
22ae2176de59af506fefb5981eb8474ef251826d56ea7c529a48c9f5626536c8
Python
24,495
683
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
58d60e0cb4a4397f719dd8646c190b19de910a751a4509ec21a56e60eaeeada3
Python
24,533
602
#!/usr/bin/env python # Copyright 2020 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 obtain a...
b5ec79011647a519ce1e9c2d0b9f218955b3a1709538f518fdc9a9e3697deea3
Python
24,576
557
import os import re import scipy.io as sio import numpy as np from spikeinterface import full as si, extractors as se import datetime from pathlib import Path from util.impedance_analyzer import ImpedanceAnalyzer import pandas as pd # Lazy import: psignifit only needed for threshold calculation # import psign...
072085b2d5a9d942d90a8ae43e169f5be192480ad655002ffe7c10027afd970d
Python
24,699
723
# SPDX-License-Identifier: MIT """ Utilities for annotating reads in an allinfo file with cell types and constructing sparse isoform matrices. This module provides functions to: - Label reads with celltype-region labels from segmentation data - Generate auxiliary CSV outputs for scisorseqr (isoform IDs, counts per cl...
ad910c2d6866861bcbbc471d2fb04ee8ca7b0ddff69b4d84cbc48ea544eef304
Python
24,776
517
import os import numpy as np import pandas as pd import matplotlib 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 from arboreto.algo import grnboost2 import pickle import collections import pycistarget import pyranges as p...
eb1c66bd3314473f8b906a9dd394caea496cee9dd7c4883d78710b52677ccc38
Python
24,826
614
#!/usr/bin/env python3 # # Copyright (c) 2015 10X Genomics, Inc. All rights reserved. # from __future__ import annotations import collections import glob import os import re import shutil import subprocess import xml.etree.ElementTree as etree from collections.abc import Iterable from enum import Enum, auto, unique f...
a966b06d75684b66b9b584d2bba3ca2372f6d099ab8cbfd84efd42ce120f67d3
Python
24,837
633
""" Surface plotting functions. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause import os import warnings from itertools import product as iter_prod import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import Colormap from .base import Plotter from .colormaps ...
84dc15e740e27cd50c79a7fb004476db96db0842d557a8f2add6acfcb4182896
Python
24,859
467
import argparse import inspect import itertools import multiprocessing import numpy as np from os.path import join from pathlib import Path from time import time from typing import Union, List, Tuple import warnings import torch from torch._dynamo import OptimizedModule from tqdm import tqdm import openvino as ov impo...
30b804b7c1e7ac67dec5c678d33508c0119547bbbfea2e12fbfa81c9a7e77d65
Python
24,965
522
''' Created on Nov 11, 2024 @author: voodoocode ''' import numpy as np import scipy.signal import functools import finnpy.file_io.data_manager as dm import matplotlib matplotlib.use("Qtagg") import matplotlib.pyplot as plt import copy TIMER_DELAY = 200 import pandas import PyQt6.QtWidgets import pyqtgraph import o...
d53584e63fe3c883314f82547380f1df7234239b06dbd0249d9518ec2465c362
Python
24,968
1,168
# -*- coding: utf-8 -*- """ PSTN 评估脚本:指标计算与可视化 输入文件: A_raw_{t}h.npy scRNA-seq raw counts,形状为 cells × genes B_{t}h.npy ST 表达矩阵,已经经过: normalize_total(1e4) + log1p 形状为 spots × genes mapping_matrix_{t}h.pt 映射矩阵,预期形状为 cells × spots 预测流程: pred_raw =...
20c59a2f524380551ccff52313e72429fbda11aed90bd7efa56955f669c764b6
Python
25,014
742
""" Molecular property prediction using single models and ensembles. Core inference functions for predicting any scalar molecular property from SMILES strings: phase classification, transition temperatures, melting points, birefringence, dielectric anisotropy, etc. Supports single-model and ensemble prediction for bo...
3cf0f31b721abb20dcf0f637d6c32778f32b682b3a06f3d6efec65bf45b4e8dd
Python
25,019
384
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import pylab import re import os import glob import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from mpl_toolkits.axes_grid1.inset_locator import inset_axes from optparse import OptionParser FOLDERNAME_GENERATE = "learning_generation"...
90f821c0a01c291d7871cb7c142ee0913b0ffb1c2b4bd57b75c46646a456f7f7
Python
25,020
481
''' Created on Oct 6, 2025 @author: voodoocode ''' import scipy.io import numpy as np import warnings import os import pyexcel import pyvista import finnpy.visualization.volumetric as vol import finnpy.visualization.atlas_nifti_to_obj import finnpy.file_io.data_manager as dm import h5py MNI_NATIVE_ERR_THRESH = 0.01...
7a42415430d89a74f4c1dbfdb44df0a8aa3d0859a839e148038aa2c206344191
Python
25,037
530
# 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...
93ce7e03e2432eb788453ab931644bef8a38229f6ccaaa28e3edc2b03dfb36b9
Python
25,079
683
from copy import deepcopy import logging from pathlib import Path import shutil import sys from configargparse import ArgumentParser, Namespace from lightning import pytorch as pl from lightning.pytorch.callbacks import EarlyStopping import numpy as np import torch from chemprop.cli.common import add_common_args, pro...
791b44effa2cdf5491b5c755c79d6dd2a31038d44997955b61b20fec57a7bfc6
Python
25,124
747
#!/usr/bin/python3 # # Copyright (c) 2024 10X Genomics, Inc. All rights reserved. # """Python Client to run cloud cell annotation.""" import base64 import functools import hashlib import logging import os import random import string import textwrap import time from collections import defaultdict from dataclasses impo...
2e40e089722e3b442966390210a73c3a0aee7992804f49b459b8cc0c88b1509c
Python
25,186
526
""" opNMF implemented in python Current implementation has following options: opNMF (regular version with XX^T stored in memory) opNMF (mem version with reduced memory footprint but longer runtime) qr-opNMF svd-opNMF tsvd-opNMF """ import sys #check python version, exit upon sanity check failures...
57e940e89a21ddba9f1e0c12ddd34c0c0811320f594eb7cf2910d1d7b049a955
Python
25,198
730
# -*- coding: utf-8 -*- """ # -------------------------------------------- # Super-Resolution # -------------------------------------------- # # Kai Zhang (cskaizhang@gmail.com) # https://github.com/cszn # From 2019/03--2021/08 # -------------------------------------------- """ import numpy as np import cv2 import tor...
c87122fc2990c9b87a50cfbbd3bad327542044eb3d379fafc3084a9233257a50
Python
25,202
695
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Implementation of Swin models from :paper:`swin`. This code is adapted from https://github.com/SwinTransformer/Swin-Transformer-Object-Detection/blob/master/mmdet/models/backbones/swin_transformer.py with minimal modifications. # noqa --------...
1e7e586c7f45d5045792622caee77227866bf7483a3db54f49155f713b7ca21e
Python
25,251
691
"""DataRecorder for the DataRegistry Architecture. This module orchestrates data collection from Mesa's DataRegistry, managing storage and conversion to analysis-ready formats. Architecture: DataRegistry → DataRecorder → Analysis - DataRegistry: Pure extraction (what to collect) - DataRecorders: Storage ...
3fbb4448ae7c0f82af8c7ec9d72331c1f93b3d30ed7b3c30257349252f4a1dcc
Python
25,290
616
""" compute_fa_md - Diffusion Tensor Imaging Metrics Calculator Part of the micaflow processing pipeline for neuroimaging data. This module computes diffusion tensor imaging (DTI) scalar metrics, specifically Fractional Anisotropy (FA) and Mean Diffusivity (MD), from preprocessed diffusion-weighted images (D...
a0551c03a03cc8e5e8093a8f6394f91ede9a051a36b8e974bcc5a8081d47a355
Python
25,310
740
import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np import pandas as pd import seaborn as sns import statsmodels.formula.api as smf import matplotlib.patches as mpatches from matplotlib.colors import TwoSlopeNorm from matplotlib.ticker import FuncFormatter from statsmodels.stats.mu...
ebad560f8adcacea671433ed558dfd80200d3179143fd6c75d1512821fe4d9ff
Python
25,390
569
# Copyright (c) Facebook, Inc. and its affiliates. import logging from typing import Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from torch.nn import functional as F from detectron2.config import configurable from detectron2.data.detection_utils import get_fed_loss_cls_weights from d...
07a371ba0ee097fc95ffa7e047a7ff3b89efa610bd3ab6763acbde81e591f5a2
Python
25,473
686
# 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...
7e54b329e2a11108d5603bffff904d2f24c1d7da68abb697ea5b269e1e25ef3e
Python
25,489
630
import os from PIL import Image import numpy as np import glob import cv2 import shutil from scipy.stats import mode #from EB_get_segmentation_mask import gaussian_kernel, visualize_segmentation from itertools import combinations from EB_transformers_util import get_class_value_map from collections import defaultdic...
e96e25d7bf8285016c36575575f4a0fe0eb99c8b3b30f4669fb691510955f0fc
Python
25,504
635
import ratinabox from ratinabox.Neurons import PlaceCells from ratinabox.Agent import Agent from ratinabox.Environment import Environment import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm from pathlib import Path import sys from matplotlib import colors import matplotlib import copy # root_dir ...
414bd95026b486a482f8426a2f385b56c2f1bed7390329bb7780cddf0ff0d52a
Python
25,505
690
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. import datetime import itertools import logging import math import operator import os import tempfile import time import warnings from collections import Counter import torch from fvcore.common.checkpoint import Checkpointer from fvcore.common....
7ef8908fa4464a9fee6124ad8384244990187f1d49bbda9d75365c648ec65d3c
Python
25,511
734
#!/usr/bin/env python3 """ Synthetic Volume Generator for MorphoScope ========================================== Generates synthetic 3D volumes with known geometries to: 1. Validate the spread quantification algorithm 2. Help biologists understand what spread measures 3. Demonstrate how different variables affect spre...