sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
a1031581194e519218d1c2f1c0eb2ffc70856d1cf2b6f05bf05ee57ca1bebd71
Python
3,595
98
""" Create an organ mesh template from all segementation masks in the training set. """ __author__ = "Fabi Bongratz" __email__ = "fabi.bongratz@gmail.com" import os import nibabel as nib import numpy as np import trimesh from tqdm import tqdm from scipy import ndimage from skimage import measure DATA_PATH = "/path/...
ceeb8bc2447e8e76537f09312680e9c434af7f5b6ec046fbfa0a1688845834a2
Python
3,600
119
# 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...
2d8846290dfff34c7bcf376b8c775f1ca957bff39479d78762e80925ee6ad64a
Python
3,601
100
from __future__ import annotations import argparse import json from pathlib import Path import numpy as np import pandas as pd def _weighted_mean(values: np.ndarray, weights: np.ndarray) -> float: return float(np.average(values, weights=weights)) def _pv_brr_mean_and_standard_error( plausible_values: np.n...
b5dc38af7a7d748d77948a6d916944c7778fec072d5b21699a9404f85e45c999
Python
3,603
112
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np def plot_dsc(dend,name, corr=0): d=dend corrected=corr #use uncorrected to check against data df=d['data'] peaks=d['peaks'] fig, ax1 = plt.subplots() if corrected==1: ax1.p...
fe5b3534e0272c6cb3087e37083c75520e13bd6add2efd392a599b688094fa6b
Python
3,603
74
#!/usr/bin/env python # Copyright 2017-2014 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...
31cbc3445339a7a4e33c56d601f4c5f1e8774a37c1639f46bb4d23a2b07e4fe0
Python
3,609
133
# Copyright 2019 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn # # 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-...
d173c34795f0e492b3232f2f2c8ed7b0ab99c22411a3a5ae79389a680ba232ff
Python
3,609
109
# @File(label="Input directory", style="directory") src_dir # @File(label="Output directory",style="directory") out_dir # @String(label="Process filenames containing",description="Clear for no filtering",value=".tif") filenameFilter """ Process_Folder_PY.py IJ BAR https://github.com/tferr/Scripts This python sc...
61cbb8074d5ecc2cb1d5bfe16b02451649d52bf2f4f1b70c39108a2837b76c31
Python
3,612
96
#!/usr/bin/env python3 # # Copyright (c) 2023 10X Genomics, Inc. All rights reserved. # """Cell Typing utility functions.""" import json import os import pathlib import cellranger.matrix as cr_matrix from cellranger.rna.library import GENE_EXPRESSION_LIBRARY_TYPE ALLOWED_GENOMES = ["GRCh38", "hg19", "mm10", "GRCm39"]...
50c3ee11302eb8b16b93e86ce25332dc22d8eafbe86e3faeabde0476978ae576
Python
3,614
122
""" Insect Brain DB =============== <!-- difficulty: beginner --> Fetch neurons and brain meshes from the Insect Brain Database. The insect brain database (<https://insectbraindb.org>) is an online repository for neuron morphologies, brain regions and experimental data across various insect species. At the time of wr...
f9d02e72386a34901b5e8397fefc3387f132c68cadceaf439083f65fc8cccaa7
Python
3,623
93
import numpy as np import pandas as pd from matplotlib import pyplot as plt import seaborn as sns df = pd.read_csv('motion.csv') MOTION_COLS = ['Trans_X', 'Trans_Y', 'Trans_Z', 'Rot_Pitch', 'Rot_Yaw', 'Rot_Roll'] def subtract_first_volume(group): """Subtract the first volume's parameters from all volumes in a bl...
9eea44308a7871983bb0f5927ad72168be06d15294f5762cccc8127312b2076e
Python
3,624
110
#!/usr/bin/env python # # Copyright (c) 2017 10X Genomics, Inc. All rights reserved. # import json import os import os.path import subprocess import tempfile import martian import tenkit.log_subprocess as tk_subproc __MRO__ = """ stage VLOUPE_PREPROCESS( in string pipestance_type, in string samp...
a1746ba5abe4154bcae5b444acdec91222ac55bfff709a3bb2aa67c5a509f684
Python
3,624
111
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ The MCS class from Perses shamelessly wrapped and used here to match our API. """ from gufe.settings.typing import AngstromQuantity from openff.units import Quantity, unit from openff....
0cdf0cf34fed2dbbce15261074f07a9153231cb793e0afde379030760e833e24
Python
3,633
99
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. import argparse import os from itertools import chain import cv2 import tqdm from detectron2.config import get_cfg from detectron2.data import DatasetCatalog, MetadataCatalog, build_detection_train_loader from detectron2.data import detection_uti...
e4927e85665fdc59d3e7c0d19f0112c37ef3f6225d23d3bf861617a02ad73038
Python
3,634
106
"""Tests for `navis.graph.graph_utils.propagate_labels`. These pin down the *return type* of `propagate_labels`, which used to be inferred by pandas/numpy and therefore varied with the installed pandas version: `Series.map()` on string labels yields an `ArrowStringArray` under pandas >= 3 (where `future.infer_string` ...
136e4d7d6b3678c735ef91e97faa65539641bfc11f11aa19eb8b624cc596c52c
Python
3,638
112
import numpy as np def violin_prune_outliers(ax, data_list, positions=None, widths=0.7, violin_kwargs=None, whisker_kwargs=None, outlier_kwargs=None, median_kwargs=None, ...
5dde301fa02e040e5b46c5f3c0ef9d98b0b3901ddf86055f0703b5e170f136f3
Python
3,638
111
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import numpy as np import pytest from openff.units import unit from openfe.protocols.openmm_rfe import equil_rfe_settings # afe settings currently have no FloatQuantity values from openfe....
7083c9d2f18b669a00f598859af61cf705a80d0ec353d8214874ebb3cf948a6e
Python
3,647
94
# Copyright (c) Facebook, Inc. and its affiliates. import logging import unittest import torch from detectron2.modeling.box_regression import ( Box2BoxTransform, Box2BoxTransformLinear, Box2BoxTransformRotated, ) from detectron2.utils.testing import random_boxes logger = logging.getLogger(__name__) clas...
a3d5412d17c56f2047deffbc1bbc906fa73eea5511ec9e262a86c160fc8a2fe5
Python
3,649
104
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pytest from gufe import SmallMoleculeComponent from rdkit import Chem from rdkit.Chem import AllChem import openfe from openfe.setup.atom_mapping import LomapAtomMapper from .conftes...
708bf9d9eb04bf88642bb2a31345cc6d1a6f438b2c1b3c0dd92835eee2beb2a5
Python
3,650
103
#%% from os import listdir from os.path import join import arviz as az import pandas as pd import mne import matplotlib.pyplot as plt import seaborn as sns import numpy as np from natsort import natsorted import sys sys.path.append('/mnt/obob/staff/fschmidt/cardiac_1_f') from utils.plot_utils import plot_corr_topo ...
824a58a11c37b34e578982e9358928be6da3635366a7d9f2f3384d91ecbd7b17
Python
3,651
105
#!/usr/bin/env python # # Copyright (c) 2017 10X Genomics, Inc. All rights reserved. # from __future__ import annotations import json import shutil import h5py as h5 import martian from six import ensure_binary import cellranger.analysis.io as analysis_io import cellranger.h5_constants as h5_constants import cellra...
1358845682558fff18c4a68cdfc3ebb13b5bdfe6cebd715dc39493d68f7f83e6
Python
3,654
134
""" Test datasest """ import pytest import numpy as np from brainspace.datasets import * from brainspace.vtk_interface.wrappers import BSPolyData parametrize = pytest.mark.parametrize testdata_surface = [ ({}), ({'as_sphere': True}), ({'as_sphere': False, 'with_normals': False}), ({'as_sphere': ...
d5e99d09cbbe80f1a8219b37eee1ed3a6541500186ca42259af1edbee82bf8c1
Python
3,657
101
from __future__ import annotations import io from collections import OrderedDict from io import StringIO from pathlib import Path from typing import Any import pytest from hypothesis import given from hypothesis import strategies as st from pyfakefs.fake_filesystem import FakeFilesystem from pytest_mock import Mocker...
aa00c2b197d8db32487a2529b457fff31366ed6c1991667a1676f25f7117d978
Python
3,661
74
import os import pandas as pd import collections import pyranges as pr # Load the TSV file into a DataFrame file_path = "/home/nomura/Proj/mmvelo/experiments/SHARE-seq_hf/2023-08-03T13:31:54_nb_k50_for_analysis/downstream_analysis/result/GRN_inference_sep/network_filtered_fdr_1e-4_bh.tsv" data = pd.read_csv(file_path...
5a6f810fdadae199205a82a3153cc1d078db46e7b3f2b24b9725ab5e98300691
Python
3,664
129
from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd results_dir = Path("ana/results_20260331") file_paths = sorted(results_dir.glob("s*/summary_thresholds.csv")) # ターゲット条件 target_layer = "conv1" target_ecc = "ecc12" max_r = 150 # CSVの component 列と direction 列に対応する表示順 con...
47012faae9240228240500ecffe46de9d0b8b0d6f3d384591664bf968e3ff8a1
Python
3,677
73
import torch from torch._dynamo import OptimizedModule from torch.nn.parallel import DistributedDataParallel as DDP import torch.distributed as dist from nnunetv2.utilities.ddp import get_ddp_topology def load_pretrained_weights(network, fname, verbose=False): """ Transfers all weights between matching keys ...
4d242736cb60666d9daece0124982c36db62666b85707f2019ad26051aa41d8f
Python
3,681
131
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Custom OpenMM Forces TODO ---- * Add relevant duecredit entries. """ import numpy as np import openmm def get_boresch_energy_function( control_parameter: str, ) -> str: """ ...
f15fa739d33033f27cd730372a083d66c120572140ec7e201d5019f3f72420cc
Python
3,690
110
"""Tests for membership storage.""" from mesa import Agent, Model from mesa.meta_agents import MetaAgents from mesa.meta_agents.backend import MembershipBackend def test_add_and_query(): """Add edges and verify basic query behavior.""" backend = MembershipBackend() backend.add_membership("a1", "g1", "mem...
3a11fb3dd3e23ee716c8146f9c22d3c32fe5ad3b596c4beddc2ecc09a54bd229
Python
3,694
73
#!/usr/bin/env python # Copyright 2017-2018 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...
56a8f26f7aaa48009fe84c43ddfb57c957aac6a2d3919ea4144fa5129ad142d0
Python
3,694
84
#wget "https://rest.uniprot.org/uniprotkb/stream?download=true&format=fasta&includeIsoform=true&query=%28%28proteome%3AUP000005640%29%29" #python sequenceVenn_fasta.py CCDS_nucleotide.20221027.fna.CCDS.20221027.txt.aa.fasta uniprotkb_proteome_UP000005640_2026_05_17.fasta --write-fasta import argparse from pathlib impor...
ed4da0472422d12c8ae2aa318cf63d52fcd548b5d5c2cb5ae8f097ab44fd4bc2
Python
3,694
104
#python mqrunDash_verify_peptides.py from pathlib import Path import re import mqrunDash as mq import argparse parser = argparse.ArgumentParser(description="Verify mqrunDash peptide label claims against a FASTA and DuckDB file.") parser.add_argument('--db', default=r'Z:\Download\mqrun.duckdb', help='Path to the Duck...
a664f2c124e8c2e7504a03d64a8d4519577a1e0ed1ce2eabd1eedb75fa0e53ff
Python
3,697
114
############################################################################ # Copyright (c) 2023-2026 University of Helsinki # # All Rights Reserved # See file LICENSE for details. ############################################################################ """ Barcode detection classes for single-cell and spatial tr...
67e53a95314c4fd8d96e350d5e46d89f6b8bb782b1f1b5e76192d9baecf3e0df
Python
3,700
116
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import MDAnalysis as mda import numpy as np import pytest from openff.units import unit from openfe.protocols.restraint_utils.geometry.boresch.guest import ( _bonded_angles_from_pool, ...
ff28960d96c1835cbc107e12494f5c2c4a3b6ccdcea3d61401853323e724440c
Python
3,702
99
# # Copyright (c) 2025 10X Genomics, Inc. All rights reserved. # """Multiplexing cell typing methods.""" import martian import cellranger.cr_io as cr_io from cellranger.cell_typing.common_cell_typing import CellTypeResults __MRO__ = """ stage CELL_TYPING_MULTIPLEXER( in bool disable_cloud_cell_types...
0bad28c8830db1857b1783fdde6adddb027be2159bdfa525df7943565e6810a9
Python
3,708
96
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import torch from torch import nn from detectron2.config import CfgNode from detectron2.layers import ConvTranspose2d, interpolate from ...structures import DensePoseChartPredictorOutput from ..utils import initialize_module_params from .registry impo...
1ede0b3861d063dff284a91d3af790d31f3610dbf6e76ccaf4bf5eb3dc74620b
Python
3,709
118
from __future__ import annotations import argparse import sys from collections.abc import Callable, Iterable from typing import ( TYPE_CHECKING, Any, Generic, TypeAlias, TypedDict, TypeVar, overload, ) from typing_extensions import Required, Unpack if TYPE_CHECKING: from argparse impo...
b8512a9c4862c291fc855609d9fcccd8f71e17c62ac08062fa15df80ea20db84
Python
3,711
91
import pydoc import warnings from typing import Union from nnunetv2.utilities.find_class_by_name import recursive_find_python_class from batchgenerators.utilities.file_and_folder_operations import join def get_network_from_plans(arch_class_name, arch_kwargs, arch_kwargs_req_import, input_channels, output_channels, ...
0b5ecfc6841c91253d5791a98907f201c127c7b5408faae5b3060551cff584d8
Python
3,715
105
import matplotlib.pyplot as plt import numpy as np import pandas as pd from support.config import ALGORITHMS, ALGORITHM_LABELS, COLORS, METRICS from support.plot_helpers import tables, xerr def prepare_data(results_or_tables) -> pd.DataFrame: candidates = tables(results_or_tables)["candidate_model_selection"].co...
40c7084010e81b05bb9ea96be9bfcb2fb9fe27f761e8cb0cddef182fdf5847e0
Python
3,724
100
import os import sys import glob import numpy as np import nibabel as nib def hide_files(directory_use, dwifile, dwibasename, suffix): hidden_dir = os.path.join(directory_use, suffix) if not os.path.exists(hidden_dir): os.makedirs(hidden_dir) os.rename(dwifile, os.path.join(hidden_dir, dwifile)) ...
23775c63ba6eb7cbb140e763d5ff9c92eb730a542109974e77f795316b19a3cb
Python
3,725
98
#!/usr/bin/python3 ################################################################################## # # MIT License # # Copyright (c) 2025 Kevin Rockenbach, Agnieszka Golicz # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "So...
a483a49110b2428c6bc82e2de55f4313499073a31a7856568dcd01c3b45b9614
Python
3,733
111
import ldscore.ldscore as ld import unittest import bitarray as ba import numpy as np import nose import ldscore.parse as ps def test_getBlockLefts(): l = [ (np.arange(1, 6), 5, np.zeros(5)), (np.arange(1, 6), 0, np.arange(0, 5)), ((1, 4, 6, 7, 7, 8), 2, (0, 1, 1, 2, 2, 2)) ] for c...
ca708de7e48ad7eb83090419bc1cd8cf0265abef412edb1ef312542a1d9af339
Python
3,739
84
import os import sys import glob import pandas as pd import math import matplotlib.pyplot as plt import scvelo as scv import anndata as ad import numpy as np import scanpy as sc import scipy import time from .TSvelo_pp_utils import get_TFs, select_gene, geneid_symbol def read_data(args): if args.dataset_name == '...
18b0e6d5dc74aeeabca0960f089f2e6e8308d0eea3403d44378054102df23d44
Python
3,740
68
from batchgenerators.utilities.file_and_folder_operations import * import shutil from nnunetv2.dataset_conversion.generate_dataset_json import generate_dataset_json from nnunetv2.paths import nnUNet_raw def convert_amos_task1(amos_base_dir: str, nnunet_dataset_id: int = 218): """ AMOS doesn't say anything abo...
580355dd358b41224aa6ba473cb66234905a9e69c1842b125f9a4d53c2f74fba
Python
3,742
126
""" Created on 10/08/2017 @author: Niklas Pallast Neuroimaging & Neuroengineering Department of Neurology University Hospital Cologne """ import matplotlib.pyplot as plt import os, sys import numpy as np import scipy.io as sio np.seterr(divide='ignore', invalid='ignore') import seaborn as sns def intersect_mtlb...
c0c74df39d5a216ad8d5a06132b84e7575966b64426450815f45ca7ceab20309
Python
3,742
81
''' Created on Sep 18, 2025 @author: voodoocode ''' import numpy as np import nibabel import scipy.ndimage import scipy.io import scipy.interpolate TRANS_PATH = "/home/voodoocode/Downloads/sub-Ba01slicer/normalization/transformations/sub-Ba01slicer_from-MNI152NLin2009bAsym_to-anchorNative_desc-ants.nii.gz" #TRANS_...
56dd4465c797e71040dc35bcb8c3cf8fe1782a7e7a879f20384f2dc3b47cc502
Python
3,750
100
import glob import os import json import pandas as pd from pathlib import Path from ..utils import load_checkpoint import numpy as np # Import the metric calculation logic from ..utils.evaluation_metrics import compute_macro_f1_and_ci PKG_ROOT = Path(__file__).resolve().parents[1] MODELS_DIR = PKG_ROOT / "semantic_mod...
e1a4357fd1af8476ebbe8ff7a10157e8a50fa1527c8ead6e027e2526891a9e3b
Python
3,750
58
import os import nibabel as nib import numpy as np from nilearn import image, plotting from nilearn.maskers import NiftiMasker from nilearn.signal import clean from tristan_pipeline.io.params import * from tristan_pipeline.utils.loading_utils import * from tristan_pipeline.utils.preproc_utils import * from tristan_pipe...
6091bc094ddd23eee8afc0103ea4e6034dc795e1dd5c90919e95cb8786ec050f
Python
3,752
90
import os, argparse, sys, datetime os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' #Prevent JAX from using all of the threads available os.environ["OMP_NUM_THREADS"] = "1" # export OMP_NUM_THREADS=4 os.environ["OPENBLAS_NUM_THREADS"] = "1" # export OPENBLAS_NUM_THREADS=4 os.environ["MKL_NUM_THREADS"] = "1" # export MKL_NUM_...
c8bb9c9f8795dfb3f2969d7da8ce2130db2059155559508fb7fffd5a830f3efc
Python
3,754
74
from matplotlib import pyplot as plt import numpy as np import os import pickle from rCPGswCPG.plotting_figures.plotting_utils import run_sim, resample, plot_recordings from rCPGswCPG.utils.gen_utils import get_project_root if __name__ == '__main__': rerun = True modes = ['eupneic', 'apneustic'] # settle t...
30678478d62ff004cbea54da957a5ce189db394b7b957bd2b283a7f01d896484
Python
3,756
112
#!/usr/bin/env python # # Copyright (c) 2024 10X Genomics, Inc. All rights reserved. # """Postprocess the cell type diff expression generated. Rewrite the header of the cell types diff expression csv to have the celltypes and generate the figure for websummary. """ import json import os from dataclasses import asdic...
bc12323b73d386c8e503da3a2585fe3a79bdfd4267791dcba21e0de0a4af55a9
Python
3,759
97
from typing import Callable class ValueFormatter: @staticmethod def _formatted_value(value) -> str: if isinstance(value, dict): return ValueFormatter.dict_method()(value) elif isinstance(value, list): return ValueFormatter.list_method()(value) elif isinstance(va...
d906e79d340ce99e2a8943c558871c92ab2892822889f482351a5ac885d48149
Python
3,759
117
""" Created on Tue Aug 27 15:18:40 2024 @author: dcupolillo """ import sys from PyQt5 import QtWidgets from PyQt5.QtWidgets import QMainWindow, QGridLayout, QWidget, QMessageBox from ROIpy.GUIv2.load_frame import LoadFiles from ROIpy.GUIv2.plot_structures_controller import StructureFrame from ROIpy.GUIv2.scan_para...
dded73e11078187b57e03764e853a2a51673ccd291b4be3f03486bfd0dd7c278
Python
3,759
119
import pandas as pd data = pd.read_csv('F:/OneDrive - NTNU/UTR/data2.csv') data.head() data.describe() import numpy as np data['RFPlog']=np.log2(data['Fluorescence']) data['RFPlog'].hist() data['ReadsLog']=np.log2(data['#Reads Col']) data['ReadsLog'].hist() import matplotlib.pyplot as plt plt.scatter(data['RFPlog'],d...
07b105b7246f8ec955134e551effb64d2facc3cf2127356db93ecd01ee9e7d23
Python
3,764
105
#!/usr/bin/env python # # Copyright (c) 2018 10X Genomics, Inc. All rights reserved # from __future__ import annotations import os from typing import TYPE_CHECKING import martian import cellranger.cr_io as cr_io import cellranger.feature.crispr.protospacer_calling as protospacer_calling if TYPE_CHECKING: impor...
407367b50fe947e0c5ac9a559fe43470b2113e371fc8bf6b0adbf43e1fd9d512
Python
3,764
94
# %% Imports # Imports from the library from micorr.simulation import simulations, testing, plotting, transformations from micorr.estimators import mi_estimators # More general imports import numpy as np import matplotlib.pyplot as plt # %% Initial parameters # Simulating the base evoked response sim_params = {'st...
6abb37002bb21653d24a9edcc532cc30c1eb307249acb49ea2089c0f05dcfe0b
Python
3,764
109
"""" Created on 06.04.2019 @authors: Niklas Pallast """ import os import sys import argparse import numpy as np import nibabel as nii def getOutfile(roi_file,img_file): imgName = os.path.basename(img_file) baseName = str.split(os.path.basename(roi_file),'.')[0] dtiParam = str.split(imgName,'.')[-3] ...
bfd2e71f3854750dbb59597dd4dbf4b7e49d82ddc82fdba6dda512ed8f36fc68
Python
3,764
102
#!/usr/bin/env python3 # ############################################################################ # Copyright (c) 2022-2026 University of Helsinki # # All Rights Reserved # See file LICENSE for details. ############################################################################ # Inject barcode (CB) and UMI (UB) ...
ec2c8dd6471de5184a07b56e1eff98332c3f9c7553a490f6524ac0e5ff47c613
Python
3,770
81
from typing import Dict import pytest import numpy as np from brian2 import Network, seed from brian2.units import msecond, mvolt, nsiemens, hertz from hsnn.core import NeuronClass, SynapseClass, Projection from hsnn.core.config import ModelParams from hsnn.core._brian2.groups import COBAFactory @pytest.fixture(aut...
ce8ad6bc99fbc0ef52a56e022ed0a167cf207a5cf0925875092ad705e9aad41d
Python
3,771
106
from __future__ import annotations import argparse import json from pathlib import Path import pandas as pd REPLICATE_WEIGHT_COUNT = 80 def _read_student_file(path: Path) -> pd.DataFrame: suffix = path.suffix.lower() if suffix == ".csv": return pd.read_csv(path, low_memory=False) if suffix == ...
f2ad2b44410f706e3ba8ebbcfcdf1ced795ddc1a9d2e9d6e71edca6aa7f6b561
Python
3,771
112
"""Optional tautomer step tests.""" from __future__ import annotations import sys import pytest from rdkit import Chem from src.tautomer.base import TautomerError from src.tautomer.factory import build_tautomerizer from src.tautomer.rdkit_adapter import RDKitTautomerizer, enumerate_tautomers def _canon(smiles: st...
a6e7f500556afa4710d0b5c050be8a84e20f78bd813a2c25aab72378e3b665c2
Python
3,773
99
""" Brain Image Library =================== <!-- difficulty: beginner --> Fetch neurons from the Brain Image Library (BIL). The Brain Image Library (<https://www.brainimagelibrary.org>, BIL) is a public repository hosted at the Pittsburgh Supercomputing Center. It is primarily known for its (very large) microscopy da...
41c04bacefa66cfea7c878630c72c2785bb1323c7366cd5eea67ca04c9e1d6c5
Python
3,780
118
#!/usr/bin/env python3 """ Fast duplicate file finder. Scans a start directory (default $HOME), groups files by size, hashes files with same size using xxhash if available (falls back to sha1), and writes a CSV of duplicate files (sorted by size descending). Output CSV columns: group_id,hash,size,duplicate_count,path ...
7e7ed839a33df335a477a97fcc8aba9c3046175d512455a58727067d24adbcdc
Python
3,781
109
import subprocess import numpy as np import itertools import argparse import logging import re def get_current_gpu_utilization(): """ From: https://discuss.pytorch.org/t/access-gpu-memory-usage-in-pytorch/3192/3 Get the current gpu usage. Returns ------- usage: dict Keys are device ids...
32195ec889591109600a7367510f98340b7fa04af08cb4842f558f7fccf8f46e
Python
3,783
113
import gzip import pickle from pathlib import Path from typing import Any, Mapping, Optional, Tuple import pandas as pd from omegaconf import DictConfig, OmegaConf from .data import ImageSet from ..transforms import transform_registry, Compose BASE_DIR = (Path(__file__).parents[3]).resolve() DATA_DIR = BASE_DIR / 'd...
e670334d75751cd6ae5dd6834153fe71f32dd90d87bacab3c6f329b6907ba247
Python
3,786
129
#!/usr/bin/env python # # Copyright (c) 2017 10x Genomics, Inc. All rights reserved. # import csv import os import shutil import martian __MRO__ = """ stage PARSE_PARAM_CSV( in csv params_csv, out csv params_csv, out int num_analysis_bcs, out int random_seed, out int num_pca_bcs, ...
31f5b4d63639fe3765a8091fb160df2bc1d72556e9204ae31fe65e2d6ba6f9c5
Python
3,791
100
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from dataclasses import make_dataclass from functools import lru_cache from typing import Any, Optional import torch @lru_cache(maxsize=None) def decorate_predictor_output_class_with_confidences(BasePredictorOutput: type) -> type: """ Create a...
72d8cbd5f805358d9275e04f4d0d7535a3495f631abbfe740b017a547ab8ccd8
Python
3,801
109
import logging from typing import Iterable import torch from torch import Tensor from chemprop.data import BatchMolGraph, MulticomponentTrainingBatch from chemprop.models.model import MPNN from chemprop.nn import Aggregation, MulticomponentMessagePassing, Predictor from chemprop.nn.metrics import ChempropMetric from ...
944cedccc7c471bced0aadcd861fab7bc84e9c08c571ab3e0da9947f204e4be3
Python
3,802
81
# Copyright 2021 HIP Applied Computer Vision Lab, 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...
b735f15a49d98304d485c627ba7da2325b230a9e83b555931cbefd6ae9bdc73a
Python
3,802
100
from pathlib import Path from typing import List, Dict from dataclasses import dataclass import numpy as np import torch import torchvision.transforms as transforms import matplotlib.pyplot as plt from abx_app.AttackCNN.attack_examples import run_attack from . import config from .utils.activation_manager import Acti...
4a0d47682f2c0439eaeda66dbe8f8645550e0435437114b285882111eb6787d9
Python
3,805
93
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import numpy as np from typing import List, Optional, Tuple import torch from detectron2.data.detection_utils import read_image from ..structures import DensePoseChartResult from .base import Boxes, Image from .densepose_results import DensePoseResults...
270310f73c8b80187b1e48eb4164f0aa5df9a9e4cc3d1e92b7a4c472f5124ac4
Python
3,806
91
import numpy as np def merge(dict1, dict2): keys = np.unique(list(dict1.keys()) + list(dict2.keys())) keys = np.unique(keys) res = {} for k in keys: all_configs = [] if dict1.get(k) is not None: all_configs += list(dict1[k]) if dict2.get(k) is not None: ...
57905b094e79deb169cfdb298ada250b8afd112a6c33ca65a454e5dab2c64b3c
Python
3,807
109
# Copyright (c) Facebook, Inc. and its affiliates. import os import tempfile import unittest import yaml from omegaconf import OmegaConf from omegaconf import __version__ as oc_version from dataclasses import dataclass from detectron2.config import LazyConfig, instantiate, LazyCall as L from detectron2.layers import ...
764ca715f90574f32909f71f379906a5f4673e88fde30413f78f4e7dff7babfb
Python
3,807
92
# python ionSearch.py import pandas as pd import xml.etree.ElementTree as ET import numpy as np import os #Load and filter data chargeThreshold = 1000 intensityThreshold = 1 dirPath="L:/promec/HF/Lars/2025/251204_Maren_Gemma/combined/txt/" mzData = pd.read_csv(dirPath+"matchedFeatures.txt", sep='\t') ionSelect = pd.rea...
025136feead71ea7b185761121e3022d6ca2554da9df186501e70f3f01e8ea6d
Python
3,810
104
"""Process-level cache for loaded model weights. Batch workflows construct a ``Predict`` object per file, and each construction otherwise repeats ``torch.load`` + ``load_state_dict`` + a host-to-device copy of the same checkpoint. Caching the built model keeps repeated predictions on one checkpoint from paying that co...
47ac4be2820df2a6405dc822ae7ec34d02129af066d0a4dc1ea9fae467bcb495
Python
3,827
99
"""Global configuration for figure generation scripts. All paths are relative to the repository root. No hardcoded absolute paths. """ from pathlib import Path # Repository root: two levels up from python/utils/ REPO_ROOT = Path(__file__).resolve().parents[2] DATA_DIR = REPO_ROOT / 'data' OUTPUT_DIR = REPO_ROOT / 'ou...
82cd9b9494db7773d244799fc3fb16b1e3160f10068057c8702b4fc5c951e278
Python
3,828
95
## Setup GENTRL Deep learning enables rapid identification of potent DDR1 kinase inhibitors https://www.nature.com/articles/s41587-019-0224-x #https://docs.anaconda.com/anaconda/install/linux/ #! sudo apt-get install python3 libxrender1 libxext6 libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 lib...
aada734f8530caddf337d3624c279a007d26eb28e3160d1d1bb223816659fc51
Python
3,830
143
"""Utilities for the aperiodic-clinical project.""" from collections import Counter import numpy as np import pandas as pd from specparam.utils import trim_spectrum #################################################################################################### ##################################################...
ae67ed5aecd87b607cbf58ec4074ceb39badfdc44a71176db0367eaada839c9d
Python
3,839
141
"""NOTE: these tests make a lot of assumptions about the internal mechanics of the AtomFeaturizer, so they'll need to be reworked if something ever changes about that.""" import numpy as np import pytest from rdkit import Chem from rdkit.Chem.rdchem import HybridizationType from chemprop.featurizers import MultiHotAt...
6c80e2e939cd5b3625f56b0b76b267ef236585d84892661bbdf79f5e7ab6807e
Python
3,842
108
import statsmodels.api as sm import pandas as pd import numpy as np import pymc as pm import aesara.tensor as at def aggregate_sign_feature(df_in, feature_key, pos_mask): ''' Aggregate data across channels per subject for each feature of interest. ''' feature_by_age = [] for subject in df_...
db0b0801cde13049d3053b0d347295104da2d56891956899300c86cdf168e4ed
Python
3,843
103
# Copyright (c) Facebook, Inc. and its affiliates. import torch from torch import nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from detectron2.layers.wrappers import disable_torch_compiler class _ROIAlignRotated(Function): ...
d569628ad1c05be56b1d66cf702db1e145ba2d3a5e4fae02dea513019750e433
Python
3,845
108
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import numpy as np from typing import Iterable, Optional, Tuple import cv2 from densepose.structures import DensePoseDataRelative from .base import Boxes, Image, MatrixVisualizer, PointsVisualizer class DensePoseDataCoarseSegmentationVisualizer: ...
ef47a1899b47f8e44b7d135c6aae9f15ce674b767417726e20599b245a5380ff
Python
3,848
72
############################################################ # ---------- NBS Consensus Clustering Functions ---------- # ############################################################ import os import pandas as pd import numpy as np import scipy.spatial.distance as dist import scipy.cluster.hierarchy as hclust # Takes...
f85e7cdadb3b14e90a8a687fb2549847fc521c0d45187d06c7152f79443a5242
Python
3,849
142
from navis import Dotprops import pytest import numpy as np from navis.nbl.smat import ( Digitizer, LookupNd, Lookup2d, LookupDistDotBuilder ) SMALLEST_DIM_SIZE = 3 SEED = 1991 def lookup_args(ndim): f""" Create arguments for an ND lookup table. The first dimension is of size {SMALLEST_DIM_SIZE}, ...
2265813639c01bfede73c6754ef322ff3c17ad6e2e331b9b6a169297f397fd5c
Python
3,851
77
import os import glob 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.TSvelo_utils import run_paga, run_palantir, get_colors, show_imgs, sigmoid, relu, scv_analysis from TSvelo.TSvelo_pp import preprocess from TSv...
65c00e4bcd90d7f64c09026ec6445f2c706ec0cec3697e2d54bbccb04cb871ee
Python
3,851
122
from __future__ import annotations import argparse import logging from pathlib import Path from typing import Any import attrs from snakebids import bidsapp from snakebids.bidsapp.args import ArgumentGroups from snakebids.plugins.base import PluginBase from snakebids.utils.utils import DEPRECATION_FLAG logger = log...
02ae4f425b11294df6a8cdf4e9320a325a0a015e3e3dbb57bd77fd52fee3c8ee
Python
3,853
164
#!/usr/bin/env python # # Copyright (c) 2017 10X Genomics, Inc. All rights reserved. # """Constants used by the VDJ pipeline.""" ###################################################### # DO NOT add new items to this file. # # - If a constant is only used from a single module, put it in that module. # - If a constant is...
fadc2f8faf44aef926d64941b9ba020cf748503ca4b600dc86c17e8a4ab0ac78
Python
3,853
101
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 9 12:13:33 2022 @author: evanqu """ import numpy as np import gzip import pickle import logging import argparse from accusnv import log as accusnv_log from accusnv.preprocessing import utils as ghf log = logging.getLogger('accusnv') def vcf_to_qu...
0e996b8a9945ed98fec4281ed13ce37a1b584331261ae98ab6e75b8c402c19f6
Python
3,862
106
# ------------------------------------------------------------------------------ # Title: Gene Regulatory Network Inference (GRNBoost - P0) # Author: Yiran Song # Date: March 18, 2025 # Description: # This script runs GRNBoost2 to infer gene regulatory networks from Commot spatial communication data. # # Key Functions:...
313038101d737d87997c66b25872cd0d2787bc3aac9650fc4fd19e5554f1f589
Python
3,868
107
# Copyright (c) Facebook, Inc. and its affiliates. import torch from torch import nn from torch.nn import functional as F from torch.nn.modules.utils import _pair from detectron2.layers.wrappers import _NewEmptyTensorOp class TridentConv(nn.Module): def __init__( self, in_channels, out_ch...
889bdc1a66289683890d79e774ecc5193a0587e69a2604bd0339a42dd1b18b2d
Python
3,868
100
# ## Manually export images using the picasso functions to render oversampled images with optional precision based blur. from configparser import Interpolation import os import numpy as np import pandas as pd from picasso import render, io import matplotlib.pyplot as plt from skimage.io import imread import matplotlib....
ec11b50c65a571973ed548f5d46572edffc4c7a6f2f2d26129260b1596c81909
Python
3,868
99
from __future__ import annotations from dataclasses import dataclass from datetime import datetime, timezone from math import ceil from pathlib import Path from textwrap import fill import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from rdki...
4db2f06a954efeb51e4364e70096224a661234a456c75b60d6ad4405b8863735
Python
3,879
74
#coding https://mattmazur.com/2015/03/17/a-step-by-step-backpropagation-example/ with tensorflow/keras, checking with iterative version at https://github.com/animesh/ann/blob/master/ann/Program.cs with following output #Iteration = 1 Error = 0.298371108760003 Outputs = 0.751365069552316 0.772928465321463 #...
6af592fcfcf975dde43bea71c8f0fc58b9949f5a9a381d6a819b21eee82104f6
Python
3,882
98
import numpy as np class LambdaWarmUpCosineScheduler: """ note: use with a base_lr of 1.0 """ def __init__(self, warm_up_steps, lr_min, lr_max, lr_start, max_decay_steps, verbosity_interval=0): self.lr_warm_up_steps = warm_up_steps self.lr_start = lr_start self.lr_min = lr_min ...
a607277dc423cd9997c01a6583d1e50f73c3cfdbd24c897e68909bc2f8bd9bb7
Python
3,882
122
#%% Imports # Imports from the library from micorr.simulation import simulations, testing, plotting, transformations from micorr.estimators import mi_estimators, corr_est # More general imports import numpy as np from functools import partial #%% Initial parameters # Dictionary with the estimators to be tested est...
850f563f3bd5d9a3be8ef19d05cb265dc0fe19c1fb0ca77bb7a84dcc862284f4
Python
3,883
101
import torch import torch.nn as nn class UNet3D(nn.Module): def __init__(self, n_in, n_out): super(UNet3D, self).__init__() # Encoder self.ec0 = self.encoder_block( n_in, 32, kernel_size=3, stride=1, padding=1) self.ec1 = self.encoder_block( 32, 64, kernel_size=3,...
2d23e747c24e2a3dabc1c65ef8c288f4650141bd2283ffa0e7b79328b73a6f74
Python
3,891
115
import logging import os import numpy as np __all__ = ['check_can_write_file', 'normalize_3d_volume', 'volume4d_to_matrix'] def check_can_write_file(fpath: str, force: bool = False): """ Check if a file can be written. The function checks if the file already exists, the user has the permission to w...
d14620a956d3e741fa094262fae5961d9993afd6454e6a4db3a0c8cbfba1d35f
Python
3,899
111
"""Shared helpers for locating a reference genome and reading its stats. Sample sheets and FASTQ paths are not handled here: the CLI resolves every read and reference path up front and writes them into samples.csv, which the workflow reads directly.""" import os import glob import gzip import numpy as np from Bio imp...
ffc6270eb285ff89496eb204d32f1635be05df678ed4d1e02e28dc1d0406ef86
Python
3,899
132
""" Created on Tue Aug 27 15:22:29 2024 @author: dcupolillo """ from pathlib import Path from PyQt5.QtWidgets import ( QMainWindow, QFrame, QLabel, QGridLayout, QPushButton, QFileDialog, QMessageBox) from PyQt5.QtCore import Qt, pyqtSignal from ROIpy.core.structures import Stack, Morphology, Scanfields c...
aae50591e8ca91fff0358a5937943a7577e310c192951276bc1966df1428c1d1
Python
3,903
98
# Copyright (c) Facebook, Inc. and its affiliates. import contextlib import os import random import tempfile import unittest import torch import torchvision.io as io from densepose.data.transform import ImageResizeTransform from densepose.data.video import RandomKFramesSelector, VideoKeyframeDataset try: import ...
039428d5edd73e261152b844725efdd5731b5abfba3fce420df6264395b62c7c
Python
3,904
110
from copy import deepcopy from pathlib import Path from typing import Any, Dict, Iterable, MutableMapping, Mapping, Optional, Sequence import numpy as np from omegaconf import OmegaConf from ray import tune from hsnn.utils import io from hsnn.simulation import Simulator __all__ = ["traverse_dict", "override_config",...
16f213864381c3615c92f0b104f9295ab2133cdaa1941a83e0e117051db0623c
Python
3,907
111
# Copyright (c) Facebook, Inc. and its affiliates. import itertools import math import operator import unittest import torch from torch.utils import data from torch.utils.data.sampler import SequentialSampler from detectron2.data.build import worker_init_reset_seed from detectron2.data.common import DatasetFromList, T...