sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
e855f266f199aa8f1bf05d1bc1cacdabda8f284405c69d7e9057560f3f41dacd | Python | 2,644 | 82 | ############################################################################
# Copyright (c) 2025-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
from enum import Enum, unique
@unique
class IsoQuantMode(E... |
718e4f2f46ab255b47b88bae7f8cf2bd1dc5426246422b42c2e893b8aa7691c2 | Python | 2,646 | 81 | #!/usr/bin/env python3
"""
Generate inflated barcode whitelist files for testing large k-mer indexer paths.
Appends random unique DNA sequences to existing barcode files to push
the total count above 100K, triggering Array2BitKmerIndexer / Dict2BitKmerIndexer
in the universal barcode calling algorithm.
"""
import os
... |
ddef7452715ea70c768f1428abe8042d4e0a3c4a0cbc3c384d2c28a69123a4b6 | Python | 2,649 | 87 | #
# Copyright (c) 2025 10X Genomics, Inc. All rights reserved.
#
"""Create meta cells."""
import functools
import json
import operator
import martian
import numpy as np
from scipy.sparse import coo_matrix
from cellranger.cr_io import hardlink_with_fallback
from cellranger.matrix import CountMatrix
__MRO__ = """
sta... |
d7b4b02dde7f404a25ef8385d218228c3c98af361438f252409534f11c197a89 | Python | 2,650 | 77 | #!/usr/bin/env python3
import argparse
import sys
from tqdm import tqdm
import subprocess
# Argument parser
parser = argparse.ArgumentParser(description="Split input file into chunks by Reference, preserving Reference integrity.")
parser.add_argument("-i", "--input", required=True, help="Input file path")
parser.add_a... |
95a85c02a35f998ef15c3ce7ba94c2b2aeaf6771851224512e33d378eaedb1f0 | Python | 2,651 | 142 | """
VTK basic checks.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import numpy as np
from vtk.util.vtkConstants import (VTK_VERTEX, VTK_LINE, VTK_TRIANGLE,
VTK_QUAD)
from vtk import vtkCellTypes
def get_cell_types(surf):
"""Get cell type... |
c8f6120be8f12a500ac64eeb15632d5dab146d107e79146a57fdf896eb4844a9 | Python | 2,651 | 72 | #!/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... |
6c1b541a62b5be4b948e0f4874245610e6a5b76659df60558890efb339c10d1c | Python | 2,653 | 59 | import shutil
from batchgenerators.utilities.file_and_folder_operations import *
from nnunetv2.paths import nnUNet_raw
from nnunetv2.dataset_conversion.generate_dataset_json import generate_dataset_json
if __name__ == '__main__':
downloaded_amos_dir = '/home/isensee/amos22/amos22' # downloaded and extracted from ... |
2a82a95a0f72f2cf4d1c2b83ece8806ccd6e707135c4e1188fbb6966ac65bff4 | Python | 2,655 | 85 | """
Created on 17/03/2020
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
More information can be found here:
http://alleninstitute.github.io/AllenSDK/_modules/allensdk/api/queries/reference_space_api.html
"""
import os
import nrrd # pip install pynrrd, i... |
437e227c9cf4be012f5c330e6efd8def95c17842e5a413e20e932b1c20270b26 | Python | 2,655 | 67 | #
# Copyright (c) 2022 10X Genomics, Inc. All rights reserved.
#
"""Functions for the stage code BUILD_SAMPLE_OUTS and BUILD _SAMPLE_OUTS_PD."""
from cellranger.cr_io import hard_link, recursive_hard_link_dict
def build_sample_outs(args, outs):
"""Builds the sample outs for code that is shared between PD and CS."... |
66c68db42df2235730525d1a2fa57da21b9a62e338d8e3a6e706856b799fbafb | Python | 2,657 | 69 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
import os
from detectron2.data import DatasetCatalog, MetadataCatalog
from detectron2.data.datasets.builtin import _get_builtin_metadata
from detectron2.data.datasets.coco import load_coco_json
logger = logging.getLogger(__name__)
... |
d2442b4a6738ebe82015a357c85ab10ce6017b3227e1f42f152e070faaf17d8b | Python | 2,657 | 69 | """Read fMRI metadata and select a repetition time in seconds."""
import argparse
import json
import math
from pathlib import Path
DEFAULT_TR_SECONDS = 1.42
LEGACY_TIMING_KEYS = {"ObjOrderList", "n_slices", "costum_timings"}
def positive_tr(value):
"""Validate a finite, positive TR; also suitable as an argpars... |
c2964ce71cc9ae03a858e0e081d0db9eb27580a8cc01c9c1c4fe817b42a35f7d | Python | 2,658 | 66 | import numpy as np
import pickle
from matplotlib import pyplot as plt
import os
from rCPGswCPG.Network import construct_model
from rCPGswCPG.Network import firing_rate
from rCPGswCPG.model_params.config_loader import load_model_cfg_file, model_params_from_cfg
from rCPGswCPG.utils.gen_utils import get_project_root
mode... |
17c4f6924958a8cb942fc12bd0f75aa43c7010e23e53b52cefa2744872447ce6 | Python | 2,660 | 64 | #streamlit run streamPlotData.py --server.headless true
import streamlit as st
#st.set_page_config(page_title="IDH1 MUT WT 24H TMZ*DMSO*data")#,page_icon=img)
#hide_menu_style = """<style>MainMenu {visibility: hidden; }footer {visibility: hidden;}</style>"""
#st.markdown(hide_menu_style, unsafe_allow_html=True)
import ... |
203e2ed620e90f4f6eec1e9bc1f8b0e03d9bbf955250e281ca11ef820a008cdd | Python | 2,660 | 67 | '''
Created on Jul 29, 2024
@author: voodoocode
'''
import os
import numpy as np
import feat_ex.beta.core
import finnpy.file_io.data_manager as dm
import csv
import scipy.signal
FSS = {"1":600, "2":600, "3":10000, "4":10000, "6":10000}
WIN_SZS = {"1":[5], "2":[5], "3":[2, 0.5], "4":[4, 2, 1], "6":[5, 2]}
WIN_SZS = {... |
f9c3bf852e50e18e7c6de8ff89463d9f190dd2547b1e11eff9fe5e5798ee3d24 | Python | 2,660 | 71 | #python diaNNparquetSILACratio.py
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
import numpy as np
mz_parquet = pq.read_table('/content/report.parquet')
mz_parquet = mz_parquet.to_pandas()
mz_parquet.to_csv('reports.csv')
print(mz_parquet.describe())
peptides_prots_proteotypic_log2int = mz_un... |
6f4868e58701baffbf947774eb46d9c548382efc676cb631a8149e4509cd6062 | Python | 2,661 | 68 | #!/usr/bin/env python
# Copyright 2016-2024 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... |
4f4ecf8128b3accafbb320e4e81a88293fb7bb43a090429d42f3e8bf752de41e | Python | 2,666 | 77 | # 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 VertexFeatureEmbedder(nn.Module):
"""
Class responsible for embedding vertex f... |
607fec04d0be32d2eca61ac19dd395f9274ee047887149bc6541aead47cf09a5 | Python | 2,666 | 113 | """
@Article{li2014multiplicative,
author = {Li, Chunming and Gore, John C and Davatzikos, Christos},
title = {Multiplicative intrinsic component optimization (MICO) for MRI bias field estimation and tissue segmentation},
journal = {Magnetic resonance imaging},
year = {2014},
volume = {32},
... |
15498b5dc6384e52819188131d051149735b6bec724c0930a187354cff756cd9 | Python | 2,667 | 51 | """
Shared plumbing for nnU-Net's multiprocessing passes: hand one task per item to a spawn pool and
consume the results as they land, while watching for workers that quietly died (usually OOM).
"""
import multiprocessing
from time import sleep
from typing import Any, Callable, Iterator, Sequence, Tuple
from tqdm impo... |
4cecba73e8d327d1e66bca33e0aee70fdd29fc49e8eecec043e205ae0ce479e9 | Python | 2,667 | 72 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# pyre-unsafe
import torch
from torch import nn
from detectron2.config import CfgNode
from detectron2.layers import ConvTranspose2d, interpolate
from ...structures import DensePoseEmbeddingPredictorOutput
from ..utils import initialize_module_pa... |
75bc5be28ce66bcee665d294d119876a206233ed5a4b4bf3b00ca0c67b1dbc33 | Python | 2,670 | 70 | from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Any
import pandas as pd
from src.utils.models import MolecularRecord
class SpreadsheetSourceError(Exception):
"""Raised when the spreadsheet input is invalid."""
@dataclass(slots=True)
class Sprea... |
e83b89ef65cd401e15c0509e54490f77118a685f798b456ab26280727c2518c5 | Python | 2,675 | 88 | from ij import IJ
from ij.io import DirectoryChooser
from ij.plugin import ChannelSplitter
from ij.gui import GenericDialog
import os
import random
# Ask user which channel is NFH
gd = GenericDialog("Select channel to open")
gd.addNumericField("Which channel would you like to open? (enter channel number)", 1, 0)
gd.sh... |
902e6f8731ccb7f420924e6ec6011d953c99ba608ab81f628bca7f3a318c800f | Python | 2,676 | 68 | import torch
from nnunetv2.training.nnUNetTrainer.variants.benchmarking.nnUNetTrainerBenchmark_5epochs import (
nnUNetTrainerBenchmark_5epochs,
)
from nnunetv2.utilities.label_handling.label_handling import determine_num_input_channels
class nnUNetTrainerBenchmark_5epochs_noDataLoading(nnUNetTrainerBenchmark_5ep... |
a313b6fc0627db3af87e1acaf83e52389e212f39cc0644b3f9e7b0aa5b34926e | Python | 2,683 | 85 | import numpy as np
import scipy.sparse as sp
from collections import Counter
import torch
import random
torch.manual_seed(123)
random.seed(123)
def mp_data(X_train_p, data, args):
r = args.drug_number
d = args.disease_number
p = args.protein_number
drpr = data['drpr']
dipr = data['dipr']
lab... |
a9fd5a2103399e104af84e2c32fb180d60778a667c26c0676db54b8797702a4e | Python | 2,688 | 108 | import numpy as np
import nibabel as nib
import scipy.ndimage
def normalize_img(img, max_img, min_img, max, min):
# Scale between [1 0]
img = (img - min_img)/(max_img - min_img)
# Scale between [max min]
img = img*(max - min) + min
return img
def unnormalize_img(img, max_img, min_img, max, min... |
dd14f2941b7c567866e62a98d11be7986078710a9c9fc153ed88e0c496f0db17 | Python | 2,690 | 65 | from torch.optim import Optimizer
from torch.optim.lr_scheduler import LambdaLR
def build_NoamLike_LRSched(
optimizer: Optimizer,
warmup_steps: int,
cooldown_steps: int,
init_lr: float,
max_lr: float,
final_lr: float,
):
r"""Build a Noam-like learning rate scheduler which schedules the lea... |
49bb9d187be938d949d7cae3d51a95f4df22ab0c730156c98a3bb283bab42069 | Python | 2,702 | 58 | import torch
from torch.optim import Adam, AdamW
from nnunetv2.training.lr_scheduler.polylr import PolyLRScheduler
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer
class nnUNetTrainerAdam(nnUNetTrainer):
def configure_optimizers(self):
optimizer = AdamW(self.network.parameters(),
... |
b53a80d16071fbb8c97b0dfd7ee7793134fe141b957813869b9259a7f8a70c9b | Python | 2,702 | 87 | #!/usr/bin/env python
#
# Copyright (c) 2021 10X Genomics, Inc. All rights reserved.
#
"""Functions to barcode rank plots for multi websummary."""
from __future__ import annotations
import json
from typing import TYPE_CHECKING
import cellranger.rna.library as rna_library
import tenkit.safe_json as tk_safe_json
from ... |
e67f69d46985671701446a7e0b315f23d404b40e289ad9e28f5647a756ba52cf | Python | 2,705 | 61 | from __future__ import annotations
import numpy as np
import pandas as pd
from scipy.stats import rankdata, t
def benjamini_hochberg(p_values: np.ndarray) -> np.ndarray:
p_values = np.asarray(p_values, dtype=np.float64)
order = np.argsort(p_values)
ranked = p_values[order]
adjusted_ranked = np.minimu... |
9578aabd766402d21111ec04b3bb07a71b39ce618e5b06007fb04d86e3d18cd0 | Python | 2,708 | 79 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... |
1e08ed1ec7a413e18c21893c1d864136444845d8798f1554dbc986c0cc2e95ec | Python | 2,710 | 44 | import pickle
from rCPGswCPG.utils.gen_utils import get_project_root
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
# see class Experiment for more details
# Runs the experiment only if the correspondi... |
751d88a5ea0722a1d25e210149b734ff27bcbcc2fec7b6ae8b3b259689ac067d | Python | 2,710 | 86 | """A setuptools based setup module.
See:
https://packaging.python.org/guides/distributing-packages-using-setuptools/
https://github.com/pypa/sampleproject
"""
from setuptools import setup, find_packages
from os import path
from io import open as io_open
TEST_REQUIRES = [
# testing and coverage
'pyte... |
b614a6240e4fcedbca73a49947a4624230f6e7662b27d94e5c467e88dc406505 | Python | 2,715 | 116 | from __future__ import annotations
from pathlib import Path
from typing import Any, Dict, Iterable, Optional, Sequence, Protocol, Tuple
import numpy as np
import numpy.typing as npt
import xarray as xr
from .definitions import NeuronClass, Projection
from .types import SynParams
__all__ = ["IEncoder", "IStimulus", ... |
6ff8b1ad6d5e11da10d1a2b53f1e134df5421ee4218a07075ed19622a16b4c6c | Python | 2,716 | 50 | """倒立振子クラス"""
import numpy as np
class InvertedPendulum():
def __init__(self, N_theta, N_omega, maxtheta, maxomega, I=60, m=60, g=9.81, h=1.0,
b=4.0, k=471, delay=0, noise=1, dt=1e-2, initial_range=0.02):
self.N_theta = N_theta
self.N_omega = N_omega
self.maxt... |
5b40fc19c7772c3a6887d8ce6ea022a88af4c04d2d4e49dfa61fa8b6ab4036b3 | Python | 2,722 | 60 | #!/usr/bin/env python
# Copyright 2017-2026 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
22bef249ffba1fba0138cf010532891b2f5d4989fcdb2d51e566b3c83761fe82 | Python | 2,724 | 68 | import pickle
from typing import Callable
from pathlib import Path
import numpy as np
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
from .. import config
class AlphaFunction:
func: Callable[[float], float]
domain: tuple[float, float] # (min, max)
def __init__(self, layer=None,... |
0ef30bc5f7ddb0e046918ce3e743d9a1226dcbf04881ae6237ed782de1071a49 | Python | 2,736 | 103 | import numpy as np
from stabl import data
from stabl.multi_omic_pipelines import multi_omic_stabl
from sklearn.model_selection import RepeatedStratifiedKFold, GridSearchCV
from sklearn.linear_model import LogisticRegression
from stabl.stabl import Stabl
from stabl.adaptive import ALogitLasso
from sklearn.base import cl... |
fe15fa80337d6aa59c57888b092f095af9e786ddbc0efb4f2c8d43bab8994153 | Python | 2,736 | 87 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import bz2
import gzip
import pathlib
from unittest import mock
from openfe.protocols.openmm_septop.utils import deserialize, serialize
def test_serialize_creates_parent_directory(tmp_path... |
7d1c3d1226eb7105b21bc04944a947606556d878315023b82b137e6623a9f5d6 | Python | 2,737 | 72 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from typing import Any
from detectron2.structures import Boxes
from ..structures import DensePoseChartResult, DensePoseChartResultWithConfidences
from .base import BaseConverter
class ToChartResultConverter(BaseConverter):
"""
Converts vario... |
059727980a7be4698353e28ec71b8b88b68a0a629dd01ba440b466bf1a493d7f | Python | 2,745 | 98 | from pathlib import Path
import click
import click_log
from ... import io
from ..._cli.utils import catch_exception, logger
from ..._steinbock import SteinbockException
from ..._steinbock import logger as steinbock_logger
from ..intensities import IntensityAggregation, try_measure_intensities_from_disk
_intensity_ag... |
851d35947b35905615bf6fd2fd3a4ce7cb4d7a352a85c9324c3c10c5dcf3b306 | Python | 2,746 | 98 | from os import PathLike
from pathlib import Path
from typing import List, Sequence, Union
import click
import click_log
from ..._cli.utils import OrderedClickGroup, catch_exception, logger
from ..._steinbock import SteinbockException
from ..._steinbock import logger as steinbock_logger
from .. import mosaics
def _c... |
97a031a8ce868dbfed3142dd2bc2ead8db70d97f9b96d2000b00c115236d098e | Python | 2,748 | 94 | """Test removal of agents."""
import unittest
import numpy as np
from mesa import Agent, Model
from mesa.datacollection import DataCollector
class LifeTimeModel(Model):
"""Simple model for running models with a finite life."""
def __init__(self, agent_lifetime=1, n_agents=10, rng=None): # noqa: D107
... |
3234c669a4ccc2f61ef9e07bfff235a8555db414b04f8f8cc22c900c7f09c92e | Python | 2,757 | 71 | from typing import Optional
import matplotlib.pyplot as plt
import xarray as xr
from matplotlib.axes import Axes
from hsnn.core import SpikeRecord
from hsnn.core.types import SpikeEvents, SpikeTrains
from hsnn import ops
from .base import setup_axes
__all__ = [
"plot_raster",
"plot_raster_xr"
]
def plot_ra... |
f6c1ef3b675b74ebc86c7ac8b6fc1885d5cded25e2746846c3e6e62b40762873 | Python | 2,757 | 80 | # 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_cse_predictor_output_class_with_confidences(BasePredictorOutput: type) -> type:
"""
Crea... |
f14c3cf05a40363acd8db6ff9c94cdfad22d78a94dc2bfd82a5ec2bfddcf3ae4 | Python | 2,759 | 54 | from typing import Union, List, Tuple
from nnunetv2.experiment_planning.experiment_planners.residual_unets.residual_encoder_unet_planners import \
nnUNetPlannerResEncL
from nnunetv2.preprocessing.resampling.no_resampling import no_resampling_hack
class nnUNetPlannerResEncL_noResampling(nnUNetPlannerResEncL):
... |
d3f3d3d4e78680bb43e119dd273239c7562ade4b9bbfa608d1ec719733e84b1a | Python | 2,760 | 81 | # Copyright 2011-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 obtain a copy of the Licen... |
077336a62c5bbee04ca326ea6132b23ff55175e6fd1ad09affbbb9a6bcfe984e | Python | 2,761 | 47 | # 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... |
b101f2c5321eaace711861bdf962de5735845c5bf94c88be23773f47bd9cfe1b | Python | 2,762 | 87 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
import numpy as np
import scipy.ndimage
def applyFilter(im, num_iter, delta_t, kappa, option):
# Convert input image to float.
im.astype(float)
# PDE(partial diffe... |
72078c97c2eed5a8dac82bb294a722428280c0e9c4d69baa517e33027a5dea2b | Python | 2,766 | 81 | # Copyright 2011-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 obtain a copy of the Licen... |
ca325367cb76a900ee9f8e53ec888e821f442563e7bc9134937b2c14015a5f67 | Python | 2,766 | 57 | import sys
from pathlib import Path
if len(sys.argv)!=2: sys.exit("USAGE: python dePepMascot.py <path to peptides containing mascot exported file>, \n e.g.,\npython dePepMascot.py L:/promec/Elite/LARS/2021/april/Garima/RopacusPD630gelBands4/210427_GELBAND_91KDA_PeptideGroups.txt\n")
pathFiles = Path(sys.argv[1])
#pa... |
7c478b9ad550fca8ff96bed8eb4b58d856279f9b6a10a518a174e8301ae8eddc | Python | 2,769 | 79 | """
If you use this code, please cite one of the SynthSeg papers:
https://github.com/BBillot/SynthSeg/blob/master/bibtex.bib
Copyright 2020 Benjamin Billot
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the Lice... |
09ca792589ce16596bf91b2c494c2728da47c9ceb03027ec74445280aebf4cba | Python | 2,772 | 59 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
from detectron2.config import CfgNode as CN
from detectron2.projects.deeplab import add_deeplab_config
def add_panoptic_deeplab_config(cfg):
"""
Add config for Panoptic-DeepLab.
"""
# Reuse DeepLab config.
add_deeplab_conf... |
261412f0c415d0208a55acd3a818f7d63dfd5e4313e84438d548472c605b4586 | Python | 2,774 | 76 | from typing import Sequence
import numpy as np
import numpy.typing as npt
import pandas as pd
import xarray as xr
from ._types import RatesDatabase
__all__ = [
"get_dataframe",
"tabulate_selectivities"
]
def get_dataframe(rates_db: RatesDatabase) -> pd.DataFrame:
labels = rates_db.rate.labels
df = ... |
bd20bf060ae509cd458aa6b06f298d3d0289882a3b822195222b5d111accdd89 | Python | 2,774 | 91 | """Continuous space agents."""
from __future__ import annotations
from itertools import compress
from typing import Protocol
import numpy as np
from mesa.agent import Agent
from mesa.experimental.continuous_space import ContinuousSpace
class HasPositionProtocol(Protocol):
"""Protocol for continuous space posi... |
5212e89552207da24f1d1df3a8accfc70c610d66f4f6b838ae29591ceb09f9b6 | Python | 2,775 | 105 | # Copyright (c) 2025 10x Genomics, Inc. All rights reserved.
"""Classes for multi-layered images."""
from dataclasses import dataclass
from typing import Self
import martian
import numpy as np
from PIL import Image
from cellranger.spatial.image import base64_encode_image
TISSUE_IMAGE_DISPLAY_WIDTH = 400
def rgb_to... |
564a2de84f6321ae77c4d46666e1c4dc2c69cfcde48a6f8c441ea1ad9a9a4a40 | Python | 2,775 | 94 | from .calibrator import (
AdaptiveMulticlassConformalCalibrator,
BinaryClassificationCalibrator,
CalibratorBase,
IsotonicCalibrator,
IsotonicMulticlassCalibrator,
MulticlassClassificationCalibrator,
MulticlassConformalCalibrator,
MultilabelConformalCalibrator,
MVEWeightingCalibrator,... |
b9d823bc66a55bd358cb4ef92804b765454561e540ff004a4c0756db73d97198 | Python | 2,778 | 90 | """Plotting and helpers for the aperiodic clinical project."""
from pathlib import Path
import matplotlib.pyplot as plt
import seaborn as sns
from lisc.plts.utils import check_ax, check_aliases
# Import local utilities
from .utils import sort_df
####################################################################... |
31b7cea547cda162ed1ddb0e341906b6e84e0ca4061dae5c6dddeca3eb6053ef | Python | 2,782 | 59 | 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)
fixed_list = [[int(item) for item in one.split()] for one in args.position_list.split(",")]
... |
6a20b1ddff2db77ee3539e0e101d75dabc30c434ddee49ed5c37b0b674ed5b74 | Python | 2,783 | 90 | """EEG Semantic Classification Execution Script"""
import os
import random
import numpy as np
from pathlib import Path
import torch
import torch.backends.cudnn as cudnn
from eeg_visual_classification.utils.lib import (
create_parser, extract_model_options, get_dataloaders,
get_model_hash, load_checkpoint
)
fro... |
87d51ccbdfea9339e33d6ad15d34612779fab0aa8f11956fea6b1bf9def7ab77 | Python | 2,784 | 81 | from __future__ import annotations
from copy import copy
from pathlib import Path
from typing import Mapping, Sequence
import numpy as np
import pandas as pd
import xarray as xr
from . import functional as fn
from ..core.backends import create_network
from ..core.interfaces import INetwork
from ..utils import io
__... |
1d544cc173a73cfdfec160fb07bf01fff1d5a3eba4bc799028929a283d482fda | Python | 2,785 | 94 | import argparse
import pandas as pd
from pathlib import Path
import shutil
import logging
from create_pairs_from_alignments import create_genus_df
from filter_comparisons import filter_comparisons
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--data-dir",
"-d",
... |
d35420e54ec0d14651eadb6e1ad2c338378d88330a43e923f57b002c670cd414 | Python | 2,789 | 76 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 10 12:18:37 2025
@author: hukaria2
"""
#%% Imports
import sys
sys.path.append('/u/38/hukaria2/unix/mi_paper/micorr')
import estimators, simulations, testing, transformations
import numpy as np
#%% Simulating the base signals used in the compari... |
1cd7a2c5857604bee4119e18aa731adcdd7846fa3db554ccfe5c55119cf41b7d | Python | 2,797 | 111 | """
Misc wrappers for some VTK classes.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
from vtk.util.vtkConstants import VTK_ID_TYPE
from vtk.util.numpy_support import numpy_to_vtk
from .base import BSVTKObjectWrapper
from ..decorators import unwrap_input, wrap_output
class BSC... |
c47df7ec62fc2685f08379df3338f4e411999602b13f72c3142c822d833be641 | Python | 2,798 | 71 | """Sweep tau_v over {0.5, 1.0, 2.0, 5.0} for the complex model and save trace figures.
Mirrors run_model.py (same Hydra config + Experiment pipeline) but loops over
tau_v, overriding model_params.neuron_defaults.tau_v for each run, and writes one
trace figure per value to img/experiments/tau_v_sweep/tau_v_<value>.png.... |
d34d8b170650b4bf84f3da9667d6d8c4a9218914dace63c44426994b7dbfade9 | Python | 2,798 | 99 | # Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
"""Generate aggr web summary from the individual json data."""
from __future__ import annotations
import json
from typing import TYPE_CHECKING
import martian
from websummary import summarize
if TYPE_CHECKING:
import cellranger.mro_types.filetypes as ... |
2aaf8de8be5ef3f4fe0611e0d3fa17256033d68da540a299fd73e64fcec2ea55 | Python | 2,801 | 73 | from typing import List, Tuple, Union
from utils.command_line import build_command_list
def generate_command(gear_inputs: dict, gear_options: dict, app_options: dict,) -> List[str]:
"""Build the main command line command to run.
This method should be the same for FW and XNAT instances. It is also BIDS-App
... |
118c65a9ad3afa88c88b99e77f31cdb976654d6fa265f7a8b42be25265325ea0 | Python | 2,802 | 100 | #!/usr/bin/env python3
import pygraphviz as pgv
import sys
from pathlib import Path
if len(sys.argv) < 2:
print("DAG should be provided in stdin (i.e. piped in from snakemake or cat)")
print(f"Usage: {sys.argv[0]} <output_prefix> ")
print(f"e.g.: snakemake --dag | {sys.argv[0]} out_dags/mydag")
sys.ex... |
5bd56c83b7429aa92c9d8cccc0399af2bd7b513f57ba6d3f6dba929679700c71 | Python | 2,803 | 77 | #!/usr/bin/env python
# Copyright 2016-2023 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... |
69ed8e7d75d064ff8afcfe802b9f4abc8a2b46258f6ae16294368b7e842e5986 | Python | 2,805 | 89 | import typing
from typing import Literal
import mesa
from mesa.discrete_space import OrthogonalMooreGrid
from mesa.examples.advanced.pd_grid.agents import PDAgent
from mesa.experimental.scenarios import Scenario
class PrisonersDilemmaScenario(Scenario):
"""Scenario for Prisoner's Dilemma model."""
width: in... |
0b8afdce81956042ef47cccb066c2a6d7ed6246ee7186696d0c1d435ccec7ba3 | Python | 2,807 | 93 | import numpy as np
import matplotlib.pyplot as plt
from model import simulate, load_models
"""
Dependencies:
numpy
matplotlib
numba (optional, speeds simulation up: pre-compiles functions to machine code)
"""
def main():
"""
Tiny example program demonstrating how to load model parameters and simulate the m... |
79b1979b44a616d61bd860433018a2ec98702701837a4e5699248080945304b9 | Python | 2,807 | 76 | """Prepare a second, training-only imputation pipeline for sensitivity analysis.
This entry point reuses the tested repeated-split implementation while applying an
explicit imputation-method override in memory. The primary analysis configuration
is never modified on disk.
"""
from __future__ import annotations
impor... |
b74056ec511b9664124b07550c1ede8f50ea3f0c4eefb8e9be0b8e3318eee215 | Python | 2,808 | 84 | import logging
from typing import Iterable, Sequence
from torch import Tensor, nn
from chemprop.data import BatchMolGraph
from chemprop.nn.hparams import HasHParams
from chemprop.nn.message_passing.proto import MessagePassing
logger = logging.getLogger(__name__)
class MulticomponentMessagePassing(nn.Module, HasHPa... |
3bce25d41b258069c84f1826eb7ce39cf7cd0485012907776ac852948ff87d7e | Python | 2,809 | 65 | """LIFモデルニューロンのクラス"""
import numpy as np
class LIFmodel:
def __init__(self, N, dt=1e-4, tau=2e-2, tau_trace=2e-2, tau_ex=5e-3, tau_inh=1e-2, tref=5e-3,
vrest=-60, vthr=-50, vpeak=20, Eex=0, Einh=-80, gex=0, ginh=0):
self.N = N
self.dt = dt
self.tau_dt = tau / dt
... |
b6f1df42486e71db9418dbc0f6b3462ec2b379feb8346c1807748f72b31908cd | Python | 2,809 | 69 | from matplotlib import pyplot as plt
import numpy as np
import os
import pickle
from rCPGswCPG.Network import firing_rate
from rCPGswCPG.Network import construct_model
from rCPGswCPG.model_params.config_loader import load_model_cfg_file, model_params_from_cfg
from rCPGswCPG.plotting_figures.plotting_utils import plot_r... |
b19e15e9cfcdfee4826087980e022c8bf146b5e335e82c6da99e663007f09541 | Python | 2,810 | 86 | import numpy as np
import matplotlib
from matplotlib.colors import Normalize
import matplotlib.colors
TIME_CMAP = matplotlib.colors.LinearSegmentedColormap.from_list("", [
[243/255, 237/255, 117/255],
[243/255, 218/255, 117/255],
[243/255, 182/255, 117/255],
[247/255, 159/255, 117/255], # f79f75
... |
1fcf9fb82751bb6448ad86003cfcfd00076a7e26162845f8a48f965d7cbb915f | Python | 2,811 | 79 | #!/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... |
7d207182a05090c66cc4195215f3228a3c2e8bd856f3098d2bec25097c69a6dc | Python | 2,813 | 92 | from torch.utils.data import DataLoader
from qm9.data.utils import initialize_datasets
from qm9.args import init_argparse
from qm9.data.collate import collate_fn
import torch
def retrieve_dataloaders(batch_size, num_workers=1):
# Initialize dataloader
args = init_argparse('qm9')
args, datasets, num_species... |
b344735f5fccf244c8fcb0d1f5318b56b7ff2fbea9f94dbc84d3705c4e521359 | Python | 2,818 | 135 | from .agg import (
Aggregation,
AggregationRegistry,
AttentiveAggregation,
MeanAggregation,
NormAggregation,
SumAggregation,
)
from .ffn import ConstrainerFFN
from .message_passing import (
AtomMessagePassing,
BondMessagePassing,
MABAtomMessagePassing,
MABBondMessagePassing,
... |
a3b5862978531886b217afc9fb9fe7205e530eb8da61c293c7c6dc1effd0e674 | Python | 2,820 | 58 | # labels from PDB files
ALL_LABELS_BACKBONE = ['C', 'CA', 'N', 'O', 'OXT']
ALL_ATOM_LABELS = ['C', 'CA', 'CB', 'CD', 'CD1', 'CD2', 'CE', 'CE1', 'CE2', 'CE3',
'CG', 'CG1', 'CG2', 'CH2', 'CZ', 'CZ2', 'CZ3', 'N', 'ND1', 'ND2', 'NE', 'NE1',
'NE2', 'NH1', 'NH2', 'NZ', 'O', 'OD1', 'OD2', 'OE1', 'OE2', 'OG', 'OG1', 'OH',
... |
80506cc85d9cae8658ca7ca25dadf985dae697775f12c059c636bfecb423ddb0 | Python | 2,821 | 58 | # labels from PDB files
ALL_LABELS_BACKBONE = ['C', 'CA', 'N', 'O', 'OXT']
ALL_ATOM_LABELS = ['C', 'CA', 'CB', 'CD', 'CD1', 'CD2', 'CE', 'CE1', 'CE2', 'CE3',
'CG', 'CG1', 'CG2', 'CH2', 'CZ', 'CZ2', 'CZ3', 'N', 'ND1', 'ND2', 'NE', 'NE1',
'NE2', 'NH1', 'NH2', 'NZ', 'O', 'OD1', 'OD2', 'OE1', 'OE2', 'OG', 'OG1', 'OH',
... |
01ec298737f277547e308e8fc9fb9e38072b3a7630f787e4451bef3af5192d74 | Python | 2,822 | 68 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# pyre-unsafe
import json
import logging
from typing import List, Optional
import torch
from torch import nn
from detectron2.utils.file_io import PathManager
from densepose.structures.mesh import create_mesh
class MeshAlignmentEvaluator:
"... |
191c4cf0a1bc0e2d14e90a7834048659070adcc355f6b91e64fb1734199107a4 | Python | 2,822 | 84 | #!/usr/bin/env python
# Copyright 2016-2023 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... |
e1434d83ce92e8919cdb346a778b0593a4b6ef9bf9ccbab7a0488836e05026d4 | Python | 2,839 | 88 | from __future__ import annotations
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.cm import ScalarMappable
from matplotlib.colors import ListedColormap
from matplotlib.colors import Normalize
from matplotlib.gridspec import GridSpec
def rdm_with_class(
rdm: np.ndarray,
s... |
9493373612c512c3e2156dafe248ea38b8284eccf20a77a46d606072d506d3c7 | Python | 2,843 | 87 | """Fig 1F: Raw and artifact-removed electrophysiological traces during ICMS.
Shows 6 channels of raw (left) and preprocessed (right) traces during
100 Hz stimulation. Gray shading marks stimulation period.
Usage:
python python/fig1/plot_ephys_traces.py
"""
import sys
from pathlib import Path
sys.path.insert(0, st... |
7cd2df1b6314e2b0864db3697dd1220bf9d26d68d12ae95b8c1a1ca9eafe863d | Python | 2,845 | 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... |
6b0442876a62115cd2054854169ae0f508fe8f836486474b0dc5bafc77e4fb3d | Python | 2,848 | 73 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from dataclasses import fields
import torch
from densepose.structures import DensePoseChartPredictorOutput, DensePoseTransformData
def densepose_chart_predictor_output_hflip(
densepose_predictor_output: DensePoseChartPredictorOutput,
transform... |
3fd6f846ddc66f3a6348779b509a63f8a7b102381aa23d14f75369e6c10e4477 | Python | 2,854 | 92 | """Mesa-specific exception hierarchy."""
class MesaException(Exception): # noqa: N818
"""Base class for all Mesa-specific exceptions."""
class SpaceException(MesaException):
"""Base exception for errors in the discrete_space module."""
class CellFullException(SpaceException):
"""Raised when attemptin... |
964f9df453943dd24653e6c9511df8ac56dc933f000d7718e0e2e8aa502d8aff | Python | 2,854 | 78 | import torch
import torch.nn as nn
import numpy as np
from .NeuroStream import EEG3DNet
from .meta.electrode_names import channels
from .VisualTransforms import SpectralEEGScalpMap, LogWaveletCWT, LogPowerSpectrum
class Model(nn.Module):
def __init__(
self,
spec_type="cwt",
n_classes=40,... |
3601afd8b1f9e0f484121a6e6dc3f5140cb34762a7e37aa20b99d5cdc2f24d17 | Python | 2,855 | 91 | import os
import sys
import glob
import gzip
import numpy as np
import matplotlib.pyplot as plt
from thunderfish.dataloader import relacs_samplerate_unit, relacs_metadata
sys.path.insert(0, os.path.join(sys.path[0], '..'))
from eods import detect_eods, plot_eod_interval_hist
# select what to do:
plot_data_trace = Fals... |
648d539a48d89fd01e225e9be810d44bed8e63cfafb73846cdc38476bf7282df | Python | 2,855 | 103 | import numpy as np
from stabl import data
from stabl.multi_omic_pipelines import multi_omic_stabl_cv
from sklearn.model_selection import RepeatedStratifiedKFold, GridSearchCV
from sklearn.linear_model import LogisticRegression
from stabl.stabl import Stabl
from stabl.adaptive import ALogitLasso
from sklearn.base import... |
0b9bc10d73044d7a000e560e9a092695b4522e7a15556a648e98e4a2420f0f6c | Python | 2,856 | 64 |
import numpy as np
from brainspace.gradient import GradientMaps
from brainspace.gradient.alignment import procrustes
def test_alignment_methods():
rs = np.random.RandomState(0)
# Create two random connectivity matrices
n_nodes = 100
c1 = rs.rand(n_nodes, n_nodes)
c1 = (c1 + c1.T) / 2
c2 = rs.r... |
92d432f814a0f942f066d3d1d718a5af56af98677345b62c5349a7cf9f556499 | Python | 2,860 | 59 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2019-2022 Saint Petersburg State University
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
... |
17d571feac506b1fed0685484b6cc755ed8faf7b35f862d42134fc1e70ae06fb | Python | 2,863 | 87 | # Run from project root. Requires E9E10/E9E10NC.AC_neural_and_epi.h5ad
# (download or generate via E9E10/E9E10_analysis).
import re
import scanpy as sc
import pandas as pd
import numpy as np
INPUT_FILE = "E9E10/E9E10NC.AC_neural_and_epi.h5ad"
OUTPUT_FILE = "Automatic_annotation/scanpy_E9E10NC.AC_harmony_clusters.csv"... |
911cbbeda0c954eb70c976f6ea5a87802ba566c8d397fc5527ed766923eb6cf5 | Python | 2,863 | 64 | # 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... |
b35b00777a7f3ef50ce6716a31890ef052b2d4e9a76b6ea2261f5e040f5810b2 | Python | 2,867 | 89 | #!/usr/bin/env python
#
# Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
#
import martian
import cellranger.analysis.constants as analysis_constants
import cellranger.analysis.pca as cr_pca
import cellranger.h5_constants as h5_constants
import cellranger.matrix as cr_matrix
import cellranger.rna.library a... |
b3d11337d450472a01c48aafc47897d9ff8a22df9796fd32562c45f66b5f06a8 | Python | 2,872 | 107 | import numpy as np
import pytest
from chemprop.data import ClassBalanceSampler, MoleculeDatapoint, MoleculeDataset, SeededSampler
from chemprop.featurizers.molgraph import SimpleMoleculeMolGraphFeaturizer
@pytest.fixture(params=[0.0, 0.1, 0.5, 1.0])
def threshold(request):
return request.param
@pytest.fixture
... |
33c4e9d3ad3dc051f09a9a37ff900d7c438d4f465a0e2d51d3f0595ed6e2d665 | Python | 2,881 | 91 | '''
Created on 31.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
import scipy.io as sio
import proc_tools as pt
def mean_ts(pa... |
46b603e6708f1c9b1323f36e77c378deff2849c96db8e601e18fcb7cd24c9662 | Python | 2,881 | 90 | """Ionizable acid/base atom finder for MolGpKa (SMARTS matching).
Vendored from MolGpKa (https://github.com/Xundrug/MolGpKa), MIT License.
Patched for SMILES2Docking: the SMARTS pattern file is resolved relative to
this module instead of the original working-directory-relative path.
"""
from __future__ import annotat... |
60238eb48d9e99dd81ad2943f6253f3fc6b1e6b9697d7b1a919aaebfa11a75fe | Python | 2,883 | 78 | """Modulated units per stim channel over weeks (ICMS92 at 4 uA)."""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from utils.filters import filter_modulated
from utils.plotting import apply_global_style, PALETTE, sig_text, rank_biserial_r
from utils.config impo... |
9bfa707a71aef4cfb9aa729d387e31f9c0d872001d76a497227f1eb0bc2b5371 | Python | 2,883 | 81 | """
Single entry point to run the full response analysis pipeline. This is the
current pipeline; its output (stim_condition_results) builds the figure raw_df.
Usage:
from batch_process.postprocessing.responses_v3.run_pipeline import run_pipeline
from batch_process.postprocessing.responses_v3.window_config impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.