sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6e2ceb54f4c035330679b5c629cebd14ef8f6edf63a3f73c3b7ca37bda99a5c7
Python
5,406
153
"""Microsaccade event representation and post-detection rules. The post-detection rules implement the variants Nouri et al. 2025 apply on top of canonical Engbert-Kliegl detection: 1. Refractory merge: events whose onset falls within `refractory_merge_s` of the previous event's offset are merged into the previous ...
4ab4bc4f136b89ee8e677e4596dc7d30e58096fe3ca1b85678ba139ca1093d10
Python
5,407
213
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
75f5ee8b9765166ac51d07d7d675b74124b26bba002149f547b6d7e30f4aeb76
Python
5,407
142
#!/usr/bin/env python # coding: utf-8 import os from pydoc import classname import numpy as np import pandas as pd import argparse import numpy as np import pandas as pd import sys from tabulate import tabulate from constants import * from src.training.train_utils import Logger from src.models import get_classifier fr...
844f5a8afe395e1e74277de332adf2321c8167cf9c3dbdaccdb4b8dbb44e315c
Python
5,407
150
# coding: utf-8 import torch import torch.nn as nn import torch.nn.functional as F class BasicConv2d(nn.Module): def __init__(self, in_channels, out_channels, **kwargs): super(BasicConv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, bias=False, **kwargs) self.bn = n...
1296d8048ad6e104d8ac0e86f2e50920a65a2e68fcc384b92969d7ce6afa850a
Python
5,408
156
"""distutils.command.bdist Implements the Distutils 'bdist' command (create a built [binary] distribution).""" import os import warnings from ..core import Command from ..errors import DistutilsPlatformError, DistutilsOptionError from ..util import get_platform def show_formats(): """Print list of available fo...
29b8bcc080b928e704e7b42a20d6936538285a41807319efe5407d39555386e5
Python
5,408
135
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
d10335fe702fbb6536602474a861425e3356ba0baa503b9eaadf59d8e9a5614d
Python
5,408
200
# Node-group asset "Find Bonded Atom" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECK...
023f6ae9d322e1bc7b6b6233e9ea80efb37f9231f2644378351590648b292b92
Python
5,409
117
from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, module_to_package, ) from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port from elasticai.creator.vhdl.design.design import Design from elasticai.c...
f9b85fa05c1c184e5418034510fbc95334efce8756a85cad03cf4ddabf28c5d6
Python
5,409
105
# SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL # # SPDX-License-Identifier: AGPL-3.0-or-later """ Functions that calculate coupling coefficent and normalize them (Pearson correlation of binned spikes/calcium traces with the mean centered population average) authors: András Ecker, Daniela Egas Santander, Mich...
4adc2ce96fa4574d273ca86c3256528fefe40702270e609183cc612b07afe604
Python
5,410
110
import numpy as np import pandas as pd import sys def get_row_at_region(df, key): """For use with count_df and region_df (cell_region_count.csv and region_counts.csv)""" return df[df["region"] == key] def get_row_at_parcellation_idx(df, idx): """For use only with CCF_all_regions / 1_adult_mou...
3f8a0e15e858bebb7d1bdefc4597dad6590ea0c1fc81f3c697970e6c94a01c4e
Python
5,411
143
import json import databpy import numpy as np import pytest import starfile from nodebpy.nodes.geometry import StoreNamedAttribute from pandas import DataFrame from scipy.spatial.transform import Rotation import molecularnodes as mn from tests.utils import GeometrySet from .constants import data_dir @pytest.mark.para...
5423e8484998003708b2849306f6c2df8fb4d0cd0887c58bde20d4d7e963a5ea
Python
5,412
181
"""Methods for reading and splitting sleeplab format data to tf.data.Dataset.""" import logging import numpy as np import sleeplab_format as slf import sleeplab_tf_dataset as sds import tensorflow as tf from pathlib import Path from typing import Any logger = logging.getLogger(__name__) component_config = { 'c...
a5620100be9345911c8d0e0b78d7137d4f7e44440b21bfe8b85c8c4494460a24
Python
5,413
149
import matplotlib matplotlib.use("Agg") import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") import yaml, io with open("./config/MNIST_config.yaml", 'r') as stream: config= yaml.safe_load(stream) config["default_path"]= str(config["default_path"]) config["cuda"]= str(config["cud...
a9c7160d646f79bb1d94def8411f6fdce81f880be09244b3537a0d0e8b67a328
Python
5,414
182
"""Common workflows for phonons.""" from __future__ import annotations from importlib.util import find_spec from typing import TYPE_CHECKING import numpy as np from ase.atoms import Atoms from monty.dev import requires from quacc import job, subflow from quacc.atoms.phonons import ( get_atoms_supercell_by_phono...
dc87c81ae514640b08001f06c2d0b51ac0bf42ee07bdb0cd7aa880ff25f280b5
Python
5,414
184
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
173c1925d99ee0d16373a5872660ca2b4206ffde3487c3ffa00bf0c204eb0cbf
Python
5,416
154
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
76e1814a4cec7ab46284c0439bc0670651fa57a72ae5b2dfa423fbf5cf51bed5
Python
5,416
127
"""Implementation of the python API for the cell count of the flagser C++ library.""" from ._utils import _extract_unweighted_graph, _extract_weighted_graph from .modules.flagser_count_pybind import compute_cell_count def flagser_count_unweighted(adjacency_matrix, directed=True): """Compute the cell count per di...
12357d2faa2da266b32fafce0a76bf22272c1837394b2384188bb5629d6499be
Python
5,419
171
from scipy.integrate import solve_ivp import matplotlib.pyplot as plt import numpy as np import math as m from mpl_toolkits.mplot3d import Axes3D import torch import torch.optim as optim from Six_hump_camel import Six_hump_camel_func def set_para(lr): # equivalent_momentum = 0.5 # momentum = 1 *...
d51a6533784289676b0747a72f88a36d3a5a6e391574c10171adf5294c6ab72f
Python
5,419
147
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
d880b71bc2d47d7ef608621011a6221e5e7952b7ef8aae998b66f50f0caf4e5b
Python
5,419
121
import unittest import torch import numpy as np from torcheeg.transforms import ToTensor, Resize, RandomNoise, RandomMask, RandomWindowSlice, RandomWindowWarp, RandomPCANoise, RandomFlip, RandomShift, RandomChannelShuffle, RandomFrequencyShift, RandomSignFlip, Contrastive, RandomMaskGrid, RandomMask2D class TestTorch...
0bcdbe9bbc3d37508c1e380d51718ae50692810c6b90be2fcbb6a4c7ea19bd94
Python
5,420
133
import argparse import numpy as np import torch import torch.nn as nn import torch.optim as optim import random from dataloaders.data_loader_hyper import NetDatasetEpidemic from torch.utils.data import DataLoader import datetime from model.resinf import ResInf from engine import * parser = argparse.ArgumentParser() pa...
2f7b7cff020ea2ff1e9bebd958e71b91db2bc1ee3737afe0a8d879a47ed63dde
Python
5,420
147
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
b6d7e9eb097569d49d589e668b9f994cab8fff2d34dd920fc967c1ff5a8026f6
Python
5,420
144
import json import uuid from pathlib import Path from unittest.mock import MagicMock import pytest import NDATools from NDATools.clientscripts.vtcmd import validate from NDATools.upload.cli import ValidatedFile from NDATools.upload.validation.api import ValidationV2Credentials, ValidationV2 from NDATools.upload.valid...
f02f41b60ed77b35f9941feb4d3c19bdd9693df3115a4f72238bc40d5c41293a
Python
5,420
180
from argparse import ArgumentParser from pathlib import Path import pickle import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from bed_reader import to_bed from simulations.wrapper import simulate_agg_risk_and_dis_outc from simul...
3ea803eb5987d0a5c27a09a977e1c7466c057fff24e2b4b83241368d971ab81e
Python
5,421
138
#!/usr/bin/env python # Copyright 2025, Felix Krueger (fkrueger@altoslabs.com) # 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 the License, or # (at your option) any later ...
70ec933b6259acba959d514d2534c937ca1387d1f0d5618854b8a07a21842162
Python
5,421
104
""" Consensus assembly botany last modified: András Ecker 02.2023 """ import os import numpy as np import pandas as pd from assemblyfire.config import Config import assemblyfire.utils as utils from assemblyfire.topology import AssemblyTopology, simplex_counts_consensus_instantiations import assemblyfire.plots as plot...
8baf9e81d45c786fa9833da04adbe65f3cbcd79b36e031e4b5ebbfd903465e06
Python
5,421
175
"""Optuna example that optimizes the hyperparameters of a reinforcement learning agent using A2C implementation from Stable-Baselines3 on a Gymnasium environment. This is a simplified version of what can be found in https://github.com/DLR-RM/rl-baselines3-zoo. You can run this example as follows: $ python sb3_sim...
2e3ec60df8b61a254fc7044408d2dd3c8d0b919baad55e5f103821bf06648878
Python
5,422
154
# -*- coding: utf-8 -*- """Dcm2niix class""" import logging import os import shlex import shutil import tarfile import zipfile from glob import glob from dcm2bids.utils.io import valid_path from dcm2bids.utils.utils import DEFAULT, run_shell_command class Dcm2niixGen(object): """ Object to handle dcm2niix exec...
3427c0ac48174434c93dcd918c9a5b5db596b9e9a27d1ddd1a472a38c292eb28
Python
5,422
146
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import pathlib import torch from esm import Alphabet, FastaBatchedDataset, ProteinBertModel, pretr...
c0d79800b2489e4f9f310cccfdc3a7c7c6aea75551bd1e69312005d086e3f703
Python
5,422
121
''' Description: Run MIOFlow on single-cell data. ''' import matplotlib.pyplot as plt import numpy as np import pandas as pd import scanpy import torch import sys sys.path.append("MIOFlow_model_revised") from baseline.MIOFlow_model_revised.running import trainModel, makeSimulation from benchmark.BenchmarkUtils im...
4ea0c7cbd2fd27fac448c4792104a1e6c96fbe1f48aa695323f92b216ac2971d
Python
5,424
73
"""SIGN_PATCH.py 2026-09-30. Writes a small, standalone sign patch for Shiu et al.'s Connectivity_783.parquet: every antennal-lobe local neuron inhibitory except those a laboratory has shown to be cholinergic (the 'lab prior', F4 of HEAD_TO_HEAD: 50/50 glomeruli healthy, real-fly r 0.736, taste unchanged, the only cond...
ff180071d14aaf440d63087f8bdf0053d86f7cfdd7db0024844945711445dd4a
Python
5,424
158
""" pygments.formatters ~~~~~~~~~~~~~~~~~~~ Pygments formatters. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re import sys import types import fnmatch from os.path import basename from pip._vendor.pygments.formatters._mapp...
96af92c131b7e37c5ecbd9ce6d184e4f69d3ab610c8853554826f605b91b4e91
Python
5,425
176
"""Module to filter the data. """ from logging import getLogger from itertools import product from numpy import arange, empty, ix_, expand_dims, squeeze from scipy.signal import (iirfilter, iirnotch, filtfilt, get_window, ...
c6a9db6833d1a3415cb64ef88e8bcee28c62dc208dbe997c04cb123a1a534fef
Python
5,425
196
"""Get E3FP default parameters and read parameters from files. Author: Seth Axen E-mail: seth.axen@gmail.com """ import os import copy import ast from configparser import ( ConfigParser, NoSectionError, DuplicateSectionError, ) CONFIG_DIR = os.path.dirname(os.path.realpath(__file__)) DEF_PARAM_FILE = os....
c7fd242e5fa25f5ef98424310ef43709f25a93aff68d6c39fd161d7d9a0f19af
Python
5,425
145
import torch from torch.optim import Adam import yaml from combust.layers import get_activation_by_string from combust.models import NewtonNet from combust.train import Trainer from combust.data import parse_ani1x # torch.autograd.set_detect_anomaly(True) torch.set_default_tensor_type(torch.DoubleTensor) # settings...
ffb94f8c7378bca48b057f09924563cb1bae15646670ce7473d2b6fe307f0908
Python
5,425
131
import os import logging import numpy as np from typing import List, Optional from lightning.pytorch import Trainer from lightning.pytorch.callbacks.model_checkpoint import ModelCheckpoint from lightning.pytorch.strategies import DDPStrategy from cellmincer.datasets import build_datamodule, wipe_temp_files from cel...
402020da42da7e56e6b923ec72684880b135803c93481b1aa2848a12a6d861c6
Python
5,426
136
import os from scipy.io import loadmat import numpy as np import pandas as pd import torch from sklearn.model_selection import train_test_split from datasets.SequenceDatasets import dataset from datasets.sequence_aug import * from tqdm import tqdm #Digital data was collected at 12,000 samples per second signal_size = ...
c6ec86e17bc51904f25b4bc0d2c2e397665d9d72f939e07923b0828761935ce8
Python
5,426
108
import pickle as pk from os.path import exists, join as joinP from copy import deepcopy import pandas as pd import matplotlib.pyplot as plt import numpy as np from sklearn.metrics.pairwise import manhattan_distances from utils_general import fitting_tsne, sim_matrix def plot_ppty(df_info_val, X_tsne, colours, alph=...
e4d7bf0bd2c8680bc1a376f0229cc1eb543e59fa676297f13708dc32f57aae4f
Python
5,427
138
""" ====================== Run PREP in stages ====================== :meth:`~pyprep.PrepPipeline.fit` runs the whole PREP pipeline in one call, but sometimes you want to drive the individual stages yourself, for example to log progress, plot intermediate results, or decide what to do with bad channels *before* commit...
f8bee1896a98c6c0aa51556a79254b557ef63ee478fafbeb02225e308eed34a4
Python
5,427
115
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2024 Clinic for Diagnositic and Interventional Radiology, University Hospital Bonn, 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 ...
5d47d9819ad823eb8d3bb94ea8a0814fffc110ee71d1bcb9c5b799c01c50e826
Python
5,430
138
"""Write the report's tabular data as spreadsheet CSVs under ``<output>/report_csv/``. The interactive report is self-contained HTML, so its derived numbers (per-region counts/density/enrichment, hemisphere split, regional volume change, QC checks, solver convergence) otherwise live only inside the page. This modu...
c7b6386c6dfec3a225da895f04a7f312cebfc853a13200e6ecac8ff65a49f850
Python
5,431
170
import warnings from collections.abc import Callable, Iterable, Sequence from dataclasses import dataclass from itertools import starmap from typing import Any, Protocol, TypeAlias, override import elasticai.creator.function_dispatch as FD from elasticai.creator import ir from elasticai.creator import plugin as _pl fr...
2ae9f20c27c1d1f6c491dfe9f64427cf987920b2b210ff649a2b61f8c9470764
Python
5,433
115
import argparse import collections import pandas as pd from mode import * from utils import set_random_seed import logging from parse_config import ConfigParser SEED = 1126 set_random_seed(SEED) #run main using a gridsearch def main(config): logging.info('Using Random Seed {} for this experiment'.format(SEED)) ...
6cf950aaaae1aa346e886e67c09e898b78c4d5c437834501d5400a24707ace30
Python
5,434
181
#!/usr/bin/env python # -*- coding: utf-8 -*- from cellsim16popsParams_modified_regular_input import multicompartment_params from plot_methods import network_sketch, plot_population, plot_signal_sum import analysis_params from hybridLFPy import CachedNetwork import plotting_helpers as phlp import os from matplotlib imp...
0cbcd2caa2935eac7f32da5b737175fdecc40605a00d770912f37a199fca98d1
Python
5,436
182
"""Core recipes for the tblite code.""" from __future__ import annotations from importlib.util import find_spec from typing import TYPE_CHECKING from monty.dev import requires from quacc import job from quacc.runners.ase import Runner from quacc.schemas.ase import Summarize, VibSummarize from quacc.utils.dicts impo...
323d214c6ed8ec1577e23be17b2561aff9bb90d8147d8bc1b8bb418428c0b24b
Python
5,436
139
import numpy as np import pandas as pd import pytest from cuppa.classifier.cuppa_prediction import CuppaPrediction from cuppa.constants import PREDICT_NA_FILL_VALUE, CLF_GROUPS from tests.mock_data import MockTrainingData, MockCuppaClassifier from cuppa.classifier.cuppa_classifier import CuppaClassifier from cuppa.cla...
26b6b2545e692c2ed3d34a884f16df580c218711c5d7f4a5c43be146e7268222
Python
5,437
72
"""ORN_COUNTERFACTUAL.py 2026-09-23. Pre-registration: 04-NOTES/PREREG-2026-09-23c-ORN-COUNTERFACTUAL.md""" import os, re, numpy as np, pandas as pd, scipy.sparse as sp from scipy.sparse.linalg import eigs R = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) L = [] def p(m=''): L.append(str(m)); print(m, fl...
41e920ec30458f32896384d25e5423ae0981dc41687b276756f44adccb71453f
Python
5,437
151
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
8a66e676f35d4807ce4bc145e1c6e6561e22cc362ebff891f3f06346d023ac63
Python
5,438
149
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 15 15:28:55 2024 @author: felipe """ import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import scipy.io as sio import sys import os sys.path.append(os.path.abspath('../../')) sys.path.append(os.path.abspath('....
f7ce6fb5ae178a202640ccd32c95c2258dd49ba64451263623c0f69b827d20e5
Python
5,438
153
# EyeNED OCT-ONH segmentation and feature extraction # Copyright (C) 2024 Erasmus MC # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your optio...
e975729ee7d744604d2597e62c993619d92475f7ef8070a0b082cd437c60f633
Python
5,439
108
#!/usr/bin/python from __future__ import print_function import socket import sys import os import subprocess use_multiprocessing = True if use_multiprocessing: import multiprocessing max_cpus = 2 # We might want to not run on the full number of cores, as Rosetta take about 2 Gb of memory per instance ######...
5560d0343cf607494e38a296a937437b9e176e99b4ae346ee7c4ee304500f915
Python
5,440
156
#!/bin/env python import tensorflow import deepexplain import click import csv import logging import gzip import numpy as np # options @click.command() @click.option('--sequence', 'sequence_file', required=True, type=click.Path(exists=True, readable=True), he...
2dc003ef1389bb3162355456cfc79c02f416f40842454b61be005af57f09839b
Python
5,442
168
import numpy as np import jax.numpy as jnp import jax from netket.stats import Stats from tre_tvmc.driver.utils import print_mpi class TrackBestModel: def __init__(self, monitor: str = "mean"): self.monitor = monitor self.best_loss_value = np.inf self.best_loss_stats = None self.b...
d96fb3998a76145195fb112b7132aef1b9d3307a3a4427547b07ebc386cf0b3d
Python
5,442
125
options = dict( verbose=True, model_extensions=[ 'h2o.model.extensions.VariableImportance', ], ) def update_param(name, param): if name == 'stopping_metric': param['values'] = ['AUTO', 'AUUC', 'ATE', 'ATT', 'ATC', 'qini'] return param if name == 'distribution': para...
814e568ce0111f855d9e277cad6cb36d51d8c8cc7c7b935b404bce1d910c456b
Python
5,443
131
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 12 11:32:51 2018 @author: Carlos Atico Ariza, PhD """ # Creation of pandas DF with features for each image at botleneck # imports the FeatureGen class found in the generate_features.py module import os from generate_features import FeatureGen from p...
f78c52f5e92ca17248a89c5fa2fe1f1bd2ee5cec7bc9a07f6a92c26e0160e449
Python
5,443
127
# set QT_API environment variable import os os.environ["QT_API"] = "pyqt5" import qtpy # qt libraries from qtpy.QtCore import * from qtpy.QtWidgets import * from qtpy.QtGui import * # app specific libraries import control.widgets as widgets import control.camera as camera import control.camera_TIS as camera_tis impo...
dc3fd8a216eaa2d411fe41bf47e2fb76d7563bdc3c00db4e80f52af1f4baee75
Python
5,444
157
""" @Mariellapanag Created on Feb 2023 @author: mariella Functions for computing abnormalities from continuous iEEG data. Includes power signal : compute power of signal energy_range : compute energy range for each signal get_cycles: obtain cycles using bandpass filter TODO: """ # internal modules i...
9b016f6c20051312f99f9728bb88f3c00729530e3ebdc711e23cfd84353df488
Python
5,445
154
# Node-group asset "Dihedral Angle" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKIN...
12796366b4ac72aa7705e9982ce2d613f54e94f1a470d494485e4527e9ba9561
Python
5,446
120
"""Source order of get_library_data: GitHub first, then the cached copy, then the packaged copy. The registry URL is pointed at a real local file (a file:// URL, which urllib serves like any other) so these tests never reach the network, and each test uses its own cache folder. The module constant is set directly in e...
27ca0c5e7a232921126dcf8162b03b3ca08a721595030d5b7760a98c4750af1b
Python
5,446
169
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
ca3a693119a13b73cf5bb23a001984554ea977e4dee1dddf93e09ecbd4b3a702
Python
5,446
152
import os import argparse import json import xml.etree.ElementTree as ET from typing import Dict, List from tqdm import tqdm import re def get_label2id(labels_path: str) -> Dict[str, int]: """id is 1 start""" with open(labels_path, 'r') as f: labels_str = f.read().split() labels_ids = list(range(1...
76c96d60f4fe169f8502b4d85d4b0abf7d551b228a3e80270c5efc566d1d22fc
Python
5,447
132
import argparse import numpy as np import torch import torch.nn as nn import torch.optim as optim import random from dataloaders.data_loader_general_para import NetTrainDataset, NetTestDataset from torch.utils.data import DataLoader from tqdm import tqdm from pathlib import Path from model.resinf import ResInf from eng...
b58b0843112c285d023bbc754c820a0c0c8a43a395955f19cea17654c8502e09
Python
5,450
156
"""Each encoder should have following attributes and methods and be inherited from `_base.EncoderMixin` Attributes: _out_channels (list of int): specify number of channels for each encoder feature tensor _depth (int): specify number of stages in decoder (in other words number of downsampling operations) _...
eb142e82f03050ea8fd423e1eb33ba966f61a0e34b6b448750420ae0cfebb378
Python
5,450
133
import numpy as np import pandas as pd import h5py import os import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt from collections import Counter import seaborn as sns fig = plt.figure(figsize=(10, 5), dpi=500) plt.rcParams.update({'font.family': 'Arial','font.size': 12, 'font.weight': 'normal'}) gs ...
2e5e6d59e6dbdf3fb32feaaa7b49021756d90a92af30112876a8abcfa333f594
Python
5,452
161
# Plots probabilities/decision boundary to classify preferential parameters # for Fig 7B from os.path import join from get_paths import * import classification import numpy as np import matplotlib.pyplot as plt from TVATAnalysis import TVATAnalysis from colors_paultol import cmap_iridescent as cmap import ...
73e562a34050636a8053df6f77420e2314192ab0dde37634e5c0c49eea6baaf5
Python
5,452
138
import librosa import numpy as np import os import random import pickle from tqdm import trange def process_google_sample(sample_path,frame_length = 0.04,frame_shift = 0.02,n_mfcc = 40): if(type(sample_path)==str): signal, sr = librosa.load(sample_path,sr=16000) else: signal=sample_p...
bbfd33bc86d098ca61cd59bcfbfad74b079fe85b808ff2e4d56c96526b428399
Python
5,454
118
import torch import torchvision from torch import Tensor from typing import Callable, List, Literal from .trainingwrapper import TrainingWrapper class SpatialSoftmax2d(torch.nn.Module): """Non-linearity like layer that applies a softmax in a local neighborhood. Shape: - Input: `(N, C, H_{in}, W_{i...
cc79c44617ee6e6bcac8cde481d00eb34758162a947f3291f8302de32d0d58e2
Python
5,454
165
from pip._vendor.packaging.specifiers import SpecifierSet from pip._vendor.packaging.utils import NormalizedName, canonicalize_name from pip._internal.req.req_install import InstallRequirement from .base import Candidate, CandidateLookup, Requirement, format_name class ExplicitRequirement(Requirement): def __in...
0440a20fc4cc29824ba2b9a2539d57b9672fa9dc957a13fd4d2d81fedbc31248
Python
5,455
130
import numpy as np import filenames import read_files import write_files import main_config as conf import optimiser import printer def prepare_procedure(mode: str, algorithm: str, dataset: str, test_id: str): """ Offline preparation for real-time VMD-based mode removal and pre-processing :param mode: 'I...
a61d763be6adb63480678e7a8d537a2a08a1fe0e4697a859207a93d18219e471
Python
5,456
117
import scanpy as sc import anndata as ad import numpy as np import pandas as pd import Cell_BLAST as cb from time import time import random from memory_profiler import memory_usage cb.config.N_JOBS = 4 cb.config.RANDOM_SEED = random.randint(0, 10000) def my_func(adata): sc.pp.filter_genes(adata, min_cells=3) ...
fce01f790f211b8e3f14873d9fef69f83501a49ce367eb540134d336861c8035
Python
5,456
114
import os from typing import Tuple, Union import pandas as pd from sklearn import model_selection from torcheeg.datasets.module.base_dataset import BaseDataset from ..utils import get_random_dir_path from .utils import create_subset, ensure_cache, read_indices, write_indices def train_test_split_per_subject_cross_t...
8d20b8c5f2dd70c35bb5b587b69cdb16435ad16ee4bdffff9ec627d780bf0045
Python
5,457
207
import os import pathlib import tempfile import functools import contextlib import types import importlib import inspect import warnings import itertools from typing import Union, Optional, cast from .abc import ResourceReader, Traversable from ._compat import wrap_spec Package = Union[types.ModuleType, str] Anchor ...
626b20c309c42938d26b44d50a730a55b9c087e70f090a4d1e0085fe64e61ed7
Python
5,458
121
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
81b86b05622ddd4a754a620e5fdfb5537b964e7299b0f0f515ff5a5047599c83
Python
5,458
131
"""Tests for damped-FPI inversion of the Laplacian pull field at points. The Laplacian PDE produces a *pull* field ``d`` such that the volume warp is ``refined[T] = reg_vol[T + d(T)]``. To move a point ``P`` in registered space through the same warp we need ``F`` with ``F + d(F) = P``. Plain FPI (3 iterations)...
77729139593fa5c9453c843d67f9f41bbfa22db7785c73c473920c83ea4c713b
Python
5,459
168
""" From a mask with sources and sinks computes the max flow network within a GraphMCF Input: - GraphMCF (pickle file) - Mask (1-sources, 2-sinks, othwise-background) Output: - Max flow network stored as edge GraphMCF property """ __author__ = 'Antonio Martinez-Sanchez' # ################...
087638c824dbb894c24c1ad76ceafa19e31e55e7d9433f70d8c2889c5a4be73f
Python
5,460
126
import logging from typing import Callable import torch from torch.utils.tensorboard import SummaryWriter import torch.nn as nn from torch.optim import Optimizer from torch.optim.lr_scheduler import _LRScheduler from tqdm import tqdm from .nt_xent import NT_Xent from chemprop.args import TrainArgs from chemprop.data i...
0dee9ed4df54c5cdc0f6e0aad14ced74f1418d3bde2accbe920ff63974f2ce34
Python
5,460
202
import numpy as np from autograd.builtins import SequenceBox from autograd.extend import Box, primitive from autograd.tracer import trace_primitives_map from . import numpy_wrapper as anp Box.__array_priority__ = 90.0 class ArrayBox(Box): __slots__ = [] __array_priority__ = 100.0 @primitive def __...
a3062fc6615378fbe858f74904d986935bbce9f1eeda9a711261175e946b8068
Python
5,460
166
models_to_run = [ 'alexnet_classification', 'vgg16_classification', 'resnet18_classification', 'resnet50_classification', 'resnet101_classification', 'resnet152_classification', 'squeezenet1_0_classification', 'densenet121_classification', 'googlenet_classification', 'shufflenet_v2_x1_0_classification', 'mob...
c0c9fe9b8523780c2073800d530eb56584b00c86efb33bdff32c31a26bfcb0e7
Python
5,460
128
import torch from .decode_strategy import DecodeStrategy def sample_with_temperature(logits, sampling_temp, keep_topk): """Select next tokens randomly from the top k possible next tokens. Samples from a categorical distribution over the ``keep_topk`` words using the category probabilities ``logits / samp...
d07eaf052d3465ce5ff6cd67d0bf4d152336d5abbbfd630602282ff40afb2bc4
Python
5,460
135
import os import imageio.v2 as imageio import numpy as np import pytest from regtools.atlas.registry import TEMPLATE_IMAGE, ANNOTATION_IMAGE from regtools.geometry_registration import pipeline from regtools.geometry_registration.types import RunParams, RunResult from regtools.utils.io.volume_io import load_n...
52eafb4a5d2d3830b852ded6119380e13d22865fd3f07497a859cd0a5cf2abd7
Python
5,461
185
import pandas as pd import numpy as np import pandas as pd import torch from torch.utils.data import Dataset from utils import Seq2Tensor, reverse_complement class TrainSeqDatasetProb(Dataset): """ Sequence dataset. """ def __init__(self, ds: pd.DataFrame, use_re...
c092585d34a8b49f3cbc2315b19de675b98eafa270610c91cc9cc3460299a22a
Python
5,461
163
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
185a0458733e189c9556bdcd7c3a03202d8375979698943aab9011ad0973d54b
Python
5,462
160
#!/usr/bin/env python3 # -*- coding: utf-8 -*- '''This script performs statistical analyses on decoding coefficients transformed into patterns of activity using cluster based permutations.''' # Setup directories proj_name = 'MINDLAB2020_MEG-AuditoryPatternRecognition' wdir = '/projects/' + proj_name + '/scratch/work...
c1087c7b92e33cc1902ea527d79ca08071d43b4e8feab9d49b0bf09d8111222f
Python
5,462
140
import anndata as ad import numpy as np import pandas as pd import pertpy as pt from pertpy.tools._perturbation_efficacy._mixscape import MixscapeGaussianMixture, _mixscape_gmm_predict_proba NUM_CELLS_PER_GROUP = 10 ACCURACY_THRESHOLD = 0.8 def test_mixscape(adata): adata.layers["X_pert"] = adata.X mixscape...
24ac43cfa61497719757485c7eb5be4cd6e7c606a76c804468b6a3ffd73b50da
Python
5,463
131
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ import os import numpy as np import matplotlib.pyplot as plt from matplotlib import patches from fig_utils import * def fig5(root, psths, rts, gts, save_figure=True): il = 0 nk, nn, nt2 = psths.s...
dee23dce8c87095a761fec1115b87802a1518dad9886790f62bca1a127e0f364
Python
5,463
165
'''ShuffleNet in PyTorch. See the paper "ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices" for more details. ''' import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable def conv_bn(inp, oup, stride): return nn.Sequential( nn...
df3b994de4e9dd5518a716cf7b3db97eda428bb403249215b06e89d0b452053d
Python
5,463
178
from __future__ import annotations import gzip import logging import os from pathlib import Path import pytest from quacc.utils.files import check_logfile, copy_decompress_files, make_unique_dir LOGGER = logging.getLogger(__name__) LOGGER.propagate = True def test_make_unique_dir(tmp_path, monkeypatch): monke...
12e32d455dc4e2271b2fb5b945eb9be2615c37a69250dc8c3e3d4dbeb36eeecc
Python
5,464
189
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU...
376800b6eec1fda3f70db402db73a027fc41290e6fed5c5b865d47b36ff618db
Python
5,464
189
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU...
4ce5ebfc5c3e47cd7daa2ba4e9cdf1b70c769d6286286fd2739059e717edd99d
Python
5,464
189
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU...
848855b987a1352f8c380164bdf7fe4665214b827ec778f9215eb0b8e4991c48
Python
5,464
189
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICU...
a492ccd46d9075618bcaffc5ffee8e0a6f1c441d46bc1992f61c58706156c9f8
Python
5,464
125
import json import os import pickle import argparse import numpy as np import ramanspy as rp def run( image_type, num_endmembers=5, spectral_size=1000, mixture_mode='linear', image_size=100, realistic_endmembers=False, noise=False, noise_amplitude=0.1, ...
b405514bb10d3381286eaf08dffcabb416e20f6e3955e6ef6041884e6f293c0f
Python
5,464
138
"""The 2D foreground masker: GrabCut is the default for foreground_init + metrics. Wires the benchmark-winning seeded entropy GrabCut (``compute_entropy_grabcut`` with its default config = percentile 1-99.5 + Multi-Otsu-4 seed) in as the default foreground silhouette for 2D ``foreground_init`` (scale + centroid) a...
3acff8ba22235d669a6cff6e188bc88a692e7db8ea14fe9b3e4ab79bc9c4beec
Python
5,465
112
""" STABILITY_BOUND.py written 2026-09-07 FROM MEASUREMENT TO THEOREM. The placement conjecture says real inhibition sits where it suppresses excitatory recurrence. That is an observation. This asks whether it is FORCED. THE THEOREM PART, and it is classical two-population algebra, provable on a napkin. Mean-field...
f31c1d65f8ae98cd9d738acc359bf08d622dfa818a2d2cfd5f159d4253a5af08
Python
5,465
171
import control.RCM_API as RCM_API import json class NL5: def __init__(self): self.rcm = RCM_API.RCM_API() self.rcm.initialize_device(simulated=False) self.load_settings() def set_scan_amplitude(self,amplitude): self.scan_amplitude = amplitude self.rcm.set_float_pa...
4f9639ce6a4517789e1d04cd64ba5d90513908330c01fb45cd2b5f6049cce6c2
Python
5,466
159
# -*- coding: utf-8 -*- # # Short-time Fourier transform, uses np.fft as backend # # Builtin/3rd party package imports import numpy as np import scipy.signal as sci_sig import logging import platform # local imports from ._norm_spec import _norm_spec def stft( dat, fs=1.0, window=None, nperseg=256, ...
836232444514263a391e4bd7daa9e7c0458fae6450f38662af1963f768b9e297
Python
5,466
157
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Example plot for LFPy: Single-synapse contribution to the potential through head Copyright (C) 2017 Computational Neuroscience Group, NMBU. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as pub...
9127c8be8567ac5bf84f4f5ec13afecfb8042fdcb56a9b94770e80b57f69df9e
Python
5,466
154
from typing import cast import bpy import numpy as np import pytest from bpy.types import Camera, SpaceView3D import molecularnodes as mn from molecularnodes.utils import frame_mapper from .constants import codes, data_dir def _viewport_spaces(): return [ cast(SpaceView3D, space) for screen in bpy...
ad539af134fdd553db8d8720752344a569fba2e2cff0d952866456d666fbd746
Python
5,466
128
import numpy as np from .io import writeH5, readH5, readNd2, readXlsx from .image import imAdjust, imTrimBlack import matplotlib.pyplot as plt class tilesData: # input: nd2 and xlsx file # output: on-demand volume at given downsample ratio # assume zyx order def __init__(self, tiles_vol, tiles_info, ti...
fa0555c6b1030a2c3fe1ad289e2b9202e5c920d8900e6772e409db2fe4492836
Python
5,467
145
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...