sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
dbe6aff662423ffa5982de69354150a0fc64928e110cc5b7608fe9664450e56b
Python
4,869
132
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2019-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. ############################################################################ ...
5c10049d92eb01cd5bb2f8adbd3ec734ec09d0608bcaea8441d01e02fa141d72
Python
4,870
101
# -*- coding: utf-8 -*- """ Concatenate parcellated PET images into region x receptor matrix of densities. """ import numpy as np from netneurotools import datasets, plotting from matplotlib.colors import ListedColormap from scipy.stats import zscore from nilearn.datasets import fetch_atlas_schaefer_2018 path = 'C:/U...
26b8cedf3d1f013b0465a1828e62eb623d677eb6efa67a5d3989f4f6c7c29f1c
Python
4,872
137
from typing import Any, Iterable, Optional, Sequence import numpy as np import numpy.typing as npt import pandas as pd import xarray as xr from hsnn import ops from ._types import RatesArray, OccurrencesArray __all__ = ["attach_labels", "infer_rates", "infer_occurrences"] def _copy_attrs(src: xr.DataArray | xr.Dat...
72771b72b9010e059538af4ad81de96c9ccaee7edfc79e548a3beead812e04d2
Python
4,875
171
import importlib.resources import pathlib import shutil import urllib.request import click from plugcli.plugin_management import CommandPlugin from .utils import write class _Fetcher: """Base class for fetchers. Defines the API and plugin creation. Parameters ---------- resources: Iterable[Tuple[st...
c375b78fbc6a3feafe4924fa1f61aeadf023b2924b433697cc54419853754170
Python
4,875
148
from __future__ import annotations from collections.abc import Iterable, Mapping, Sequence from enum import Enum from pathlib import Path from typing import Generic, Protocol, TypeAlias, overload from typing_extensions import Self, TypedDict, TypeVar from snakebids.utils.containers import MultiSelectDict _T_contra ...
3d9b3cece5d61faf7cdacac49d33fc8a16cc5e54f103b76218c8ce5b1b6b4e0f
Python
4,876
61
import argparse def main(args): import glob import random import numpy as np import json import itertools with open(args.input_path, 'r') as json_file: json_list = list(json_file) homooligomeric_state = args.homooligomer if homooligomeric_state == 0: tied_lis...
2928c360260a3f001b5550ecf5b709f20be7abde9b436ece9bd61c616bcb245f
Python
4,879
144
""" Wolf-Sheep Predation Model ================================ Replication of the model found in NetLogo: Wilensky, U. (1997). NetLogo Wolf Sheep Predation model. http://ccl.northwestern.edu/netlogo/models/WolfSheepPredation. Center for Connected Learning and Computer-Based Modeling, Northwestern Univ...
e5f37e0b219effdb7581456df1d10de90111071986018568d5b546e7fc125a54
Python
4,881
114
#!/usr/bin/env python3 """Records the positions bcftools dropped before AccuSNV ever saw them, and why. The candidate positions AccuSNV works from are whatever survives two gates in the mapping stage: ``bcftools view -v snps -q <variant_min_af>``, which writes the variant VCF, and the FQ cutoff in variants2positions. ...
333d26eaea49c177d19747dde6f14c4defed796e29337f027b587d5c3fc8d2ef
Python
4,885
117
import pytest import numpy as np import pandas as pd from omegaconf import DictConfig, OmegaConf from hsnn.core import NeuronClass, SynapseClass, Projection from hsnn.core._brian2.network import SpatialNet from hsnn.core._brian2.testing import assert_netstate_equal from hsnn import pipeline def test_spnet_restore(c...
c33eca26e8d13618ed030cc9874b14e36e76d2f11e2ba7f951bd6d24e2efc1a2
Python
4,889
186
# Script that makes use of more advanced feature selection techniques # by Alejandro Lopez, 2026 import copy import numpy as np import sys import pandas as pd from sklearn.linear_model import LassoCV from sklearn.neural_network import MLPClassifier # used for normalization from sklearn.preprocessing import Normaliz...
3fc134b8226926edb280c9e7c2ac43ba47fd0ddec9eea138c04ecbbde2994955
Python
4,890
114
import argparse from .recon import Recon from .logconfig import setup_logging from .runtime import configure_runtime DESCRIPTION = """ Version Dec 01st, 2025 - by Z.Z : Pipeline to reconstruct MRI image with motion correction (TCL + GRAPPA + NUFFT)\n\n. Usage: mocokit i /path/to/folder/dat -...
4b4c0725e6007f85306121b560dd591eb1edd4c7edd72d61bcd1d1a5680bd5b7
Python
4,890
187
# Script that makes use of more advanced feature selection techniques # by Alejandro Lopez, 2026 import copy import numpy as np import sys import pandas as pd from sklearn.linear_model import LassoCV from sklearn.neural_network import MLPClassifier # used for normalization from sklearn.preprocessing import Normaliz...
5bd5947fa8259123b065b931b32480945811bd06aa0d00a8c2bd13b99fde3e04
Python
4,900
145
# 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...
08da527a9bacd6c6c38905ea35f713a86df1d7b41b9385993e2eec77f1e2c389
Python
4,902
131
"""Population coupling -- all animals including ICMS83.""" import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import pandas as pd import pickle from scipy.stats import mannwhitneyu f...
7d80409931ef5d5bf2f56ff43dc77e57121673014c30481949c8c0d2c15c3349
Python
4,902
124
#!/bin/python """ Script for registering and processing ASAP snRNA-seq samples for the Putamen (PUT) region. Workflow steps: 1. Load the region-specific sample sheet and post-QC samples. 2. Register samples with the trusTEr `Experiment` object. 3. Quantify gene expression with CellRanger/STAR. 4. Set output directorie...
911caa05e1c6569dc52b573a76bf78c24e86687631c5af742c2bb95d24184b08
Python
4,904
121
"""Portrayal Components Module. This module defines data structures for styling visual elements in Mesa agent-based model visualizations. It provides user-facing classes to specify how agents and property layers should appear in the rendered space. Classes: 1. AgentPortrayalStyle: Controls the appearance of individua...
27d0f525c47d4ece8798f4a863c755a30529db520b759345291500b2e0477208
Python
4,905
132
import os import sys from torch.utils.data import Dataset, DataLoader from argparse import Namespace from torch.optim.lr_scheduler import ExponentialLR import torch.nn as nn import torch as tc import optuna sys.path.append(os.path.abspath( os.path.join(os.path.dirname(__file__), '../'))) from src.utils import * c...
0892312978d73130b853e3e12e163c9868b06ae7259716e8e4452fa3d1e1a4a2
Python
4,911
151
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. """ PointRend Training Script. This script is a simplified version of the training script in detectron2/tools. """ import os import detectron2.data.transforms as T import detectron2.utils.comm as comm from detectron2.checkpoint import Detecti...
3ea73723036d6f041307e1dc29a55e508a43e0011540d9956f8605212c33813b
Python
4,917
128
#!/usr/bin/env python3 ############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2019-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. #######################################################...
98bd3c066f894e90daea92a93d4819776263c1893cdd2eee6de5a19808a2ee8a
Python
4,917
192
# /// script # [tool.marimo.runtime] # auto_instantiate = false # /// import marimo __generated_with = "0.23.13" app = marimo.App(width="medium") @app.cell def _(): #curl -LsSf https://astral.sh/uv/install.sh | sh #uv self update #uv init #sudo apt install nginx -y #sudo ufw allow 2718/tcp #...
bfa546f0cb0a9c1eb16cc7b160e96163ffc3eacb56be70fc6a8ee1ff355248c3
Python
4,926
125
from typing import Sequence import numpy as np import pandas as pd from hsnn.analysis.png import PNG from hsnn.analysis.png.refinery import Connected __all__ = ["filter_valid_hfb_triplets"] def filter_valid_hfb_triplets( pngs: Sequence[PNG], syn_params: pd.DataFrame, ) -> tuple[list[PNG], dict]: """Filt...
6ee243b6e14c058653694885374db66e0ac5f4622554bf59c6c44c15350e5b20
Python
4,934
124
#!/bin/python """ Script for registering and processing ASAP snRNA-seq samples for a specific brain region. Workflow steps: 1. Load the region-specific sample sheet and post-QC samples. 2. Register samples with the trusTEr `Experiment` object. 3. Quantify gene expression with CellRanger (or STAR if needed). 4. Set out...
722977afb2971ec26c49ee04b7a04d1951235be81ccd8ab619c6cd4973397b01
Python
4,944
167
import argparse import getpass import os import numpy as np import torch import yaml from himalaya.backend import set_backend from utils import get_git_hash ELEC_SIGNAL_PREPROCESS_MAP = { "podcast": dict.fromkeys( [ "661", "662", "717", "723", "7...
dcab514a407520388ce38857a4a74c2f329771f8701c31d9b870733a4124145c
Python
4,944
127
#!/usr/bin/env python # Copyright 2016-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 obt...
5b1218d031083a4c54f472fc626b758409daf0b68a9e77aea3d95c3f82f3c69c
Python
4,945
177
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ # serialization stuff ENCODING = 'utf-8' BYTE_ORDER = "big" ST...
f03d7cfe710b0ed02c8da5432a1bfdaa3eb9439d3e47ae206bd0f126cadfe970
Python
4,945
159
import re from pathlib import Path import click import click_log import numpy as np import tifffile import xtiff from ... import io from ..._cli.utils import OrderedClickGroup, catch_exception, logger from ..._steinbock import SteinbockException from ..._steinbock import logger as steinbock_logger from .data import a...
438b0a687a2c0a66a619b53d733ceb5e80aaa702d53e5be83d4634ecf5eba03d
Python
4,948
137
""" core/bursts.py -------------- Network burst detection and active-area computation. Works on flat spike-time arrays — no file I/O. """ import numpy as np import pandas as pd from typing import Dict # ── Network burst detection ──────────────────────────────────────────────────── def detect_network_bursts(all_spik...
f90caebab82d0cbdc82350dc42a3d15bf49ddc6f9596ba0513a67ca41c44b274
Python
4,949
142
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 . import config from .utils.activation_manager import ActivationManager from .utils.pgd_attack import AttackParams f...
bda26dcbc6e4139712e80e0bbc0b75b051e4912f70cdc7c07a8a84db34ef2791
Python
4,950
124
#!/bin/python """ Script for registering and processing ASAP snRNA-seq samples for the Prefrontal Cortex (PFC) region. Workflow steps: 1. Load the region-specific sample sheet and post-QC samples. 2. Register samples with the trusTEr `Experiment` object. 3. Quantify gene and TE expression with CellRanger/STAR. 4. Set ...
d5bcb38eb429b101c1fbef7df22e1b72674e1d57f46b98179b5f74194df12fd9
Python
4,955
119
import os import time import matplotlib.pyplot as plt import numpy as np from matplotlib.lines import Line2D import matplotlib.colors as mcolors from matplotlib.animation import FuncAnimation, PillowWriter, FFMpegWriter from tristan_pipeline.utils.plotting_utils import * from tristan_pipeline.io.params import * spaces...
e674728ba68cdad05d860e1b2054fba8c66187f0fe4aaed5dd8860e5ec608c43
Python
4,956
156
"""File globbing functions based on snakemake.io library.""" from __future__ import annotations import collections import os import re from collections.abc import Sequence from itertools import chain from pathlib import Path from snakebids.types import ZipList from snakebids.utils.containers import MultiSelectDict ...
ad0309648acdad9820c73446879ef35d81219d04ca5b2945402bb72d54ab4a0f
Python
4,959
145
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import json import pathlib import click from openfecli import OFECommandPlugin from openfecli.utils import configure_logger, print_duration, write def _format_exception(exception) -> str...
2500746ffb0dc9c0c4ad7508cf2cd74d90d0d570399486108fd80b0ce00e3962
Python
4,964
141
from __future__ import annotations import logging from pathlib import Path from types import SimpleNamespace import uuid import pytest from rdkit import Chem from src.utils.models import MolecularRecord from src.workflow import pipeline class _FakeSource: def __init__(self, settings: dict) -> None: sel...
90881b9ed026a4d9e1e565284722041faf3c27922a4522a2793fd7b48aa9672a
Python
4,966
161
#!/usr/bin/env python3 # ############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2020-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. #####################################################...
35e3b059b998dea06b17e0e1807cfbf3e87cd9a42ea370a2cc13aeaf29953b00
Python
4,967
113
import nibabel as nii import numpy as np import argparse import os import glob import csv import sys # Added import statement for sys module sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))) from common.artifact_manifest import start_output_tracking from common.script_logging imp...
0c9bf13cc26aaec8af6e08d0e8ce73feb3e7e6d0c68498762efc5c574b8629b9
Python
4,976
134
#!/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...
d1b984c9558284ffd9baf1420497f0062ba3b91bbfc5594f1f9a47ea95edab91
Python
4,982
149
#!/usr/bin/env python # # Copyright (c) 2021 10X Genomics, Inc. All rights reserved. # """Functions for refatoring report_matrix.py. right now, computes only median confidently mapped reads per singlet per genome """ from __future__ import annotations from typing import TYPE_CHECKING # pylint: disable=too-many-form...
91612138128c74773ad31adf651f5db6249eaa8a32b07edd84f78a07ca6113e9
Python
4,984
142
import seaborn as sns import matplotlib.pyplot as plt import pingouin as pg import mne import numpy as np import arviz as az def plot_ridge(df, variable_name, values, pal, plot_order=None, xlim=(-1,1), aspect=15, height=0.5): '''Pretty ridge plot function in python. This is based on code from https://seaborn....
12e895f38f77604ebabebcb6713d6f7fbb27d591beb056bffb634a22cd2ad58d
Python
4,994
111
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: ...
e243975a3c2fd4b524d63c64110df05a825ba75095cda155f3885b47b401d6a3
Python
4,996
177
#python pepProtMap.py peplist.txt A0A8C5CNW5.fasta #python pepQuanProtMap.py "L:/promec/TIMSTOF/LARS/2026/260908_Moreforsk/combined/txtLen/peptides.txt" "A0A8C5CNW5" #python pepQuanProtMap.py "L:/promec/TIMSTOF/LARS/2026/260908_Moreforsk/trŧpsin/combined/txtLen/peptides.txt" "A0A8C5CNW5" #cat L:/promec/TIMSTOF/LARS/202...
1cf57ef0050642943402ea29bccb1fc1e48d14a518401a7d12c91d89b8010aba
Python
4,998
122
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ # Regression test for duplicate exon/intron count rows. # # A ...
7554c4d78115cf9d4ec371ca74dec3e8b25fcb56142969d8a9208f27cbec8026
Python
5,000
92
import os import numpy as np import pandas as pd import umap import matplotlib.pyplot as plt import matplotlib import anndata as ad import scanpy as sc import scvelo as scv import scanpy.external as sce from scipy.io import mmwrite, mmread import scipy import sys sys.path.append("/home/nomura/Proj/mmvelo/src") from mmv...
86ccbb7f7506edd7857a06277e8bc4a859822f398c6ad8f64f6c81ca6d048e7c
Python
5,003
105
import os import socket from typing import Any, NamedTuple, Optional, Tuple import torch import torch.distributed as dist class DDPTopology(NamedTuple): local_rank: int # index of this process within its node -> this is the CUDA device index! global_rank: int # index of this process within the entire job (...
bd71e68ba36d41863b0a0d65a34a91744286faf0b38704695c113f3feba7e149
Python
5,004
157
import numpy as np import optuna from torch.utils.data import DataLoader import json import argparse import torchvision.transforms as transforms import torch from . import config from .utils.condition import TuneCondition from .utils.model_utils import load_model from .utils.pgd_attack import AttackParams from .utils...
5f125a9dd8cb91bb67ea7f41dde17c71b1e5620fc43fcada71d7320b4a673c42
Python
5,005
152
"""Configuration management for imaging datasets. Created on January 21, 2026 @author: dcupolillo """ from __future__ import annotations from pathlib import Path import yaml import tensorflow as tf class ImagingDatasetConfig: """ Configuration manager for imaging dataset processing. Handles all con...
6c07abbef302e171062dbb8d9c29847e53bc67dc54e470d423b49ecef5c2a43b
Python
5,006
133
"""Fig 4D: Stim vs non-stim waveform overlay and centroid distance.""" import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import seaborn as sns from sklearn.decomposition import PCA ...
ec4c8d0d5c187c8bd6515eb27ed82b58ab221700858d4c5f61d5eb6bfe09aa34
Python
5,007
130
#!/usr/bin/env python3 """Regenerate per-image ``*_NMJ_Plot.png`` files for an existing batch run folder. Re-reads source images from ``data/`` using the run snapshot ``channel_mapping_config.json`` and parameters from ``run_config.json``. Does not rewrite CSVs or aggregate summaries. Example:: python regenerate...
ef192ec75f0d8bc5722a8e3ad3c2910f2d5607ba02b5a076e20efb5edb6a09d4
Python
5,008
132
# Copyright (c) Facebook, Inc. and its affiliates. import os import torch from detectron2.utils.file_io import PathManager from .torchscript_patch import freeze_training_mode, patch_instances __all__ = ["scripting_with_instances", "dump_torchscript_IR"] def scripting_with_instances(model, fields): """ Run...
9d69a09710a14d0cc2600a11c0c427fe91e0f5e216f225d66f5825c49d6e889b
Python
5,009
145
from __future__ import annotations import warnings from pathlib import Path import pytest from pytest_mock import MockerFixture import snakebids.paths._templates.spec_func as spec_template from snakebids.paths import bids_factory, specs from snakebids.paths._config import reset_bids_spec, set_bids_spec from snakebid...
f295f2584a55b1155a1b7d944c0f4e97f17421108e1296d6785c89c8ac5fd9a9
Python
5,009
110
"""Run all scripts that reproduce the paper's figures and statistics. Each script in SCRIPT_ORDER is run in a subprocess from the repository root; figures land in plots/, statistics logs in logs/, and each script's full stdout/stderr in logs/runner/<script>.log. See the README for the script-to-figure mapping. Total r...
c77d1e98f183ce4a77d56217735e01c0f2f78123d4e42c05e7bc076ddbc54601
Python
5,011
140
import os import pkgutil import unittest from tempfile import TemporaryDirectory from textwrap import dedent from unittest.mock import patch from nnunetv2.utilities.find_class_by_name import recursive_find_python_class from nnunetv2.utilities.find_objects import recursive_find_trainer_class_by_name def _write_file(p...
8920e142c43ff48430bbcc74dc2f1b582a58640e123401f2d772020698a20a8f
Python
5,017
158
# Copyright (c) Facebook, Inc. and its affiliates. import math import numpy as np from unittest import TestCase import torch from fvcore.common.param_scheduler import ( CosineParamScheduler, MultiStepParamScheduler, StepWithFixedGammaParamScheduler, ) from torch import nn from detectron2.solver import LRM...
55912967c21c25f27d063dfdbfd7241ff00cea98629f9561f38fea36eea48a31
Python
5,018
144
import numpy as np import pytest from chemprop.data.collate import BatchMolGraph from chemprop.featurizers.atom import ( MultiHotAtomFeaturizer, RIGRAtomFeaturizer, get_multi_hot_atom_featurizer, ) from chemprop.featurizers.bond import MultiHotBondFeaturizer, RIGRBondFeaturizer from chemprop.featurizers.mo...
c99fff51d7023137698ec97d599b2dbfe04a9a46e204496ed43bdee70e38ba0d
Python
5,018
182
import sys from pathlib import Path import click import click_log import numpy as np import tifffile from ... import io from ..._cli.utils import OrderedClickGroup, catch_exception, logger from ..._steinbock import SteinbockException from ..._steinbock import logger as steinbock_logger from .. import cellprofiler @...
19ad91c0d0417bd9f21734c5cf7c7323a14a7fbfe6d0b43170f2bfd01b22344d
Python
5,021
191
# %% from __future__ import annotations import os import matplotlib.cm as cm import matplotlib.pyplot as plt import matplotlib.ticker as ticker import mne import numpy as np from matplotlib import font_manager as fm from matplotlib.gridspec import GridSpec from mne.io import BaseRaw from mne_bids import find_matching...
0a46c17b2d00efc03c1607175a78c0c3b63ec301af320b8fe0dd04ef00651837
Python
5,026
128
#!/usr/bin/env python # Copyright 2016-2019 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...
7f721a71592cacaf2d24257fa2d0b74ca9edade907287a78cfa1f3dee5347ea9
Python
5,029
123
import copy from pathlib import Path import joblib import matplotlib.pyplot as plt import numpy as np import torch from sklearn.decomposition import IncrementalPCA from .. import config from .decomposition_handler import DecompositionHandler, V device = torch.device("cuda" if torch.cuda.is_available() else "cpu") c...
8fc226b1707bb011e4ebc5431fa573eb9a6ab74caf499a0be2da13fb7c56d4c1
Python
5,032
82
from tristan_pipeline.io.params import * from tristan_pipeline.utils.loading_utils import * from tristan_pipeline.utils.preproc_utils import * from tristan_pipeline.utils.glm_utils import * from tristan_pipeline.utils.plotting_utils import * from nilearn.glm.first_level import FirstLevelModel import pandas as pd from ...
669831bc852e45642a8996b2cda7a4d3a5a9b791c24a755a23b966ae26fea8eb
Python
5,033
145
import torch.nn as nn from torch.autograd import Variable from function import adaptive_instance_normalization as adain from function import calc_mean_std decoder = nn.Sequential( nn.ReflectionPad2d((1, 1, 1, 1)), nn.Conv2d(512, 256, (3, 3)), nn.ReLU(), nn.UpsamplingNearest2d(scale_factor=2), nn.R...
305355d52b70f5ec11f638d0134aa36ca52cceea61c113f8380daf8cf6fdbefd
Python
5,035
182
from __future__ import annotations from enum import StrEnum import os from typing import Any, Callable, Iterable, Iterator, Type import multiprocess import numpy as np import psutil from rdkit import Chem class EnumMapping(StrEnum): @classmethod def get(cls, name: str | EnumMapping) -> EnumMapping: ...
7d2b87f731815019fe847033c1508656de2cdd8761e93acf970df5b9ca1a84fd
Python
5,039
128
# 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 ChemicalSystem, SolventComponent from rdkit import Chem from openfe.setup.chemicalsystem_generator.easy_chemicalsystem_generator import ( EasyChemicalSyste...
09e5a9877352cf504c8896de93eb29c156394c3eef1f4173246e63ea60e7c90a
Python
5,044
139
"""Throughput benchmark for SMILES2Docking. Measures wall-clock seconds to prepare N ligands at varying worker counts. Designed to support the scalability discussion requested by Reviewer #4. Usage: python scripts/benchmark.py --sizes 100 1000 --jobs 1 4 8 \ --input data/raw/zinc_sample.csv --protonation-...
bcfc1305f474b8a0b2da8e0f20819803fe7eb103e7bc2ba531d005c3e3575ebf
Python
5,044
127
import cv2 import numpy as np import tifffile import os import glob from scipy.ndimage import geometric_transform import tifffile import glob import numpy as np import matplotlib.pyplot as plt def generate_coupled_image(movie, frame, output): """ Generates an image from the previous frame of the given frame a...
c7f47656f5fc70d3babcf419f8b49aead39021b996ab292ece1d8950d3643fed
Python
5,044
109
# AUTOGENERATED! DO NOT EDIT! File to edit: 46_model_formulas.ipynb (unless otherwise specified). __all__ = ['AdditiveFormula', 'additive_formula'] # Cell import numpy # Cell class AdditiveFormula(): """A class for parsing formulae defined over acceptor (A) and donor (D) splice sites \ and which provides...
3fe2c9ef13b74335910ae848f8b6cc232ff9f93b824f842bc6856baa9af2a429
Python
5,045
130
import os import sys import argparse import torch as tc tc.set_num_threads(1) from bptt import BPTT_cont from models import RNN_cont_Model from rnn.models import RNN_Model import rnn.dataset as dataset import numpy as np import re sys.path.append("..") from utils import * def get_args(): parser = argparse.Argumen...
586014c23564f7222c2487b46c91e571ca9d1b9acb67ea5275c0fcc8206e9b59
Python
5,050
103
import os 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) # peak-gene linkage matrix #dir_path = "/home/nomura/Proj/mmvelo/data/10x_multiome_b...
13c7600fbf6657bc88c869e948b2ff88744da6db04e170bc0cf9869661b1a4c3
Python
5,052
164
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. import logging import numpy as np from collections import Counter import tqdm from fvcore.nn import flop_count_table # can also try flop_count_str from detectron2.checkpoint import DetectionCheckpointer from detectron2.config import CfgNode, ...
dca64e54c4ca2319a2faf854581ae8fde8d4a87bf91b1c3557f256877a822471
Python
5,055
139
# # Copyright (c) 2019 10X Genomics, Inc. All rights reserved. # """Compute summary metrics from the filtered barcode matrix h5 and combine all basic summaries.""" from __future__ import annotations from typing import TYPE_CHECKING import h5py import martian import cellranger.report as cr_report import cellranger....
66e819edd1710520bb17c8dbc2b1db6e173129833d926790d02d592c2274b006
Python
5,056
108
# -*- coding: utf-8 -*- """ Fetching atlases and annotations ================================ This example demonstrates how to use :mod:`neuromaps.datasets` to fetch atlases and annotations. """ ############################################################################### # Much of the functionality of the ``neurom...
8d6546adb901a523ed42cda799bf8f2e5bf64efeef1b3ad035e0f72c9c2d9ce7
Python
5,063
120
from __future__ import annotations from dataclasses import dataclass from typing import Any from rdkit import Chem from rdkit.Chem import AllChem class StructureGenerationError(Exception): """Raised when 3D coordinate generation fails.""" @dataclass(slots=True) class StructureBuilder: settings: dict[str, ...
5a0e00a21f70efb25367c60449796a9e87376c432dd8565ebf8d50f732ff0a8c
Python
5,065
136
import os import re from itertools import product from pipelines import Stage from helpers import get_fmriname, get_taskname class ABCDTask(Stage): script = '{HCPPIPEDIR}/TaskfMRIAnalysis/TaskfMRIAnalysis.sh' spec = '--path={path} ' \ '--subject={subject} ' \ '--lvl1tasks={lvl1tasks}...
f96596183b0162d1a20dfdc970952ee8068f9347586277fa9a4c655c48886f60
Python
5,066
140
#!/usr/bin/env python # Copyright 2016-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 obt...
bf76ff62e585cd4d0ea54620d347d942d0bc98fe5cb0a90f4aa42cafeddb0948
Python
5,067
156
''' This file contains all of the implemented tranfromations. ''' import numpy as np from . import simulations import random def transf_amplitude(time_series, scale_factor): # TO FIX: Add docs string in here scaled = np.dot(scale_factor, time_series) return time_series, scaled def time_shift(time_ser...
0a08f2114e54626192104342f389486359faf4a3bbfc2893185017d149d843c1
Python
5,068
137
#!/usr/bin/env python3 import argparse import csv from collections import Counter def load_simple_mapping(file): """Load mapping from key -> value (2-column TSV).""" mapping = {} with open(file, newline='') as f: reader = csv.reader(f, delimiter="\t") for row in reader: if not r...
54c5e51a04ff486a5d00ed812be8a69481be2c2a16cc369023a33f83a5e187e1
Python
5,070
141
from copy import copy from typing import Any, Optional, Sequence import neo import numpy as np import pandas as pd import quantities as pq from elephant.spade import spade from hsnn.core.logger import get_logger from hsnn.core.types import SpikeEvents, SpikeTrains, SpikePatterns from hsnn.ops import conversion from ....
5600a397e60f7d9fba9d710bb9d6c00e8240fa39c319061b085f575d5c9021d2
Python
5,072
187
import numpy as np import random import torch import scipy import scanpy as sc import matplotlib.pyplot as plt import matplotlib.colors as mcolors from sklearn.metrics import pairwise_distances from sklearn.neighbors import kneighbors_graph # ====================== Data Preprocessing ====================== def norm...
86acd8cffd96e882571ddec96042a72170f353a405a676277a295363635a210e
Python
5,078
121
# Copyright (c) Facebook, Inc. and its affiliates. import copy import logging import numpy as np import time from pycocotools.cocoeval import COCOeval from detectron2 import _C logger = logging.getLogger(__name__) class COCOeval_opt(COCOeval): """ This is a slightly modified version of the original COCO API...
46a6e8468f204f26b3dad3bbca5515da8679ff46387ed294709dcc2d1e07cc90
Python
5,080
137
import os import shutil import time import gc import numpy as np import tifffile import bio_image_unet.siam_unet as siam import bio_image_unet.unet as unet from bio_image_unet import unet3d # create test folder with random training and test data from bio_image_unet.progress import ProgressNotifier folder = './temp_t...
7969191b552b45e8072e92323fc6e457b53ed6e5c4ebef212848022edadac574
Python
5,080
89
# residue atoms mean stdev impropers = [ ( 'ALA', ('C', 'CA', '+N', 'O'), -0.00019, 0.03160 ), ( 'ALA', ('CA', 'N', 'C', 'CB'), 0.59838, 0.01964 ), ( 'CYS', ('C', 'CA', '+N', 'O'), 0.00084, 0.03215 ), ( 'CYS', ('CA', 'N', 'C', 'CB'), 0.60237, 0.02852 ), ( 'ASP', ('C', 'CA'...
cfcdc3195b5236d970123472ddd3d363850c534f58b433439343d3bb4ade9779
Python
5,080
159
import numpy as np import pandas as pd from sklearn.inspection import permutation_importance from sklearn.metrics import average_precision_score, roc_auc_score from sklearn.pipeline import Pipeline from config import HELDOUT_BOOTSTRAPS, OPTIMISM_BOOTSTRAPS, PERMUTATION_REPEATS, SEED from models import fit_candidate ...
0754c1c2312251a4a860c43a796647a241b822a489ee2d8b703e196682b5c175
Python
5,082
158
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """Equilibrium Relative Free Energy Protocol input settings. This module implements the necessary settings necessary to run relative free energies using :class:`openfe.protocols.openmm_rfe.e...
e172c38f457b8e94af8face8b3545518fbe770fb58de13726dfcd5fc7644ebf5
Python
5,084
164
""" Persistence for generated molecules. Moved here from ``utils/io.py``: these functions are only ever used by the generation workflow, and keeping them out of the shared I/O module keeps ``pandas``-on-Excel work off the training import path. Each file-writing helper is a thin wrapper over a pure in-memory core (:fu...
fb0acd206c2765440978cfb612d45f69881b4a573922fd57606f5dbeabde9d9c
Python
5,087
154
from mesa.discrete_space import CellAgent, FixedAgent class Animal(CellAgent): """The base animal class.""" def __init__( self, model, energy=8, p_reproduce=0.04, energy_from_food=4, cell=None ): """Initialize an animal. Args: model: Model instance energy:...
ca058eef22cbc1a122356199a8c2aef77a5fc60c1cc6643ff4c3575d6083c4db
Python
5,105
117
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from typing import Any import torch from torch.nn import functional as F from detectron2.config import CfgNode from detectron2.layers import ConvTranspose2d from densepose.modeling.confidence import DensePoseConfidenceModelConfig from densepose.modeli...
d985ade0d6dceb784783f9a912ee26038b722196ed327d2734a34de54fc67585
Python
5,106
81
import pickle from rCPGswCPG.utils.gen_utils import get_project_root from rCPGswCPG.utils.utils import * from rCPGswCPG.model_params.config_loader import load_model_cfg_file, model_params_from_cfg from rCPGswCPG.Experiment import Experiment import numpy as np import os import pickle if __name__ == '__main__': mod...
1bde5a1ea0406e7b952909d4882a32161614c0a734fcaa2895f01ba48b20efe5
Python
5,110
98
##plotfrom 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 from scipy.signal import savgol_filter as sg if __name__ == '__main__': # ---- exper...
8af567af6196240f8692fc18a6e79c259ad4a78c215a64101e8fb3c4537b1bd5
Python
5,111
136
"""The run summary must make silent degradation impossible to miss. Three shipped failures all looked like successful runs: MFA falling back to CMUdict timing, Dr.VOT falling back to Praat for every token, and an old build being installed. The first two are what these tests pin down. """ import types import pytest f...
a7a62278735286fab8e3fd4390bb1bcb62afdbf77b8527fd71470ed257944672
Python
5,112
135
from mne.time_frequency import psd_welch from neurodsp.spectral import compute_spectrum, trim_spectrum import numpy as np import mne from warnings import warn def compute_spectra_mne(mne_data, freq_range): ''' Computes power spectra mne style using a sensible setup based on Gao et al. 2017 ''' #...
e018f23c59ecc31d2ef3817e81a60b45b879444b327e0089fb25aadac2379210
Python
5,118
147
# 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...
b913a910852d703a334e9f2865ad5b6d73d915816566f9b9813b5313ef7580cd
Python
5,130
183
import sys from pathlib import Path import pandas as pd import pytest from stoic_train.make_train_val_split import _parse_ids, assign_split, main def test_parse_ids_strips_and_drops_empty_values() -> None: assert _parse_ids("a; b ;; c ;") == ["a", "b", "c"] def test_assign_split_returns_expected_labels() -> N...
f5cdde0a69d12ddd010bfd995b43d0ce21df81cb26cf2393afa66239d4fcb851
Python
5,135
128
#!/usr/bin/env python3 """Builds and persists the canonical HFB annotation tables for a combination. Re-analyses existing significance-tested detections and post-trained recordings for a single representative trial, and writes three parquet tables under the trial checkpoint's ``reuse`` sub-directory: ``hfb_annotations...
cb4a35b2fbf9f3adf747fdafa57b333caaf382bed3fdd7c0060a04a8a8cf2b7f
Python
5,142
145
#!/usr/bin/env python3 """Portable launcher for RAVEN autoencoder training. The historical code used ``--resume`` for weights-only initialization. This wrapper names that behavior ``--init-checkpoint`` and exposes a distinct ``--resume-checkpoint`` mode for restoring Lightning training state. """ from __future__ imp...
441150cd8944ed7920b61367f53803245b0a7e1b075e295870ba808d26ed55f3
Python
5,148
131
"""Tests for the built-in NBLAST work-distribution helpers. `partition_grid` and `find_optimal_partition` only ever read the query/target *counts*, so we can exercise them with plain integers / lists standing in for NeuronLists - no neurons, scoring or timing required. """ import inspect import pytest from navis.nb...
c34f43df896ab59dcb7cc2e000157abbd552872deb0389e53218c469b47bf4bb
Python
5,151
148
""" Tests the easy start guide - runs plan_rbfe_network with tyk2 inputs and checks the network created - mocks the calculations and performs gathers on the mocked outputs """ import os from importlib import resources from os import path from unittest import mock import pytest from click.testing import CliRunner fro...
9770b4190303852a4f8f4af37c48da2ee424008f60db11d49f6f7d5d0b176d1f
Python
5,162
150
""" Test gradient maps """ import pytest import sys import numpy as np from scipy.sparse import coo_matrix from brainspace.gradient import compute_affinity from brainspace.gradient.alignment import (procrustes_alignment, ProcrustesAlignment) from brainspace.gradient import ...
5a5f5352daea2154618b8768662d02ff0858ce7e886f4898eb8dd462b4e07d1e
Python
5,166
125
#!../venv/bin/python import psql_wrapper as psql def number_of_admissions(cur): cur.execute('SELECT COUNT(*) FROM admission_targets;') return cur.fetchone()[0] def number_of_gender(cur, gender): cur.execute(('SELECT COUNT(*) FROM admission_targets T\n' 'LEFT JOIN admissions A ON T.admi...
b16add3e6612aa22f264e395bed684d9513e7aa15ae2c85878e1cbfe12e77159
Python
5,167
116
"""Statistical averaging with MAD outlier rejection.""" import numpy as np from .config import TAPAConfig def _mad_filter(values, threshold=2.0): """Median Absolute Deviation outlier filter.""" values = np.array(values) median = np.median(values) mad = np.median(np.abs(values - median)) if mad =...
5ba30fa0cf7f6fe1d84a9fa3ed583b3c6fcb7f498865e77666c2ad99fd7bc832
Python
5,169
170
"""Test Solara visualizations with Scenarios.""" import numpy as np import solara import mesa from mesa.examples.basic.boltzmann_wealth_model.model import ( BoltzmannScenario, BoltzmannWealth, ) from mesa.experimental.scenarios import Scenario from mesa.visualization.solara_viz import Slider, SolaraViz, _buil...
ed9811c9dffc4e79b7e3549124dcb837ef4ee2843195dd1186c21ac9b83a89af
Python
5,169
121
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe import random from typing import Optional, Tuple import torch from torch.nn import functional as F from detectron2.config import CfgNode from detectron2.structures import Instances from densepose.converters.base import IntTupleBox from .densepose_cse...
74c8505c1051696470664ab218c3da286822f3ec44758797091393c5328a6d4b
Python
5,174
176
# %% from __future__ import annotations import os import mne import numpy as np import PIL.Image from matplotlib import pyplot as plt from matplotlib.backends.backend_agg import FigureCanvas from scipy import interpolate from scipy.io import savemat from scipy.spatial import ConvexHull plt.rcParams['figure.max_open_w...