sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
89f4010495fa30e074f74fd109be55c4dffca0754b2863b849b2382ec20345bb
Python
1,843
59
from omegaconf import OmegaConf import detectron2.data.transforms as T from detectron2.config import LazyCall as L from detectron2.data import ( DatasetMapper, build_detection_test_loader, build_detection_train_loader, get_detection_dataset_dicts, ) from detectron2.evaluation import COCOEvaluator data...
6717dd54b83564ee91dfc78052ec4bf1fb7fa63b719efa398582d9e40c67b2a5
Python
1,845
54
#!/usr/bin/env python3 # # Copyright (c) 2021 10X Genomics, Inc. All rights reserved. # # """Infer Gem well throughput from the barcode rankplot.""" from __future__ import annotations import cellranger.cell_calling_helpers as cch from cellranger.feature.throughputs import HT_THROUGHPUT, MT_THROUGHPUT ANCHOR_BARCODE_...
f0fc3dd608afbb242fc61cc9eb4a6752e7a98189e0e8a42740ba53c631dc7efe
Python
1,848
42
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2019-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. ############################################################################ ...
09b69cc8f436e93771c2206a0ecbae5b60f8dab71a2e4f0e97d3aec515ea1be2
Python
1,851
59
# Copyright (c) Facebook, Inc. and its affiliates. """Utilities for developers only. These are not visible to users (not automatically imported). And should not appeared in docs.""" # adapted from https://github.com/tensorpack/tensorpack/blob/master/tensorpack/utils/develop.py def create_dummy_class(klass, dependency...
9ad627170c5982e8644b5797f6da6612b8f838acde1c9a73a332124327d76794
Python
1,851
46
#####DO NOT REVIEW, CHANGES IN PATHS##### from nilearn.glm.second_level import SecondLevelModel from nilearn.glm import threshold_stats_img from nilearn.image import load_img, concat_imgs import pandas as pd import nibabel as nib import os from nilearn.plotting import plot_stat_map subjects = [1, 3, 5] contrast_name =...
b4ad53fa9b2ed47b615dd1408e6446ff6e7b0e4f2e83a80de1c4de7e2832e66d
Python
1,856
68
""" Changs's method {chang2005automatic, title={An automatic method for estimating noise-induced signal variance in magnitude-reconstructed magnetic resonance images}, author={Chang, Lin-Ching and Rohde, Gustavo K and Pierpaoli, Carlo}, booktitle={Medical Imaging}, pages={1136--1142}, year={2005}, organization={Interna...
52f38477bcaf4fd74ce7edb488b616133d9e9e9f52ce37f7801489cd0ff7266a
Python
1,858
61
''' Created on 25.08.2020 Author: Michael Diedenhofen Max Planck Institute for Metabolism Research, Cologne Description: Helper tool to compare the number of voxels included in the peri-infarct region for each subject. ''' from __future__ import print_function try: zrange = xrange except NameError: zrange =...
f05d738b4b7e067d5c5076b07d27c6c21daf795017f53b708e02eba308566f8e
Python
1,862
57
from hsnn.simulation._base import _get_uid from hsnn.core.interfaces import INetwork __all__ = ["MonitorContext", "StateContext", "ClampContext"] class MonitorContext: def __init__(self, network: INetwork, monitor_spikes: bool = True, monitor_states: bool = False) -> None: self.network =...
0ead5f02ab8e6781e65e0fa211b6d7d9a8275a34fa491298ff2dea3b076cda37
Python
1,865
58
"""MolGpKa GCN network (inference only). Vendored from MolGpKa (https://github.com/Xundrug/MolGpKa), MIT License. Patched for SMILES2Docking: only ``GCNNet`` (the released pKa model) is kept; the unused GAT/MPNN variants and the deprecated ``DataLoader`` import were dropped so the frozen build pulls no extra PyG conv ...
9bb6938911c5e7f4d93a27b48de3b98285dbbe62058d8403d60b8b8a7babbe80
Python
1,865
49
import pytest from openfe.setup.atom_mapping.ligandatommapper import LigandAtomMapper from openfe.utils import ligand_utils class TestAtomMapper: def test_abstract_error(self, simple_mapping): # suggest_mappings should fail with NotImplementedError if the user # tries to directly user the abstrac...
b65bbe80c9ba5627b05b473c8902e744d879bfc8ea2760df09bd031e7c0f613c
Python
1,868
55
# # Copyright (c) 2024 10X Genomics, Inc. All rights reserved. # """Stage checking if cell annotation is viable but not requested in a multi run.""" import json import martian import cellranger.cell_typing.broad_tenx.cloud_cas_utils as cloud_utils import cellranger.cell_typing.broad_tenx.common as ct_common import c...
24d23a32db8d143bd8cea2c38240c86e80400e60228f9f51e96bb817c0f89a37
Python
1,870
62
import os import sys sys.path.insert(0, os.path.abspath("../..")) # Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information -------------------------...
b2bb1c224ef5e3546f58b9aa07c5b42a96801ab982804d1ebd905a91bff54cba
Python
1,870
49
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2020-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. ############################################################################ ...
94d5a9fd409565eaec91bf725f4a00ff6231d8df4f217daaa0a835b17719a99e
Python
1,872
75
""" Sijbers's method sijbers2007automatic, title={Automatic estimation of the noise variance from the histogram of a magnetic resonance image}, author={Sijbers, Jan and Poot, Dirk and den Dekker, Arnold J and Pintjens, Wouter}, journal={Physics in medicine and biology}, volume={52}, number={5}, pages={1335}, year={2007...
3d9057ff7be90093d6ca31955188c8b04a48a748c2b1882a45f78e07b382a599
Python
1,873
65
import solara from matplotlib.figure import Figure from mesa.examples.experimental.tram_model.model import TramScenario, TransitSystem from mesa.examples.experimental.tram_model.utils import ( POSITION_COLOR, SCALE, SPEED_COLOR, TITLE_SIZE, draw_track_view, tram_portrayal, ) from mesa.visualiza...
736ddb9bd47da835ce29aaba4cba6a4c982a06f860aef7209e2d6ead5e62e468
Python
1,873
59
from abc import ABC, abstractmethod from copy import deepcopy from pathlib import Path from typing import Any, Mapping from omegaconf import ListConfig from ray.tune.search import BasicVariantGenerator from ray.tune.search.bayesopt import BayesOptSearch from hsnn.utils import io from .tuning import traverse_dict cl...
21c436c6be307dca8744e5129164ec3f40d47a0410109025918277acc59719be
Python
1,874
68
from pathlib import Path import numpy as np from steinbock import io from steinbock.measurement import neighbors from steinbock.measurement.neighbors import NeighborhoodType class TestNeighborsMeasurement: def test_measure_neighbors_centroid(self): mask = np.array( [ [1, 1, 0...
6051769dbeae64d64a6041c1f87c7582e1c40e924a582b208d79ffe313ad3d4a
Python
1,874
57
import nest import numpy as np import pylab as pl import nest.topology as tp nest.ResetKernel() nest.SetKernelStatus({'overwrite_files': True}) print 'iaf_cond_alpha recordables: ', nest.GetDefaults('iaf_cond_alpha')['recordables'] mm = nest.Create('multimeter', params = {'withtime': True, ...
bf850549c0f98340fe8b77eda48edf4901bce79efcb7f1d52394dabb3e84d82a
Python
1,874
60
# Copyright (c) Facebook, Inc. and its affiliates. from typing import Any import pydoc from fvcore.common.registry import Registry # for backward compatibility. """ ``Registry`` and `locate` provide ways to map a string (typically found in config files) to callable objects. """ __all__ = ["Registry", "locate"] de...
df78866185c7d876153a8a1d4c185f9c17744ea855cc6a9530797fef2ce6184c
Python
1,874
69
#!/usr/bin/env python # # Copyright (c) 2021 10X Genomics, Inc. All rights reserved. # """Determine if the cloupe was not generated because this is a single sample run of MULTI. In this case we hard-link the single sample cloupe as the library-level cloupe. """ from __future__ import annotations from shutil import c...
e319d65d54d7588985bd7ac7b90cb3d3badb913988ec9e47b2d7deeefadf178f
Python
1,874
82
""" Divide the dataset such that each subject has several droped sessions for certain classes that are available for other subjects Subject DropCount 0 6 1 7 2 7 3 7 4 7 5 6 """ import random import argparse import torch import numpy as np drop_count = [6] * 6 # [...
7b12adb047fcc69e3b2b856dac5665cb466d7298cd0025f27a2bfa4626dc2887
Python
1,880
54
import mne import numpy as np from mne.channels.layout import _find_topomap_coords def get_ch_locs_2d(info, ch_type): ''' Getting the 2D locations of the MEG channels with the given type. Parameters ---------- info : mne.Info The mesurement info associated with the M/EEG data. ch...
a176580bb85de3aa4dbee9fda6eb7f2843802d2495d284ed756dc3dc0652cb53
Python
1,882
35
import sys from pathlib import Path if len(sys.argv)!=2: sys.exit("USAGE: python pepCount.py <path to peptides containing proteome-discoverer exported file>, \n e.g.,\npython pepCount.py \"L:/promec/HF/Lars/2021/march/Ingrid/KO/210317_Ingrid2-(1)_PeptideGroups.txt\"\n") #python pepCount.py $HOME/Animesh/Maria/MGF/20...
d9adb8343954b2e596c9ca5edf6a01bfbb59e53dbd5b246b40f30cc62e960b76
Python
1,882
56
#!/usr/bin/env python # # Copyright (c) 2024 10X Genomics, Inc. All rights reserved. # """Write out cell_types.h5 to use in diff expression.""" __MRO__ = """ stage WRITE_CELL_TYPES_H5( in csv cell_types, in string cell_types_key, out h5 cell_types, out json cell_types_map, src py "s...
c6bb45924bfe476c0083ecb4ed3a5573d2f178a8774169b78635d4c234cc49ad
Python
1,887
36
# 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...
c6c9d512e346c86d0751b30f5ca048d6e8eefffde2611143ce94ade6a6788467
Python
1,895
56
""" Utilities needed for network specification and generation """ import numpy as np import scipy.special as spc def generate_piecewise_constant_signal(num_steps, step_duration, max_rate, min_rate, start_time): """ Generates a piecewise constant input signal with amplitudes drawn from a uniform distribution ...
b2d1586c13008738bc5914fb3b6b0d6530cbd857196045de1f8d32c2483adfd5
Python
1,901
38
import argparse import json import re def main(): parser = argparse.ArgumentParser(description='Create a JSON from an transformix output points file') parser.add_argument('--in', metavar='IN', dest='input', type=str, required=True, help='The output points to parse') args = parser.parse_args() output ...
135f2c7a87528f04a0d6d0f7a1d1662aaaf01130feaff3d7a496be2c5e202112
Python
1,902
60
import torch import torch.nn as nn from .meta.electrode_names import channels from .VisualTransforms import EEGScalpMap # EEG_CNN_LSTM class EEG_CNN_LSTM(nn.Module): def __init__(self, num_classes=10, hidden_size=128): super(EEG_CNN_LSTM, self).__init__() # CNN for spatial feature extraction ...
b07e55e9dcf747770f802ce6d9d759e760ce9cee9dc6c40703a3e620e029ec58
Python
1,902
66
# Copyright (c) 2019 10X Genomics, Inc. All rights reserved. """Pick T or B output.""" from __future__ import annotations from typing import TYPE_CHECKING import martian if TYPE_CHECKING: import cellranger.mro_types.filetypes as mro_filetypes import cellranger.mro_types.structs as mro_structs __MRO__ = """...
8764eea3b9e70a66d44bee32d4bc8b614ce2e0ecc30cf9b229ad1829ccfe223a
Python
1,907
72
''' Created on 20.08.2020 Author: Michael Diedenhofen Max Planck Institute for Metabolism Research, Cologne ''' from __future__ import print_function try: zrange = xrange except NameError: zrange = range import os import sys import numpy as np from scipy import ndimage import proc_tools as pt def circle...
a41c0507b47d38a4d6d944cfc29f30bcbcc78030e632bae132b4f79203afd900
Python
1,909
70
import numpy as np import pytest from chemprop.data import LazyMoleculeDatapoint, MoleculeDatapoint SMI = "c1ccccc1" @pytest.fixture(params=["@", "@@"]) def stereo_smi(request): return f"C[C{request.param}H](O)NC\C=C/C" @pytest.fixture(params=range(1, 3)) def targets(request): return np.random.rand(reques...
2fab9ea38e54b4312c9fce26f7b551f6055a5aaf20ebb0cf662962d59c706101
Python
1,916
66
"""Tests for shared input validation across embedding entry points (#147).""" import numpy as np import pytest from brainspace.gradient.embedding import ( diffusion_mapping, laplacian_eigenmaps, DiffusionMaps, LaplacianEigenmaps, ) def _psd(n, seed): rs = np.random.RandomState(seed) a = rs.randn(n, n + ...
fd361fae633bc2b311c074048ad726e0a93f7203db8b68637c5dd51328ab7887
Python
1,919
50
import logging from collections import Counter from os import PathLike from pathlib import Path from typing import Generator, Sequence, Tuple, Union import networkx as nx import pandas as pd from .. import io logger = logging.getLogger(__name__) def convert_to_networkx(neighbors: pd.DataFrame, *data_list) -> nx.Gr...
4a2f485bd435cc3705810ab428a7531261349836fd85e1dc174f077280c7163d
Python
1,922
54
"""Paths associated with Azimuth.""" from pathlib import Path AZIMUTH_CALIBRATION_MODELS_BASE_DIR = ( Path(__file__).parent / "azimuth_models" / "latest" / "calibration" ) AZIMUTH_CALIBRATION_MODELS_PREFIX = "temp_scaler_L_" AZIMUTH_CALIBRATION_MODELS_SUFFIX = ".onnx" AZIMUTH_CALIBRATION_MODELS_PATHS_SORTED_LIST ...
4a745d95940d5b2743b5f745e57afe160e4ba8f5850c501fa78b49c48e3ffdb4
Python
1,928
60
"""Tests for the allianceformation meta-agent example.""" from __future__ import annotations from mesa.examples.advanced.alliance_formation.model import ( AllianceScenario, MultiLevelAllianceModel, ) from mesa.meta_agents import MetaAgents def test_alliance_model_records_overlapping_memberships(monkeypatch)...
7af21ab1a59c0a2f1dc044a1f9b609a57bdddb06714a00640b1dd0c527e748a5
Python
1,929
53
import argparse def main(args): import glob import random import numpy as np import json mpnn_alphabet = 'ACDEFGHIKLMNPQRSTVWYX' mpnn_alphabet_dict = {'A': 0,'C': 1,'D': 2,'E': 3,'F': 4,'G': 5,'H': 6,'I': 7,'K': 8,'L': 9,'M': 10,'N': 11,'P': 12,'Q': 13,'R': 14,'S': 15,'T': 16,'V': 17,...
223cb0cdf5fbae03532572dbb000ddb65abdaf9f09bcd9854c6601d86705a9b0
Python
1,930
53
from __future__ import annotations from dataclasses import dataclass, field from typing import Any from src.protonation.base import ProtonationError, Protonator from src.protonation.dimorphite_adapter import DimorphiteProtonator from src.protonation.openbabel_adapter import OpenBabelError, OpenBabelProtonator @data...
3f7193818b47490f6262e78d87be354b058f8865c9bd24bce56e514dfc264438
Python
1,931
65
# # Copyright (c) 2025 10X Genomics, Inc. All rights reserved. # """Remove meta cells from cell types.""" import csv import json import os import martian import cellranger.cr_io as cr_io from cellranger.cell_typing.common_cell_typing import BARCODE_KEY __MRO__ = """ stage REMOVE_META_CELLS_FROM_CELL_TYPES( in ...
24992f2d94ecc250c7e96afdcb37e611bf9698b12b1baa9c27a0c0c22e134748
Python
1,932
54
#!/usr/bin/env python # # Copyright (c) 2014 10X Genomics, Inc. All rights reserved. # # General utilities for manipulating nucleotide sequences # from __future__ import annotations NUCS: list[bytes] = [b"A", b"C", b"G", b"T"] NUCS_INVERSE: dict[bytes, int] = {b"A": 0, b"C": 1, b"G": 2, b"T": 3} DNA_CONVERT_TABLE: ...
af820d608e76aa3c700c84f9a5752ec29a65c2ec425064e44953b903dbf388bf
Python
1,933
53
import torch import torch.nn as nn from torch.distributed.fsdp import ( FullyShardedDataParallel, MixedPrecision, BackwardPrefetch, ShardingStrategy, FullStateDictConfig, StateDictType, ) from torch.distributed.fsdp.wrap import size_based_auto_wrap_policy import pytorch_lightning as pl def get_...
5cbe18904790f9c5c1b4cd10d498d58a312eb361f4f7beb4f8cd0744dae0b25d
Python
1,936
60
from __future__ import annotations from typing import Any import pytest from hypothesis import given from hypothesis import strategies as st from pytest_mock import MockerFixture from snakebids.plugins.version import Version, impm from tests.helpers import allow_function_scoped @given(version=st.text()) def test_e...
b710d000bfae50d5a21a00f9938e669bc154db995db7c7717e73eb61d04ca6db
Python
1,936
98
from numpy import * import nest import time import sys ###### Parameters ##### ## simulation lnts =4 #local num threads dt = 1. # the resolution in ms simtime = 30.*1000. # Simulation time in ms delay = 2. # synaptic delay in ms startRec= 10000. #start for recording devices (cut transients) stopR...
637212ec18ea115c9f5c3292deb85c1fd073aadae6265b521f9c9f7df56fbb8a
Python
1,939
57
#!/usr/bin/env python # # Copyright (c) 2017 10x Genomics, Inc. All rights reserved. # import os import martian import cellranger.hdf5 as cr_h5 import cellranger.matrix as cr_matrix __MRO__ = """ stage REANALYZER_PREFLIGHT( in h5 filtered_matrices_h5, src py "stages/analyzer/reanalyzer_preflight", ) using ...
a6ce3d3863e9a9231b609fa053a4bf8c5d6642b38706b845f011d488531eb04d
Python
1,942
63
## eelbrain_utils import eelbrain as eb import numpy as np import mne def ds_from_evoked_depsampt(data_1, data_2, key_data_1, key_data_2): for d_1, d_2 in zip(data_1, data_2): if type(d_1) != mne.evoked.EvokedArray or type(d_2) != mne.evoked.EvokedArray: raise TypeError('Data needs to be of ...
9fd1b002df21269549d2a97f68041908e61f2215a1cbcdda7c4b75663553f514
Python
1,943
51
"""Reproduce the OpenMM reference energy for the solvated ethanol test system.""" from pathlib import Path from xml.etree import ElementTree import openmm from openmm import Context, Platform, VerletIntegrator, app, unit data_dir = Path(__file__).resolve().parent.parent / "data" pdb = app.PDBFile(str(data_dir / "et...
2c9b722ee90c4ee0c2a0adc31b8ebaa499931b11710e9d614f44769439d4d026
Python
1,944
52
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from detectron2.data.catalog import Metadata from detectron2.evaluation import COCOEvaluator from densepose.data.datasets.coco import ( get_contiguous_id_to_category_id_map, maybe_filter_categories_cocoapi, ) def _maybe_add_iscrowd_annotation...
a697afc39da5fb1083b7a255282896d7d09c17240eb8b9cfc99a208cb618f338
Python
1,944
66
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # pyre-unsafe import pickle import torch from torch import nn from detectron2.utils.file_io import PathManager from .utils import normalize_embeddings class VertexDirectEmbedder(nn.Module): """ Class responsible for embedding vertices....
e102484f5bd27ab828de8db66a726fa7bac27c3e78b966f5fbbd8d1f6ec9919c
Python
1,944
47
# Copyright (c) Facebook, Inc. and its affiliates. import numpy as np from torch.utils.data.sampler import BatchSampler, Sampler class GroupedBatchSampler(BatchSampler): """ Wraps another sampler to yield a mini-batch of indices. It enforces that the batch only contain elements from the same group. It...
103736ef473d42bf8e915c57e56ca44bde6afed5d3f86f61f6aa8801791833b8
Python
1,945
55
#!/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...
883f41ed22335038c34ee12d49c41bb4b09e2ce22390dd39ffd32e4d7127c77c
Python
1,947
74
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. """ TensorMask Training Script. This script is a simplified version of the training script in detectron2/tools. """ import os import detectron2.utils.comm as comm from detectron2.checkpoint import DetectionCheckpointer from detectron2.config ...
25d29d0c664b8d8b6e2e43ab3f044770eee8c1d0b9996f4dd5e69d9a1693493b
Python
1,948
55
''' Created on Oct 9, 2025 @author: voodoocode ''' import pyexcel import os import numpy as np META_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/" DATA_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/database4/original/" def main(): sub_rec = {} for subj_name in os.listdir(DATA_PATH): ...
14c55695ec3c102e0f1e87688d97583cbc90067b5a5bf1ce2704d08f3d0648e1
Python
1,949
45
import os import unittest from unittest.mock import patch from nnunetv2.paths import nnUNet_preprocessed, nnUNet_raw from nnunetv2.utilities.dataset_name_id_conversion import find_candidate_datasets class TestPaths(unittest.TestCase): def test_missing_env_var_only_raises_when_converted_to_path(self): wit...
80e1f2b02881f9655caaa2000927795d720e70a363063800a033d4ddcefa9cba
Python
1,950
39
"""resources.py - memory and runtime for AccuSNV jobs. Every job starts in the first (smallest) tier. If it OOMs or times out, Snakemake resubmits it with a higher `attempt`, which moves it to the next tier up. """ TIERS = { 'create_mapping_index': [(2000, 60), (8000, 60), (320000, 240)], 'mapping': ...
4be94716b0a203d3fe0679e1a345515a7f8ca7ff2a9658353b9b0f77e9d9102f
Python
1,951
60
# Copyright (c) Facebook, Inc. and its affiliates. import random import unittest from densepose.data.video import FirstKFramesSelector, LastKFramesSelector, RandomKFramesSelector class TestFrameSelector(unittest.TestCase): def test_frame_selector_random_k_1(self): _SEED = 43 _K = 4 rando...
d95579bbdbbf01cfd5baab6284590d0887b53dc377d3e8ee0453ccb154b142a8
Python
1,952
62
# Copyright (c) 2020 10x Genomics, Inc. All rights reserved. """A wrapper to avoid importing tables directly. We need to monkey patch it on the fly to avoid issues with it changing thread usage under the hood. See CELLRANGER-2936 """ from __future__ import annotations import sys import numexpr import tables # Ho...
43bc94348c98a09b17429df34c0324e37a8751b745ab53a4feae5053309c8ff0
Python
1,953
82
#!/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...
3887fdfaac02fce0d73fdb1b3c8a4b0fa4854c80092ac9162160efc184545372
Python
1,954
46
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from dataclasses import fields from typing import Any, List import torch from detectron2.structures import Instances def densepose_inference(densepose_predictor_output: Any, detections: List[Instances]) -> None: """ Splits DensePose predictor ...
89148c81a0edbcdb8cbf69f3ea6a8e1b032e2fa4c3b6d789ec6c4c4ded1d5036
Python
1,956
63
""" Put module information here """ __author__ = "Fabi Bongratz" __email__ = "fabi.bongratz@gmail.com" import re import os import sys from enum import IntEnum from pandas import read_csv # Discover whether application is running in docker _run_docker = os.path.isdir("/mnt/code") class SupportedDatasets(IntEnum)...
ba958573aba350b16a3802df60e85dbf7000c7bb88b70ffdacd983cc56a57ec1
Python
1,956
65
import shutil from pathlib import Path from typing import Mapping, Optional import pandas as pd import ray from ..core.backends import create_network from ..utils import io from .. import simulation as sim __all__ = ["SimulatorActor", "setup_ray"] @ray.remote class SimulatorActor(sim.Simulator): def __init__(s...
cd05bb4fa151dad622d23f617340774320d4705b8d0eea881647d80a8a21369e
Python
1,957
51
# Copyright (c) Facebook, Inc. and its affiliates. # -*- coding: utf-8 -*- import copy import os import tempfile import unittest from torch.hub import _check_module_exists from detectron2 import model_zoo from detectron2.utils.logger import setup_logger from detectron2.utils.testing import get_sample_coco_image try:...
34ad9562b09571a59f1d22e2f5b5446da3e0109158ceb027dbb3d286d1bfa62d
Python
1,958
52
#!/usr/bin/env python # Copyright 2016-2022 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...
752a641d75a6b368fd3e5f18271dd69ce48a5c76b7050889a02bfd8f2a18307d
Python
1,959
51
#!/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...
32c7d22c964211ba4ee481eb7a62bc915dbd9c63e8acd1ee075bd05224bcd6a8
Python
1,961
74
'''This file contains functions that can be applied to discrete signals into bins with different strategies.''' import numpy as np def adaptive_binning(source, n_bins): ''' Binning the signal into bins with equal number of data points (adaptive binning). Parameters ---------- source : np.nd...
c6cdf1690284a1d878da293893ef5b5558f62e0bde007d4067a8f2603d721a6b
Python
1,961
83
""" Changs's method {chang2005automatic, title={An automatic method for estimating noise-induced signal variance in magnitude-reconstructed magnetic resonance images}, author={Chang, Lin-Ching and Rohde, Gustavo K and Pierpaoli, Carlo}, booktitle={Medical Imaging}, pages={1136--1142}, year={2005}, organization={Interna...
9dbc47c4c6ee3afe2f3146c6b5d94bb2425ffb1ad7580b691ba07d1a5e6f7786
Python
1,962
59
import pygame, time, random, Numeric, pygame, pygame.sndarray sample_rate = 44100 def sine_array_onecycle(hz, peak): #Compute one cycle of an N-Hz sine wave with given peak amplitude length = sample_rate / float(hz) omega = Numeric.pi * 2 / length xvalues = Numeric.arange(int(length)) * omega return ...
88b17c0fc612240caf84f100e7c2dbcaa16131e74f17ae996bf0449d123d7651
Python
1,963
66
import math class BasePIController(): def __init__(self, expected_kl: float, init_beta: float = 0., beta_min: float = 0., Kp: float = 0.01, Ki: float = 0.0001): assert init_beta >= beta_min, \ f"beta(0) ({init...
5b344313ef5548e64403fc4178838ed8ef24cc38c1cf03cf30388a6753136cd6
Python
1,974
86
""" Wrapper functions to more user-friendly calling of certain math functions whose output data-type is different than the input data-type in certain domains of the input. """ __all__ = ['sqrt', 'log', 'log2', 'logn','log10', 'power', 'arccos', 'arcsin', 'arctanh'] import numpy.core.numeric as nx ...
4880c7d9926a13416fdd9256baf83ef85385170f60bc952e0a89742305f56b36
Python
1,976
48
from detectron2.config import LazyCall as L from detectron2.layers import ShapeSpec from detectron2.modeling.box_regression import Box2BoxTransform from detectron2.modeling.matcher import Matcher from detectron2.modeling.roi_heads import FastRCNNOutputLayers, FastRCNNConvFCHead, CascadeROIHeads from detectron2.layers.b...
62754ca4b73d92648a9deda14e0cc7164fae9be05a8cd1e0d40f55b6b4b7a24b
Python
1,976
39
#python peptideGroupsMQDIANNcombine.py L:\promec\TIMSTOF\LARS\2025\250319_Alessandro\combined\txt\peptides.txt L:\promec\TIMSTOF\LARS\2025\250319_Alessandro\DIANNv2\report.pr_matrix.tsv #!pip3 install pandas matplotlib --user import sys if len(sys.argv)!=3: sys.exit("\n\nREQUIRED: pandas; tested with Python 3.12 \n\nUS...
6fef288222527d31354d25bc28f7e7b0e0ed8aaeabeb573dd9d079775db7c875
Python
1,976
71
# # Copyright (c) 2021 10X Genomics, Inc. All rights reserved. # """Define the pipeline mode for spatial imaging subpipeline.""" from __future__ import annotations from enum import Enum from typing import NamedTuple class Product(str, Enum): """Product being analyzed.""" VISIUM = "Visium" CYT = "CytAs...
b35ea48a8a7c9ac24f2e428f52ad7f3c0fbb6302a4224d66b3d600e6727856d7
Python
1,976
60
from __future__ import annotations import os import sys from pathlib import Path APP_NAME = "smiles2docking" def is_frozen() -> bool: return bool(getattr(sys, "frozen", False)) def is_appimage() -> bool: return bool(os.environ.get("APPIMAGE")) or "/.mount_" in str(Path(__file__).resolve()) def user_data...
9068d792d0caa9efc55d14c37ad6495dd11f75c90daa5d99a4d14dcdb2a59f37
Python
1,979
59
from configargparse import ArgumentError, ArgumentParser import numpy as np import pandas as pd import pytest from chemprop.cli.common import process_common_args, validate_common_args from chemprop.cli.train import TrainSubcommand, process_train_args, validate_train_args @pytest.mark.parametrize( ("external_data...
bf8127d7505393714620af8eec0c51b16615543816e1ecff58b7c298b2426406
Python
1,980
66
import os import shutil import pandas as pd import numpy as np import smma.src.utilities as utilities import napari import functools from skimage import io from loguru import logger logger.info('Import OK') input_folder = utilities.locate_raw_drive_files( input_path='raw_data/raw_data.txt') output_folder = 'resu...
b9778f8749e6c351c4638f89ee1b437f6bc20b50f32e1b5c42f329cad77a7e4a
Python
1,981
59
import pytest from openff.utilities.testing import skip_if_missing from openfe.setup import LigandAtomMapping from openfe.utils.visualization_3D import view_components_3d, view_mapping_3d @pytest.fixture(scope="module") def maps(): MAPS = { "phenol": {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8,...
99b51795bbb5193440fb0314ba5c2f6700625150241cc96b647cf75efd35f33c
Python
1,983
62
from dataloader import DataLoader from pathlib import Path import os def load_data( data_folder, server_mount_drive="S:", get_recording=True, make_folder=True, load_sorting=False, save_folder_name=None, first_N_files=4, ): dataloader = DataLoader( data_folder, ma...
ea1132bf5d71d222ce46fb9dbec9d5f39157a6d1c9cbd16e9be8ca02c0126488
Python
1,984
51
import numpy as np from brainspace.gradient.alignment import procrustes_alignment, ProcrustesAlignment def test_alignment_options(): rs = np.random.RandomState(0) # Create two datasets that are just shifted and scaled versions of each other d1 = rs.randn(10, 5) # Shift and scale d2 shift = 5....
4b3eccc62b630dbc541978aa75bfb602119a135125897842181c322c2c911470
Python
1,985
79
############################################################################ # Copyright (c) 2024-2026 University of Helsinki # # All Rights Reserved # See file LICENSE for details. ############################################################################ import sys from enum import IntEnum class IsoQuantExitCode...
ef9298623ad94b45660a495e44af9b95355af1f25150b4857b953001c9cee22f
Python
1,987
59
"""Tests for multi-level and overlapping meta-agents.""" from mesa import Agent, Model from mesa.meta_agents import MetaAgents def test_overlapping_meta_agents(): """An agent can belong to multiple meta-agents simultaneously.""" model = Model() meta_agents = MetaAgents(model) agent1 = Agent(model) ...
f08d93e854abf6363d442dd6ffa7a6b0a2a8f8d190e0d3a2c7508fe29971481d
Python
1,991
67
""" Created on Wed Jun 25 14:49:00 2025 @author: dcupolillo """ from PyQt5.QtCore import Qt from PyQt5.QtWidgets import ( QMainWindow, QAction, QMenu, QDialog, QVBoxLayout, QHBoxLayout, QLabel, QSpinBox, QPushButton, QApplication, QWidget) from PyQt5.QtCore import pyqtSignal from pyqtspinner import Waiting...
8abff14b2b7e27abe5ce0d92f3186110a909a77c101de9c28db4e231200a5598
Python
1,993
70
""" This script crawls the package space and generates .md files in the references directory of the mkdocs site. For example: ``` # side/reference/connectivity/adjacency.md ::: connectivity.adjacency ``` It also generates a SUMMARY.MD file that contains the navigation structure of the generated .md files. We then use...
14bbb15b4bd6b29de691b32d89942b7f57135d75450061d43172a822263e96d8
Python
1,995
64
import pytest from src.structure_generation.builder import StructureBuilder, StructureGenerationError def test_prefers_mmff_when_available() -> None: builder = StructureBuilder( { "embed_seed": 61453, "max_attempts": 2, "optimize_geometry": True, "force_fie...
8ce40e5cf6a7c8fd8e98544b58f312850f7716c1ca8c0f37d64dc856f462bb8c
Python
1,995
51
import numpy as np import pandas as pd from hsnn.analysis.measures import _summarise_information def _frame(values: dict[int, list[float]], sides: list[str]) -> pd.DataFrame: return pd.DataFrame.from_dict( values, orient="index", columns=sides ).rename_axis("nrn") def test_summarise_information_pre...
253a327543f8a7cba7dc6a56d46eba88123f29e6b184a15b1ee362cc42b6a038
Python
1,999
53
import os import argparse import glob import pandas as pd if __name__ == "__main__": parser = argparse.ArgumentParser(description='This script processes NIfTI files in a directory. It extracts relevant parts of the file name and creates a DataFrame.') parser.add_argument('-i', '--input', required=True, help='P...
01abb8dc385d60182507c2743b4baaa6e970beec7fe831c53c3521eab53970a0
Python
2,003
53
# Copyright (c) Facebook, Inc. and its affiliates. import unittest import torch from detectron2.structures.masks import BitMasks, PolygonMasks, polygons_to_bitmask class TestBitMask(unittest.TestCase): def test_get_bounding_box(self): masks = torch.tensor( [ [ ...
548468625f134354ea1b9c4829ab0af369591769ef43994e3bc2c4ec9e2c4ed1
Python
2,004
56
from __future__ import annotations import pytest from src.protonation.dimorphite_adapter import DimorphiteProtonator from src.protonation.factory import ( NullProtonator, ProtonationError, build_protonator, ) from src.protonation.openbabel_adapter import OpenBabelProtonator def test_build_returns_null_w...
b6d3458d6b589b18eb72e6ef71f1717a86532c9a4ffcb8ba5f035db6df3a48c2
Python
2,004
50
#!/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...
b7f57297e75d11743904125bf5e0509e1d8d54cc50385f8cbd347ecb18bb4042
Python
2,012
66
from itertools import chain from typing import Iterator, Optional import numpy as np from torch.utils.data import Sampler class SeededSampler(Sampler): """A :class`SeededSampler` is a class for iterating through a dataset in a randomly seeded fashion""" def __init__(self, N: int, seed: int): if ...
551cbc938e8c1e64089a73c52145e438e531724bb5ad241b43a056cece72b43e
Python
2,013
47
#!/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...
b8951b750d243b37cd67a597a459dafc92747e2f6823d8a4ecb80bc210d9fd8d
Python
2,014
63
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # -*- coding: utf-8 -*- import argparse template = """<details><summary> install </summary><pre><code>\ python -m pip install detectron2{d2_version} -f \\ https://dl.fbaipublicfiles.com/detectron2/wheels/{cuda}/torch{torch}/index.html </code><...
4ac4db1b3d54fc62d25241d5fa1827d81d7311e252bf4b9312e175d4c0dd007a
Python
2,017
49
# Copyright (c) Facebook, Inc. and its affiliates. import logging from detectron2.modeling import ROI_HEADS_REGISTRY, StandardROIHeads @ROI_HEADS_REGISTRY.register() class PointRendROIHeads(StandardROIHeads): """ Identical to StandardROIHeads, except for some weights conversion code to handle old models....
50e223d8e5c292fe84716e0c2256694c2581fc27ad9943223fe389ddfe1ee02c
Python
2,017
68
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from plugcli.params import NOT_PARSED, MultiStrategyGetter, Option def _load_molecule_from_smiles(user_input, context): from rdkit import Chem from openfe import SmallMoleculeComp...
5a6716e04d2fefa36ea32130c0568c6632c69db751f6885b81f58e0813592a48
Python
2,018
62
""" Batch recompute session_responses.pkl for all control sessions that have analyzer_final.zarr after stage 3 merge. """ import sys import os import time import traceback from pathlib import Path PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) if PROJECT_ROOT not in sys.path: sys.path.i...
b2bb7d6794c5cb311852084df35f1885128399ea0323d0ef7cd700ef7dc55992
Python
2,023
66
import dominate from dominate.tags import * import os class HTML: def __init__(self, web_dir, title, image_subdir='', reflesh=0): self.title = title self.web_dir = web_dir # self.img_dir = os.path.join(self.web_dir, ) self.img_subdir = image_subdir self.img_dir = os.path.jo...
7d13111a41d3dcf5a1cf0619f83bb75a914bac7367f296584b1a913216c73549
Python
2,024
77
# emacs: at the end of the file # ex: set sts=4 ts=4 sw=4 et: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### # """ Stub file for a guaranteed safe import of duecredit constructs: if duecredit is not available. To use it, place it into your project codebase to be imported, e.g. copy as ...
6407f26064231f8dee6bb7be728926cdf57bbdf4bfd267b2c933cbd9a96bad04
Python
2,028
57
from typing import List, Sequence import numpy as np import xarray as xr from .managers import MonitorContext, StateContext, ClampContext from ..core.interfaces import INetwork from .. import ops def flush(network: INetwork, duration: float): network.clear_input() if duration > 0: with ClampContext(...
9dfd463ccf03440b73cf8990347766b6854533b041442988c8beab166fe722ef
Python
2,029
66
import tensorflow as tf import numpy as np import math import json def uniform(shape, scale=0.05, name=None): initial = tf.random_uniform(shape, minval=-scale, maxval=scale, dtype=tf.float32) return tf.Variable(initial, name=name) def glorot(shape, name=None): init_range = np.sqrt(6.0/(shape[0]+shape[1]...
430e4bec6492dd1f051dd7da691c451941ce8e46c8d01b32b2576085a8cf807d
Python
2,031
88
from matplotlib.markers import MarkerStyle from mesa.examples.basic.boid_flockers.model import BoidFlockers, BoidsScenario from mesa.visualization import Slider, SolaraViz, SpaceRenderer from mesa.visualization.components import AgentPortrayalStyle # Pre-compute markers for different angles (e.g., every 10 degrees) M...
0d8acc665a931f9590f922acee38f04434bdcd13621522e0a44e12d25287ec27
Python
2,034
93
import numpy as np import pytest from rdkit import Chem from chemprop.featurizers import MultiHotBondFeaturizer SMI = "Cn1nc(CC(=O)Nc2ccc3oc4ccccc4c3c2)c2ccccc2c1=O" @pytest.fixture(params=list(Chem.MolFromSmiles(SMI).GetBonds())) def bond(request): return request.param @pytest.fixture def bond_types(): r...
7dbd2a77620e467d643dad27ff8d8df55d0b3d058bbe9a226c9d5f0793d8329d
Python
2,039
52
import requests # for making requests to the API import json # for parsing text responses to json import pandas as pd # for parsing a JSON response object into a Pandas DataFrame def get_token(email_address, secret): url = ("https://analytic.tbportals.niaid.nih.gov/api/Token?" + f"emailAddress={email_addre...
6c0209a5d72c2a6636b5f63477ba00cabbd0fd1e8dd737726237d39040988d9f
Python
2,040
69
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. import glob import os from setuptools import find_packages, setup import torch from torch.utils.cpp_extension import CUDA_HOME, CppExtension, CUDAExtension def get_extensions(): this_dir = os.path.dirname(os.path.abspath(__file__)) exte...