sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
299181c52216ad8f20824515a7db127294adf112f2b0f7c7cd8bd54340eac222
Python
4,161
104
"""Region-list filter tests.""" import pytest @pytest.fixture def qapp(): from PySide6.QtWidgets import QApplication app = QApplication.instance() or QApplication([]) yield app def _two_region_volumes(tmp_path, shape=(3, 20, 30)): import nibabel as nib import numpy as np ...
31b52fd84a70982eaf58c8ca0fabd41653ac594b7bad81268e4e5b5a43efb503
Python
4,161
130
"""Base jobs for Onetep.""" from __future__ import annotations from typing import TYPE_CHECKING from ase.calculators.onetep import Onetep, OnetepProfile from quacc import get_settings from quacc.runners.ase import Runner from quacc.schemas.ase import Summarize from quacc.utils.dicts import recursive_dict_merge if ...
b35b0c54f82925f25c3a07736146ba8dda3786c9206d07c74c57274d2f81d60c
Python
4,161
93
"""Custom-annotation LUTs must not scale with the label VALUE. ``colorize_annotation`` indexes the LUT densely by label value, so a naive LUT is ``max_label + 1`` rows tall. Custom annotations are arbitrary user input and may carry raw Allen structure IDs (182305709) or instance-segmentation IDs, which would dema...
74caf8e36e3a4c71fbc688869c20c4a8384c462b7f2945f1190f837514814540
Python
4,162
117
# 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...
d0165da93f829f967ffef999090ab81392dbd840522dca24e8353fc76571017f
Python
4,163
123
# \file TestIntensityCorrection.py ## # \brief Class containing unit tests for module IntensityCorrection # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date October 2016 import os import unittest import numpy as np import SimpleITK as sitk import pysitk.python_helper as ph import niftymic.base.stack...
10cf15510bc496af3595863844de871873a39ee6d284c6bf0dc96dfd572849c9
Python
4,164
125
import networkx as nx import numpy as np from functools import cached_property from hippo.environments.w_maze import get_wmaze def transition(from_pose, action, valid_poses): direction_to_movement = { 0: np.array([1, 0]), # right 1: np.array([0, 1]), # down 2: np.array([-1, 0]), # left ...
4a14185e622974516fc5944933af425bda518e9378d1a976fb1ca71fd5964d69
Python
4,164
185
#!/usr/bin/env python #****************************************** # # SHARC Program Suite # # Copyright (c) 2023 University of Vienna # # This file is part of SHARC. # # SHARC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by #...
cbacef92e430b0e0a6ccd2134a61e97776457f9be726f1beb8924430efe4c462
Python
4,165
151
import tifffile import h5py import warnings import os TIFF_FORMATS = ['.tiff', '.tif'] H5_FORMATS = ['.h5', '.hdf'] LIF_FORMATS = ['.lif'] def read_tiff_voxel_size(file_path): """ Implemented based on information found in https://pypi.org/project/tifffile """ def _xy_voxel_size(tags, key): a...
208b98879695aa8fe6dfae4e01d97fb348afbe16f7d61d756ea92456b21c1140
Python
4,166
129
# 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...
56af35139de5351a165816e35bd86eb9128565c285c26450253717e729ec92c6
Python
4,166
124
# # 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,...
c8c47e605405602d73f21eba5010646ab2d3fb9bb1040e65c12eb06c7cf3a34a
Python
4,166
140
import platform import serial import serial.tools.list_ports import time import numpy as np from control._def import * # add user to the dialout group to avoid the need to use sudo class TriggerController(): def __init__(self,serial_number): self.serial = None self.platform_name = platform.system...
d6d1538996f7fbeaa5f3899fbcebbf2bfbb0556c88060881b5c738f906515c37
Python
4,167
139
#!/usr/bin/env python from __future__ import print_function import cProfile import pstats import numpy as np import argparse import pddlstream.language.exogenous as exogenous exogenous.EXOGENOUS_AXIOMS = True exogenous.REPLACE_STREAM = False from pddlstream.algorithms.focused import solve_focused from pddlstream.al...
40dcdd15100eb451143121f116f16303c299967c95996ae2386caf07572387ed
Python
4,169
65
"""REAL_PN_BADEL_WB.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02d-BADEL-WHOLE-BRAIN.md REAL_PN_BADEL on the whole brain (Shiu et al.'s file, conditions of HEAD_TO_HEAD) instead of the antennal-lobe cut-out. usage: python REAL_PN_BADEL_WB.py run | analyse (RW_PROCS, default 4; resumable)""" import sys, ...
e5a6a0d0e4f4abb742625ae184806ee286a35e7f2a1b0de086b389b8cc8a1aaf
Python
4,171
155
# 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...
93f0195a34da8ee02b569f7c5e707d94a2588bb271a677569687f2a7f3c78fd5
Python
4,172
67
"""TRANSCRIPTOME_TYPE_MAP.py 2026-09-23. Names only; no expression value is read here. Rules: 04-NOTES/PREREG-2026-09-23b-ADDENDUM-1.md. Output: 06-OUTPUT/transcriptome_type_map.csv (+ sha256).""" import re, gzip, hashlib, numpy as np, pandas as pd R = 'D:/eucys'; T = f'{R}/02-DATA/transcriptome' fz = pd.read_csv(f'{R...
6cf04aaec012c0e668e88ea8bc9679dfd03775e734243c9240ee47a9d25ed98a
Python
4,175
118
import numpy as np import pytest tifffile = pytest.importorskip("tifffile") def _write_tif(path, arr): tifffile.imwrite(str(path), arr) def test_load_source_tiff_dir(tmp_path): from regtools.ome_zarr_converter.loaders import load_source d = tmp_path / "sections" d.mkdir() for i ...
e9778a2b6542502f340ce8df52a9a1a79cdbd83b001f76a9f19dc8dcec74d42e
Python
4,175
124
# Node-group asset "Select Atomic Number" (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_C...
73808162e2f5b5616ff2ce94ff1c40138faf9081a64b52a7e2a7887d3800ff55
Python
4,176
100
import numpy as np import pandas as pd import os, re import matplotlib.pyplot as plt import matplotlib as mpl from os.path import join as pjoin import matplotlib.font_manager as font_manager import h5py # define path and params # make sure the dataset_path are modified based on your personal dataset download...
1c4285e2378d0efdef291f1f3ca402faaf389c2560f0034e6a371cae03480ca1
Python
4,177
118
# Node-group asset "Sample Mixed Vector" (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_CH...
22ec3f09ead127d6882d57ce0c20661bc8cf38300d6a20aeac1bb0264998c500
Python
4,177
95
""" This script computes the exact volumes where the sequences need to be cut @author: trianaa1 """ import os, re import pandas as pd path ="/m/cs/archive/networks-pm/cognitive" days = pd.read_csv(f'/m/cs/project/networks-pm/mri/fast_prepro_bids/participants.tsv',sep='\t') tr = 0.594 #create a dictionary that, for ...
57d7c1a6842d30305ecf71244781daf760af7398b13d6db097a20df0cf55b23f
Python
4,177
65
"""CHECK_MODEL.py 2026-10-03. The inequality as a tool. Give it the signs of a fly-brain model built on FlyWire v783 and, without simulating, it says whether the antennal lobe works, how far the model sits from the line, which single signs it cannot get wrong, and, if it is broken, the shortest list of corrections in t...
b1b9df1da582374daf94477457f2879ca9b225da9765c2696755043f35fbc9db
Python
4,177
149
from wonambi.trans import frequency, math from wonambi.utils import create_data from numpy.testing import assert_array_almost_equal from scipy.signal import hann import plotly.graph_objs as go from .utils import save_plotly_fig def test_trans_frequency_doc_01(): # generate data data = create_data(n_chan=2,...
27d38bf615cb24a664ee6a1480ac298d6f4735fe16949160fe8ffe67f4bfb536
Python
4,178
124
""" pygments.formatter ~~~~~~~~~~~~~~~~~~ Base formatter class. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import codecs from pip._vendor.pygments.util import get_bool_opt from pip._vendor.pygments.styles import get_style_by_nam...
3519e1ea0d444752647544e22c24289a9cf55fc0e70489eea1b2689e51a2033a
Python
4,178
124
## # \file parameter_normalization_test.py # \brief Class containing unit tests for module ParameterNormalization # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date Nov 2016 import os import sys import unittest import numpy as np import SimpleITK as sitk # Import modules import pysitk.simple_itk_help...
d8e32d7c4b04b7fed46c5d7efaf595b97cdc4e158a6cda666c3d72dacb6d6f40
Python
4,178
105
import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy import stats from tabulate import tabulate from src.analyze.utils import init_mpl from src.utils import map_to_score_grid from src.preprocessing2.process_ratings import merge_rating_files from constants import DATA_DIR, SCORE_COLUMNS, CI...
4478141aef3b9dfa3716182620536246ab88d91ccd833c2579e8bafb1caa736f
Python
4,181
107
'''Preprocess events from the presentation logs to the BIDS events file for the PVT task. Parameters ---------- path : str path where the raw data is stored savepath : str BIDS folder ''' import os, sys import re import pandas as pd from glob import glob path = sys.argv[...
7eb1981138929e96b2d7eef4d4381fd5544d56eb9728da5660830a38240e7f2c
Python
4,181
116
# Node-group asset "Fade Geometry" (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_CHECKING...
8b34635bea12580c8ee9a771979a8a43efadfa0d79a4eedef1f1bcbca1a58a02
Python
4,181
110
"""Regression tests for ``_aggregate_cell_csvs_to_root``: the pipeline step that rolls per-points-file cell CSVs (``registered_points/<stem>/``) up to the run root, where the HTML report and its unassigned-cell QC chip read them. Guards the report-integration bug where the cell-metrics half of the report was sile...
010d3a308206abe29de787a96aca3e1bcd1c162c28cd6205aa888b4eaf57eb8d
Python
4,182
133
# 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...
b2c1cae66b211a3a298a973b3954b86e2df6948f366201380162c8a06c147b90
Python
4,187
114
# 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...
29d31d2ab50d9e2255c7df68bfe1cc495ef9c414d41c0257f8c4060a8739467a
Python
4,188
126
# Node group ".Accumulate Domain Transform" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors...
5c905b0802af2be0429291f6f0988e1772ca3b58a321d2c16d663ee64a256b18
Python
4,188
119
import numpy as np from sklearn.model_selection import StratifiedKFold, train_test_split from base import BaseDatasetsManager from utils.logger import get_logger from .sampler import SubsetWeightedRandomSampler, SubsetSampler, BootstrapSubsetSampler class METABRIC_Datasets_Manager(BaseDatasetsManager): ''' A ...
c9fe76ff2e701cb729e69d503af2040077de8db72ba5ac84403ca634a8185700
Python
4,188
136
# 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...
cf1ba20223a1691355169eb0b1c22b2c5edfbd2a1d81e9941da29c596695b13c
Python
4,188
119
################## ### Parameters ### ################## import argparse parser = argparse.ArgumentParser(description='Using models trained with singleDeep to predict new samples phenotypes') # Define the parameters and default values parser.add_argument('--inPath', type=str, help='Folder with the input data (output ...
bb8cac7cc9c4afd5f9c93ed8747ea86abb8f8f77562330b750aa74a26e702bb9
Python
4,189
127
''' Script that handles PLEC data input for the DNN. NOTE: It's very important that the ML table that you use lines up with the PLECs. So each line number in the ML table should correspond to the line number in the PLECs .npy file. ''' import numpy as np import pandas as pd import torch from torch.utils.data import Da...
09bd81b5217853b710d319906c98f3eade278621dd552313d5b424e0a13c7806
Python
4,191
182
from __future__ import annotations import importlib import platform import sys CHECKS = [ ("numpy", "NumPy"), ("pandas", "pandas"), ("scipy", "SciPy"), ("skimage", "scikit-image"), ("sklearn", "scikit-learn"), ("cv2", "OpenCV"), ("matplotlib", "Matplotlib"), ("seaborn", "seaborn"), ...
38a79f310bb5c4420d6ae03e945f0816331d45e003b991246a455af8c6f84f70
Python
4,191
227
OPTIC_LOBE_INTRINSIC_TYPES = { "Centrifugal": ["C2", "C3"], "Distal Medulla": [ "Dm1", "Dm10", "Dm11", "Dm12", "Dm13", "Dm14", "Dm15", "Dm16", "Dm17", "Dm18", "Dm19", "Dm2", "Dm20", "Dm3p", "D...
aa930b5beeba18f0c551bba4f4093fc44cd5d98d1ac3575960b81c4671bb7651
Python
4,192
106
"""Define mention classifier class.""" import logging from pathlib import Path from negbio.pipeline import parse, ptb2ud, negdetect from negbio.neg import semgraph, propagator, neg_detector from negbio import ngrex from tqdm import tqdm from constants import * class ModifiedDetector(neg_detector.Detector): """Ch...
0b82e9419351ff643b6c626195aa86070ff7f97e73eb777082a07060ec039988
Python
4,194
118
import timm import functools import torch.utils.model_zoo as model_zoo from .resnet import resnet_encoders from .dpn import dpn_encoders from .vgg import vgg_encoders from .senet import senet_encoders from .densenet import densenet_encoders from .inceptionresnetv2 import inceptionresnetv2_encoders from .inceptionv4 im...
478833c1623657759d197c879329eb72f39e295bb45ff165f6a368e8f07dc39c
Python
4,195
138
# -*- coding: utf-8 -*- """(Keras) Layers for radial basis functions""" import numpy as np import tensorflow as tf class CutoffFunc(tf.keras.layers.Layer): R"""Cutoff function layer The following types of cutoff function are implemented (all functions are defined within $r_{ij}<r_{c}$ and decay to zero...
9fa84fc33e2c13dd12f214b47355e4fdfe6a7b24fb45b22c04f2bf6aab4813d2
Python
4,195
129
# 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...
f88e526ad639b96aeb71f3512e444e18e5aa88d6e01ceb2deead1d06619d40b4
Python
4,195
103
import sys import traceback import numpy as np import csv import os import ray ray.init(num_cpus=16) from joblib import Parallel, delayed from scipy.stats.stats import pearsonr from src.utils import parse_config, contain_substr, logger os.environ['KMP_DUPLICATE_LIB_OK'] = 'True' @ray.remote def gen_optical_feature...
6d3111582182918dd6802dbf18c8bfd0ad029fab031881290b54321104719d49
Python
4,196
88
import numpy as np from pathlib import Path class Kilosort: """Class to represent data from Kilosort2 at different levels of curation""" KILOSORT_PATH = "/data/MEAprojects/DLSpikeSorter/{recording_name}/spikesort_matlab4/kilosort2_results" CURATION_PATH = "/data/MEAprojects/DLSpikeSorter/{recording_name}...
ebaf7abf0ad968270a0fc0fb3bb35dca8a4de8df40712605b16925ebb56f01a6
Python
4,196
116
import pandas as pd import os from tqdm import tqdm from typing import Tuple from constants import N_ITEMS, USER_RATING_DATA_DIR, MAIN_LABEL_FILENAME from src.utils import map_to_score_grid __all__ = ['create_label_files', 'merge_rating_files'] _COLUMNS = ['assessment_id', 'prolific_pid', 'drawing_id', 'FILE', 'part...
087aeaa41e7d64e36a780274114ce23bef51913cc86c56661b39926e6da8075b
Python
4,197
127
import logging import warnings from torchdrug.core import Registry as R from torchdrug.utils import pretty class LoggerBase(object): """ Base class for loggers. Any custom logger should be derived from this class. """ def log(self, record, step_id, category="train/batch"): """ L...
33f4922b070acdce9c44faf7eb0eceb86e374d4ea1e2dc54963b1dd19ef9e7f7
Python
4,197
123
''' Create union of the input newtorks such that the new network contain all the nodes and edges from the input networks. If one edge appears in multiple netwroks then take the highest weight. (Ref: BIONIC (Methods: Obtaining integrated results)) ''' import sys import json from pathlib import Path import panda...
868c922bdae4af25b0efc41dcb00ac0d5785a7aefc84deb153ce05dd9aaa1a68
Python
4,199
125
# Node group ".MN_topo_assign_backbone" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are...
88f9e76b8d56f96a5f564a9580917dbfc1f9f65aa8445382f0275aa118d173a7
Python
4,199
152
import cocotb import pytest from cocotb.clock import Clock from cocotb.triggers import RisingEdge from elasticai.creator import ir2vhdl as ir from elasticai.creator.ir import Registry, attribute from elasticai.creator.testing.cocotb_pytest import ( CocotbTestFixture, eai_testbench, ) from elasticai.creator.tes...
253566f2b24dbac5125ec0b5d706327159e86b359a7c9c33a5e08001ff17c3b1
Python
4,201
129
# 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...
4b37ac09914296708683ac7012a1ab71058b3ee2ed91e2b9aec3812b9257d836
Python
4,201
112
from ngclearn import resolver, Component, Compartment from ngclearn.components.jaxComponent import JaxComponent from jax import numpy as jnp, jit from ngclearn.utils import tensorstats def _run_cell(dt, targ, mu, mask): return _run_gaussian_cell(dt, targ, mu, mask) def _run_gaussian_cell(dt, targ, mu, mas...
1959392608d720a692614429c9f8e218ef225d74a8d0841323a88f091ffd1f9e
Python
4,202
72
#! /usr/bin/env python # -*- coding: utf-8 -*- #! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, geometric_mean from common_setup import IssueConfig, IssueExperiment, DEFAULT_OPTIMAL_SUITE, is_test_run BENCHMAR...
5a1548331683887c70e124ba1c52b20f0f60d0eed370b94c037dcd0d0a2dc313
Python
4,204
150
#!/usr/bin/env python import os import warnings import pandas as pd import matplotlib.pyplot as plt from nltools.data import Brain_Data from nilearn import plotting as nplot warnings.filterwarnings("ignore") # suppress warnings # ------------------------------------------------------------------ # paths # -------...
7276919bf263eb42e7245ff6b025b5660f86c86552471405525b31933d98a038
Python
4,205
136
# 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...
ffed63c12b4adf69d0bea334d216e21542af2f42d7bdad8aed10ed786eb677bd
Python
4,205
166
import math import matplotlib.pyplot as plt import numpy as np import meep as mp # True: plot the scattered fields in the extended air region adjacent to the grating # False: plot the diffraction spectra based on a 1d cross section of the scattered fields field_profile = True resolution = 50 # pixels/μm dpml = 1...
9c531c1954123f6735fb8282fd8afcdf8d3ccda328d1c2008b6cc3454139b7bc
Python
4,206
129
from collections.abc import Sequence from typing import TypeAlias, cast import numpy as np from numpy.typing import NDArray FloatArray: TypeAlias = NDArray[np.float64] IntArray: TypeAlias = NDArray[np.int_] def blocker(array: FloatArray, multi: int = 1) -> tuple[int, IntArray, list[float]]: """Return the sample...
aa166bf700cc4c4b14c857067245d1e1b6bbd882999b8807e76b785b990253bd
Python
4,206
95
""" EFFECTOME_SOLVER_FLOOR.py - written 14 September 2026. VERIFY V-43 (rewritten). WHY THIS EXISTS --------------- V-43 used to read: V = np.load('.../eff_base.npz')['vec'] print(sub(V, V, 20), sub(V, V, 100)) # expect 1.0000 That compares an array to ITSELF. It returns 1.0 by construction, for ...
3cbf852dbf292d64fd3930c152a17f07bc97381fd08a9099838ed6db86f29e64
Python
4,207
105
import numpy as np from scipy.ndimage import zoom from plantsegtools.utils.io import smart_load, create_h5 from skimage.segmentation import find_boundaries from skimage.morphology import erosion from plantsegtools.postprocess import LMC_CONFIG_PATH import yaml import os import argparse def parse(): parser = argpa...
a2f41ce6ab1f09ebe0109fcc2626d97e90cb4e5373682a12040f4cc081287463
Python
4,209
110
""" Consolidate all processed information. Just copy over the matrices to directory results, in the appropiate name Also save the region names, which is not needed for the algorithm but is handy to have. Adapted from CreateTVB.m to python. Original script by: % Authors: Michael Schirner, Simon Rothmeier, Petra Ritter...
a758f7b7d101edfb9a14fa180a2fd98d3b7a9ed1acb232e0ef398789749686ac
Python
4,209
186
"""Fingerprint comparison metrics. Author: Seth Axen E-mail: seth.axen@gmail.com """ from __future__ import division import numpy as np from ..fprint import CountFingerprint, diff_counts_dict def tanimoto(fp1, fp2): """Calculate Tanimoto coefficient between fingerprints. Parameters ---------- fp1 :...
9319f1614ff3cdc3738e69ef2d608b16e8f8ebf27a82ddd94ea42a45cb865203
Python
4,210
120
# 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...
fbfa28efe086d6e10c4c2587a0277d03cce9ae99676318290845e742ee525bcd
Python
4,210
112
import numpy as np import pandas as pd import torch from torch.utils.data import Dataset from torchvision import transforms from constants import * from src.utils import map_to_score_grid, score_to_class from src.dataloaders.transforms import NormalizeImage __all__ = ['ROCFDataset'] _SCORE_COLS = [f'score_item_{i +...
9f88ee45f18ad9fdbc630cffb851e06de87fd07262ef4aef80a7218b62ad0a57
Python
4,211
139
from __future__ import division import operator import numpy as np import matplotlib.pyplot as plt from soundsig.plots import make_phase_image class ComplexPCA(object): def __init__(self, n_components=None): self.n_components = n_components def fit(self, Z, zscore=True): """ Does principa...
d0994a3abde6158e34a9c68eff1dfc34aa4351fee8f2f3660166aae5d00898f9
Python
4,212
78
import torch import torch.nn.functional as F import math def conv3D_output_shape_f(i, input_shape, kernel_size, dilation, padding, stride): """ Calculate the original output size assuming the convolution is nn.Conv3d based on input size, kernel size, dilation, padding and stride. """ return math....
8bd9b40b99a9291ed7ab9b6948033931b46750f4f95a316468fd004709971398
Python
4,213
113
import pytest from starlette.testclient import TestClient from sitetack.app.main import app client = TestClient(app) class TestMain: def setup_method(self): self.valid_data_one_sequence = { "ptm": "PHOSPHORYLATION_ST", "label": "NO_LABELS", "organism": "HUMAN", ...
3d1fa5f93a539123ecf1373b5044878b1a12dc95fa0d4046b7da865c11726fa6
Python
4,215
107
""" DeepLabCut2.0 Toolbox (deeplabcut.org) copyright A. & M. Mathis Labs https://github.com/AlexEMG/DeepLabCut Please see AUTHORS for contributors. https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS Licensed under GNU Lesser General Public License v3.0 """ def add_new_videos(config,videos,copy_videos=False,co...
b8e723920f1dfb874ede27322cd2cb49f2effdda154699e5d2790a5487f6054a
Python
4,215
113
"""Digital down converter (DDC) function.""" import numpy as np from scipy.signal import decimate def filter_moving_average(signal: np.ndarray, decimation: int = 100, overlap: int = 8) -> np.ndarray: r"""Decimate data using a moving average filter. $kernel = e^{\frac{-1}{1 - x^2}} * \sin{2.073 * \pi \ x} / x...
f131e23b5d536e68309fbbb92be31ff73f42ce486d801e7d99d5ebd1349d954d
Python
4,216
106
# 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...
4d3eb668142915726cfe2fa055ef875b54451d70287277adaa088b7eea25a1cc
Python
4,218
135
import gzip import json import logging import os import numpy as np import pandas as pd import scipy.sparse from pandas import CategoricalDtype from cirrocumulus.util import dumps logger = logging.getLogger("cirro") LINE_END = "\n".encode("UTF-8") def write_jsonl(d, f, name, index, compress=False): output = {...
5bad2058f55642d0d758e86bc042d188d8291831e94904f53e67d943578b1d97
Python
4,218
117
# %% import os os.environ["CUDA_VISIBLE_DEVICES"] = '0' import numpy as np import torch from torch_geometric.data import Batch import pandas as pd from matplotlib.colors import ListedColormap from rdkit import Chem from rdkit.Chem.Draw import rdMolDraw2D from rdkit.Chem import rdDepictor rdDepictor.SetPreferCoordGen(Tr...
d547e1dab8d0a30e8ed467455961f827e3fc6630fac6cc65f255ebfb29f2063b
Python
4,218
111
# currently only runs locally due to reading in from command line (interferes with config) from sklearn.neighbors import KNeighborsRegressor from sklearn.linear_model import LinearRegression from sklearn.ensemble import RandomForestRegressor, AdaBoostRegressor from sklearn.gaussian_process import GaussianProcessRegres...
70aea8120dd60a0d10d79a20bfa49ebfa8b1f8a8dc3f4fe8a887de117b4039aa
Python
4,219
141
# Node-group asset "Backbone Positions" (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_CHE...
02a5db5a7c6548376a1f66953615d6f76dcde691dd7e8c8fcb926fa4cde4c909
Python
4,220
134
"""Class to import HRV RRI data in text format. """ from logging import getLogger from numpy import arange, cumsum, empty, float64, interp, newaxis from scipy.interpolate import splev, splrep from datetime import datetime, timedelta from .utils import DEFAULT_DATETIME lg = getLogger(__name__) class LyonRRI: """...
524bbc1c19bf764c4e2dac4104ea7655badb0af0213056c6a850111a2390b078
Python
4,220
69
import numpy as np import matplotlib.pyplot as plt import argparse from IPython import embed # Leser kommmandolinjeargumenter parser = argparse.ArgumentParser() parser.add_argument("-case", "--patient", type=str, default="C25") parser.add_argument("-res", "--resolution", type=int, default=16) args = parser.parse_args...
b9418a03556ff17671138de8b99f1cc1721a6f2c3c5b7cd0b4bb418ab3a812d7
Python
4,220
109
import torch from torch import nn from models import resnet def generate_model(opt): assert opt.model in [ 'resnet' ] if opt.model == 'resnet': assert opt.model_depth in [10, 18, 34, 50, 101, 152, 200] if opt.model_depth == 10: model = resnet.resnet10( ...
e8e743398526972a84bb00427ed70bdd584f43e351a15ca34c047aa1dd0ed0c7
Python
4,220
115
""" This script generates two plots to check the data quality for the eye-tracking data. The first plot is a distribution of the fixation duration. According to Mahanama et al. 2022, the duration of fixation in one point typically lasts between 30 and 300 ms, and may be longer depending on the cognitive load. The ...
ee93d78143c0e06e745f6495abd5685b8e4b96011b0a5713f422f61e4b7d845e
Python
4,221
77
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute, gm import common_setup REVS = ["issue548-base", "issue548-v2"] LIMITS = {"search_time": 1800} SUITE = suites.suite_optimal_with_ipc11() B_CONFIGS = { 'rl-b50k': ['--search', 'astar(merge_and_shrink(mer...
8a9264ca20960fedb070a93509a52a61bb378acd8e9bae2f9faa8b91ae914986
Python
4,223
119
from typing import List, Optional, Tuple import torch import hydra import pyrootutils import pytorch_lightning as pl from omegaconf import DictConfig from pytorch_lightning import Callback, LightningDataModule, LightningModule, Trainer from pytorch_lightning.loggers import Logger pyrootutils.setup_root(__file__, indic...
59081c7a65939d5cf6028e8f035f3077a310cedae7833eedad5292aace28497f
Python
4,225
99
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """check_tex.py —— main.tex 静态自查(无 LaTeX 编译器环境的替代验证)。 v6 起新增 5–7 项:占位符残留、arXiv 摘要长度上限、参考文献引用完整性—— 这三类问题都曾在"已定稿"版本里漏检过。""" import re from collections import Counter src = open('game/docs/arxiv/main.tex', encoding='utf-8').read() lines = src.split('\n') print('1) begin/en...
00453c544e921aee5abd8ba70974b0d097d5bdf3cf4949879c6fa71ee06bc910
Python
4,227
144
import os import pandas as pd import sys from typing import Tuple import uuid import numpy as np from matplotlib import pyplot as plt import torch def directory_setup(model_name, dataset, results_dir, train_id: int = None, resume: str = ''): """setup dir for training results and model checkpoints""" if resu...
4d867d885e3735ef3c7a22919fdb7c6225fc306c2ecfa0acedd76ab4b6e79dbe
Python
4,227
106
############################# # Import plotting functions # ############################# #%% plot p-values plot_p_values_markov(save=False) ######################################################################### #%% plot behavioral motif comparison for worm 3 with 3 cognitive states # #############################...
7967f2aa965b9777a232dcf9c0b2c3a18088255a5183810e0e40c2df784cec38
Python
4,228
51
"""DOMINANT_BANC.py 2026-10-02. Pre-registration: 04-NOTES/PREREG-2026-10-02m-DOMINANT-BANC.md Are FlyWire's dominant inputs (DOMINANT_INPUTS.py) the largest inputs of the same populations in a second fly (BANC v888)? usage: python DOMINANT_BANC.py""" import sys, os, time, hashlib, re sys.path.insert(0, os.path.dirname...
ff828b3d7147e83779caedee0e36ce6f4819e88a32549c908f7f5064c3c610b0
Python
4,231
101
#! /usr/bin/env python import argparse import os def str2bool(v): # susendberg's function return v.lower() in ("yes", "true", "t", "1") def read_position_file(positionfp, col_chrom=0, col_pos=1, header=False): posstrs = set() with open(positionfp, 'r') as rf: if header: ...
12c54c8ebe1ef0ac854445a9afc9688a85746430cf144339f58edfdbf03b6102
Python
4,232
98
from __future__ import print_function import argparse import os import sys sys.path.extend([ 'pddlstream', 'ss-pybullet', ]) from collections import Counter from learn_tools.learner import FEATURE, SCORE, CATEGORIES, TRAINING, POLICIES, SKILL from learn_tools.learnable_skill import read_data from learn_tool...
6355a792127708122800ed11c2a29344da4f44db18319a3611d311f2fee9419e
Python
4,233
141
#!/usr/bin/env python2.7 from __future__ import print_function import argparse import random from pddlstream.algorithms.focused import solve_focused from pddlstream.algorithms.incremental import solve_incremental from pddlstream.language.constants import PDDLProblem, And, Exists, print_solution, Imply from pddlstrea...
1685a6d3f34b820a32e0721fe0ca1046584d084f8834c91a4e372d7002701d70
Python
4,235
129
# 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...
16f1e64f9b87fbfba29ad473e611fd5426eded557e35e8b627dba96de8fa8fc8
Python
4,235
128
r""" The ``codes`` object defines a mapping from common names for HTTP statuses to their numerical codes, accessible either as attributes or as dictionary items. Example:: >>> import requests >>> requests.codes['temporary_redirect'] 307 >>> requests.codes.teapot 418 >>> requests.codes['\o/'] ...
6a7d023d2395bf8f3f99c277676130d2e07cd8cd7426a37c02b14031d563388a
Python
4,235
121
import torch import os from pytorch_lightning import LightningDataModule import numpy as np from lib import utils from torch.utils.data import DataLoader class TimeSeriesDataset(torch.utils.data.Dataset): def __init__(self, X, scaler, t_features, seq_len=1, horizon=1): self.X = X self.seq_len = se...
062c6382925238b7d971be610176ad247ad14815afae25da978276d81639cc49
Python
4,236
147
""" Optuna example that demonstrates a pruner for tf.keras. In this example, we optimize the validation accuracy of hand-written digit recognition using tf.keras and MNIST, where the architecture of the neural network and the parameters of optimizer are optimized. Throughout the training of neural networks, a pruner o...
68a845d1bb892dd8cc60ba87f513022562144ffa89cc2f40a39762bc36878cba
Python
4,236
110
import os import pybullet as p #from contextlib import contextmanager from control_tools.common import BASE_FRAME from control_tools.pb_controller import PBController from perception_tools.pb_perception import PBPerception from perception_tools.common import get_models_path from plan_tools.common import PR2_URDF from ...
05feabb2d390b18734337292d57b4e2f23ea637613f4afaedd0e7f3557b5d200
Python
4,237
115
import pandas as pd import torch import numpy as np import os from src.utils import map_to_score_grid, score_to_class from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler from torchvision import transforms def get_item_classification_dataloader(item_num: int, data_root: str, labels_df: pd.DataFra...
89d896dfef0a908e56d722b02efe555194051b18e61b2c96c2d4c60699f55e14
Python
4,237
135
from typing import Dict, List, Union import numpy as np from ..base_transform import LabelTransform class Binary(LabelTransform): r''' Binarize the label according to a certain threshold. Labels larger than the threshold are set to 1, and labels smaller than the threshold are set to 0. .. code-bloc...
960e5d627c06e1f8775c6b1c47b09c6871724bfa214a91dcd91f0c2ec0abb4e7
Python
4,238
105
from random import randint import matplotlib as mpl import matplotlib.pyplot as plt import torch import wandb def plot_random_datapoint(model, data, device, scalers): random_batch = next(iter(data)) random_data = random_batch["data"] dict_flag = False vae_flag = False if isinstance(random_data, dic...
dbbb5ecda987d81967bc0255303709f1888f81161e0d46f92cfdbd881e5a74f2
Python
4,238
95
import glob import os import pickle import re import numpy as np import pandas as pd from function_features import * import sys from choose_version import choose, chooselabel from constants import VARIABLE import h5py import argparse def main(): version = 20180409 arg_parser = argparse.ArgumentParser( ...
e01e29cfbbeae526705f501a41b6b1bd96fa5c7bd908e556c8195996bd1f6faf
Python
4,238
117
import scanpy as sc import numpy as np from sklearn import metrics from scipy.optimize import linear_sum_assignment import torch from torch import nn class ZINBLoss(nn.Module): def __init__(self): super().__init__() def forward(self, mean, disp, pi, x=None, eps=1e-10): if x is No...
e12903d663f9b16d9432f4a0734d4b038076c516fa17ab9fa1cb4f2b2e632d6c
Python
4,239
103
"""Bridge: turn an Allen CCF annotation coronal slice into the boolean contour ``atlas_edge`` array the vendored mousebrain pipeline consumes. This replaces ``mousebrain.atlas_segmentation`` (which extracts contour lines from a printed colour atlas plate) with crisp region boundaries computed directly from the in...
7915df447d527003f04be8e9450caa343a1b56607362d5145c610bdc3ad991de
Python
4,240
109
""" This script reads the .asc eyetracker files in a folder and extracts information about the fixation, saccade, and blinks for each file, following the guidelines in: https://risoms.github.io/mdl/docs/build/manual/EyeLink%201000%20Plus%20User%20Manual%201.0.12.pdf The script returns a dataframe with the information....
4d5d09a7721f50fce759e29a7394116a30e957f506ef80ed1c10513d4bf5c537
Python
4,241
104
# 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 # # ht...
61d4d8e652ba688ee73c844395129e1a4cf811057bcbf2b163b0fbfec2317fc8
Python
4,241
138
#!/usr/bin/env python """ Create long-format dataframes from the full ISC similarity matrices for each movie and Schaefer parcel. Each output CSV contains the correlation value for each pair of subjects. """ import pandas as pd from pathlib import Path # -------------------------------------------------------------...
dd6777e5a110e3aa1ee56cca4383e71cb4a12bafa9ce277b8e51739630716b9a
Python
4,241
70
"""AT_REST.py 2026-09-28. Pre-registration: 04-NOTES/PREREG-2026-09-28c-AT-REST.md Every ORN fires at its receptor's spontaneous rate (Hallem & Carlson 2006, DoOR row SFR). Does the model stay quiet at rest, as fly projection neurons do (1-5 Hz; Kazama & Wilson 2009)?""" import sys, os, glob, time, hashlib sys.path.ins...
27900f1c722eb32abcf2835fd95d342e1fbc9a6e49515be566b4059b0b2406ab
Python
4,242
97
import os import csv import math from collections import defaultdict from tqdm import tqdm from torch.utils import data as torch_data from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.OPV") @utils.copy_args(data.MoleculeDataset.load_smiles) class OPV(data.MoleculeDatas...