sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d403610ded9c2e4d3007992ad38dceed8bec64886ca3755a09e1c0b090ed324a
Python
1,937
62
# Node group "Hydrogen Bonding Partner" (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...
8f968b33d6bdc12c7a787d68cb8ef7a12909d3684658da6d065568e2cd60ff7d
Python
1,938
71
""" pygments.filter ~~~~~~~~~~~~~~~ Module that implements the default filter. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ def apply_filters(stream, filters, lexer=None): """ Use this method to apply an iterable of filter...
c3930e5c436c42ab0f72ce2daa3ddf1a7fd22a64ff11849c0bef81a081e2b271
Python
1,938
62
from setuptools import setup,find_packages,Extension from setuptools.command.install import install import numpy as np import os # read the contents of your README file with open('README.md') as f: long_description = f.read() print(long_description) class CustomInstallCommand(install): def run(self): pr...
5fb47a19e0187248d6513d618b080b9019aef04ef611af60a178a0eb93a5128f
Python
1,939
73
import numpy as np import sklearn.utils.linear_assignment_ as la from sklearn.metrics import accuracy_score from sklearn.metrics.cluster import normalized_mutual_info_score from sklearn.cluster import KMeans def best_map(l1, l2): """ Permute labels of l2 to match l1 as much as possible """ if len(l1) ...
90d5901864fd97211702cfba1e5356564be9ec41d69207130ae025b248d0b970
Python
1,939
72
from .basic_euclidean import eucl_dist import math import numpy as np PI = math.pi HPI = math.pi / 2 def ordered_mixed_distance(si, ei, sj, ej, siei, sjej, siei_norm_2, sjej_norm_2): siei_norm = math.sqrt(siei_norm_2) sjej_norm = math.sqrt(sjej_norm_2) sisj = sj - si siej = ej - si u1 = (sisj[0]...
e7c7519db1f5a33c52c8c46082999be1b7f92dc1b39cc154ab28d5d506ad3017
Python
1,940
64
import unittest from torcheeg.datasets import DTUDataset, DTUProcessedDataset, KULDataset, KULProcessedDataset, AVEDDataset, AVEDProcessedDataset class TestAuditoryAttention(unittest.TestCase): def test_dtu_dataset(self): kwargs = { 'record': 'fake_record', } kwargs.update(DT...
fb73a89e504b8fd61e6d9c293962f770b965ed28a68a651b387d2566a21e2005
Python
1,941
70
import pytest import elasticai.creator.ir2torch as ir from elasticai.creator.experimental.ir.shape_inference import ( IrShapeInference, Shape, get_default_shape_inference, ) factory = ir.IrFactory() @pytest.fixture def infer_shape(): infer = get_default_shape_inference() @infer.register_node() ...
a6008ef65eefda745caa668d8c500bd746aa3acb4e478c1d0480553be05079d8
Python
1,942
57
import torch import torch.nn.functional as F from torch import nn from ..operators import ACSConv class _EncoderBlock(nn.Module): def __init__(self, in_channels, out_channels, dropout=False): super(_EncoderBlock, self).__init__() layers = [ ACSConv(in_channels, out_channels, kernel_size...
04f0948743e8de7f819eb2d015f043ffef4ff221cf02da60194f53f86992cfcd
Python
1,943
66
#! /usr/bin/env python # -*- coding: utf-8 -*- import itertools import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment from downward.reports.compare import ComparativeReport import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterP...
6c7ad618bd4d1030abdde34ff75a567ca1f1ee7af716e8e226269be0a41746ce
Python
1,944
66
from __future__ import print_function,division import numpy as np import torch import torch.nn as nn import torch.nn.functional as F """ self.layers = nn.Sequential( # input is Z, going into a convolution nn.ConvTranspose2d( nin, ngf * 8, 4, 1, 0, bias=False), nn.BatchNorm2d(ngf * 8), activation()...
9a7102b735e88e2901a93f903a60b43a56a88b522d63e8a22b04583270a0d815
Python
1,944
66
#!/usr/bin/python # -*- coding:utf-8 -*- from torch import nn import warnings # ----------------------------inputsize >=28------------------------------------------------------------------------- class CNN(nn.Module): def __init__(self, pretrained=False, in_channel=3, out_channel=10): super(CNN, self).__i...
3dee174d8635dd1160ee40d85538939f1e8a38a320d155d74f479cdde5f77148
Python
1,945
70
# Node-group asset "MN Color" (ShaderNodeTree), 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 from b...
9c9da1e27fc5bf841d93421e5e46f64bf813d9d503a395f68f414f7c1bd6d8b5
Python
1,945
77
# Node-group asset "Angstrom to World" (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_CHEC...
b47baefcfd4e9f02aacf48c38269786dcf63eaae90d49aef6ece4e0783e7298d
Python
1,945
55
from unittest import TestCase from unittest.mock import patch from codex.service.network import compile_network_html from tests import get_testing_neuron_db class ConnectivityTest(TestCase): @classmethod def setUpClass(cls): cls.neuron_db = get_testing_neuron_db() def test_full_network_generatio...
05623a1f42f2495841e06b320d610828509674973c7793da566c868bea439d08
Python
1,946
62
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
3e7b5a97d25c7e8633c9da9d2cd2c4776afbc62178de7f7abc79c5eafee9584a
Python
1,946
66
import pytest @pytest.fixture(scope="module") def _qapp(): try: from PySide6.QtWidgets import QApplication except Exception as exc: # pragma: no cover pytest.skip(f"PySide6 unavailable: {exc}") return QApplication.instance() or QApplication([]) def _patch_git(monkeypatch): ...
98075ed17e978bc6ff32642d236a7d845c4a0420d7a1d3f634ff25ff46c640f3
Python
1,946
57
from typing import Any, cast from elasticai.creator.arithmetic import FxpArithmetic, FxpParams from elasticai.creator.base_modules.prelu import PReLU as PReLUBase from elasticai.creator.nn.design_creator_module import DesignCreatorModule from elasticai.creator.nn.fixed_point.math_operations import MathOperations from...
b71b3eb803fcc82e7d6e3ccaab9eeac6e2004b8ceec3670b53e5aa099ba4f005
Python
1,947
40
# Copyright (c) 2021, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
eeb565bd1c781d64fcada3fc6237359b2f2e1edcae6136ce803fe792e1522ac7
Python
1,947
74
import sys, os import numpy as np from collections import Counter import pandas as pd import pysam ### Initialize ### try: inputBamFile = sys.argv[1] except: sys.exit('Please, give input bamfile') if not os.path.isfile(inputBamFile): sys.exit('bamfile not found') bamfile = pysam.AlignmentFile(inputBamFi...
5bc5d9a3d0cfeaa64c961940c5a1f4a20804a3c29cda341de322ab311dc396cf
Python
1,948
62
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
708c1f5bdf43ac1da94ee921e93cbe4354ab2c9f22820829ae6c3b2d5ba19860
Python
1,948
62
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
bda86acd0a40b9ea338d082ca84942cdb96140ce162ae35265e665bf91024143
Python
1,948
61
# 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...
cb378254c50760b7b864e235f289089754ab57550227aa0222ab22ddad735163
Python
1,948
70
''' Description: Prepare data for PRESCIENT model. Codes are adopted from PRESCIENT source codes. Author: Jiaqi Zhang <jiaqi_zhang2@brown.edu> Reference: https://github.com/gifford-lab/prescient/blob/master/prescient/commands/process_data.py ''' import numpy as np import sklearn import umap import tor...
eba7eb22452a01675bd1921d26dc4b7ac3acc620c3877b87285de8a39efb7da2
Python
1,948
62
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
87fc557a76ec721fad89d601d5ee536ff471defa5935a71a83cf69860bd68c79
Python
1,949
62
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
f9d3315e5f091d5d6c54e300669f416d99888823ff74d29274a4762ceee0790c
Python
1,949
69
"""Shared I/O utilities for workflow scripts.""" import glob import pathlib import pandas as pd from tqdm import tqdm def load_files(dirname): """Load CSV result files from a directory or list of paths. Parses parameter key=value pairs encoded in filenames (separated by '~'). Parameters ---------- ...
34c315b686d220712cf9b5ab2bb6da1fbc30fc7b665a503a72303f32898cb048
Python
1,950
59
#%% import numpy as np import ants import matplotlib.pyplot as plt import os import glob from PIL import Image,ImageFilter #%% preprocessing tmp_ind = 3 savename = 'target.png' # input file img_files = glob.glob('input*.png') # split channel red for input. img_list = [ants.from_numpy(np.asarray(Image....
1e2b2566caff35e60913509cff27395cb7734638ab511b3ca5cbff817293a0a8
Python
1,951
40
"""Pure metric helpers of the attractor diagnostic (no model).""" import numpy as np from liquidaion_fly.attractor import (answered, default_conditions, detect_period, js_divergence, kl_divergence, repeated_ngram_fraction, text_similarity, transient) def test_period_detection_di...
2fec023cfeaee2bfd277ea5090a63400455be42711cb8ab9c53af5a84a033f01
Python
1,951
59
''' Description: Compute testing data distribution shift based on l2 distance. Author: Jiaqi Zhang <jiaqi_zhang2@brown.edu> ''' import numpy as np from benchmark.BenchmarkUtils import loadSCData, tpSplitInd, splitBySpec # ====================================================== from scipy.spatial.distance impor...
14f324b08e192f42bf98f5a0db1d1456e23da79b2e6c70251d71ec14042e65d8
Python
1,952
60
from cloudvolume import CloudVolume image_in = 'gs://neuroglancer/pinky100_v0/image_single_slices' image_out = 'gs://neuroglancer/pinky100_v0/aligned_test_v12' image_mip = 0 roi_in = 'gs://neuroglancer/pinky100_v0/image_single_slices/roicc' roi_out = 'gs://neuroglancer/pinky100_v0/aligned_test_v11/roicc' roi_mip = 6 c...
c3e580afa1c701f862a929a06bcdaefae20ca4d39f1e7875b28abaeac3cf61b4
Python
1,952
53
#------------------------------------ #----- CLEAN/GENERATE DATASETS -----# #------------------------------------ import pandas as pd import numpy as np import scipy as sp from utils import * # read in matlab data files from: https://github.com/hhcho/hyplinear def load_mat_file(path): # load .mat files with gaussi...
4c9778ca5c59d34d420a6cecadd20c311d9252dbc8aac133c0bbe2ca84bb7721
Python
1,953
49
import unittest from types import SimpleNamespace from unittest.mock import patch from torcheeg.utils import LazyLoader class TestLazyLoader(unittest.TestCase): def test_import_is_deferred_and_cached(self): module = SimpleNamespace(value=42) with patch('torcheeg.utils._import_module', return_valu...
0b7dffb5336a379cc9a646d7c9006b26eabc251c265e71ceadda7c05e87e668e
Python
1,954
53
# 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...
737d6e4fc431c8df4a11cd9e7b8bb3e6e0f1dabcd86a80883a19dad532867feb
Python
1,954
58
import glob import numpy as np import os import pickle import matplotlib.pyplot as plt from src.SIRE.SIRE_filter import ProcessSIRE3DImage from src.dijkstra.shortest_path import ExtractPaths def main(data, **params): SIREFilter = ProcessSIRE3DImage(**params["SIRE_filter"]) PathExtractor = ExtractPaths(**param...
9e91b797d93711db279fc33dd42cf90d36a248141f24e5d9a207e882e25f7e49
Python
1,954
63
import numpy as np import h5py import modisco import h5py import click @click.command() @click.option('--input', 'input_file', required=True, type=click.Path(exists=True, readable=True), help='h5 score file of ism') @click.option('--output', 'outpu...
8d36f695c6511c286acf3e10b757f877b3ad10b1f48785c14319e47b35ce15d5
Python
1,955
53
from ETL.Extract.extract import extract_sidecar_data from ETL.Transform.transform import transform_sidecar_data from ETL.Load.load import load_sidecar_data, database_setup from ETL.PostTransform.post_transformation import update_subject_ids, update_transformation_id, backpropation import logging # Main Workflow funct...
c521809dd05e5041c885e73eff38a47a0f1530b4f1612a55d429593cd4ce2919
Python
1,955
58
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
3b10b8ac73dffa818b67bd06bc3fb894dd28011b67f906375212442b96057c9a
Python
1,956
54
hitScoreM = [0, 0, 0.014, 0, 0, 0.395, 0.317, 0, 0.389, 0.079, 0.445, 0.508, 0.613, 0.851, 0.732, 0.828, 0.615, 0.804, 0.685, 0.583] def calcMitScore(string1, string2, startPos=0): """ The MIT off-target score see 'Scores of single hits' on http://crispr.mit.edu/about startPos can be used ...
77181fd114339c201c0504b44ef5fd3db1afe24cd07fbaff00f527898e86f37c
Python
1,956
48
############################################################ # This file plots the results from ISC as computed by the # # ISCToolbox (Kauppi et al., 2014) for the pilot_iii data. # # # # author: ana.trianahoyos@aalto.fi # #################################...
c3890002fa9beca53112fa057e812c111f80c290988f142180fc2f2f8f855a87
Python
1,956
66
# 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...
940c197f9b4c038da2d75cb58f4874db9615108e0d88047cb7eefddc5ce00732
Python
1,957
71
#!/usr/bin/env python # -*- coding: utf-8 -*- """Demonstrate usage of LFPy.NetworkCell with a ball-and-stick type morphology with active HH channels inserted in the soma and passive-leak channels distributed throughout the apical stick. The corresponding morphology and template-specification is in the files BallAndStic...
c7514b15d8707c0cfd36cb363c7cdd12511c26ebf57af7cf61b02a8962048b1e
Python
1,958
95
from __future__ import annotations from pathlib import Path from typing import Any _SEPARATOR = "=" * 72 def _technical_record_dir(output_dir: str | Path) -> Path: output_dir = Path(output_dir) technical_record_dir = output_dir / "Technical_Record" technical_record_dir.mkdir(parents=True, exist_ok=Tru...
f3bf9b3002e9b6600e329f1cedaaeb9134c7ba2616a8689f8730a5712a200e5f
Python
1,958
27
"""posthoc_cutout_per_side_2026-10-02.py (post hoc, after seeing the whole-brain per-side split). On the antennal-lobe cut-out (spiking, 50 channels, 3 trials, seed 11 as DAMPING_SOURCE), read the left v2LN30's flip side by side: how much of the cut-out's larger effect is the other side? Output: 06-OUTPUT/posthoc_cut...
32f904753f1841ba693b8b63343b3b2947b1c8f90959725474ed4bd2071e5e46
Python
1,959
66
# 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...
545e000faa25edb358d1ea488277077ca9dae610cd849e1c48d17ba4e84f2cad
Python
1,959
61
from typing import Dict, List, Union from ..base_transform import LabelTransform class Select(LabelTransform): r''' Select part of the value from the information dictionary. .. code-block:: python from torcheeg import transforms t = transforms.Select(key='valence') t(y={'valenc...
8a885e06cbb62f2129748080c36fbb575e7c595d10d3a75d9bb6f08b07868c6c
Python
1,959
68
import torch import torch.nn as nn import torch.nn.functional as F from segm.model.utils import padding, unpadding from timm.models.layers import trunc_normal_ from torch.distributions import Categorical class Segmenter(nn.Module): def __init__( self, encoder, decoder, n_cls, ...
a524dded8c58479410726810c549fd2aaeb09baf1a16274784998178142655a5
Python
1,959
48
import os from typing import Dict, Union import pandas as pd from ..utils import get_random_dir_path from .utils import ensure_cache, validate_metadata class BaseModelSelection: r'''Common initialization, checks and cache access for dataset splitters.''' def __init__(self, split_path: Union[None, str] = No...
e862bddf230d65b6d2012f016c42b7612350e4674b707fb3210128bd60671555
Python
1,959
55
""" Test functions for snapping coordinates calling: python test_snap_coordinates.py <subject> will plot the original and snapped coordinates for that subject """ from snap_coordinates import * import mayavi.mlab def plot_coordinates(coordinates, color=(0,1,0)): """ Plots a set of coordinates in 3d space ...
3637c8e9b6cb83b6efd0a6cb68dc06dbe99f070c34fcc9697bf2365a83a3c976
Python
1,960
46
# SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL # # SPDX-License-Identifier: AGPL-3.0-or-later ''' Compute average complexity across (maximal simplices) for all connectomes and their controls. Runs quickly, can be run interactively. Author(s): Daniela Egas S. Last updated: 01.2024 ''' import pandas as pd im...
cf4850a075214c7a770cc508f4f78a2fa3123bd2afc5c34afd0daf412ca0a332
Python
1,960
80
import os import sys import matplotlib.pyplot as plt import numpy as np import meep as mp from meep import mpb examples_dir = os.path.realpath(os.path.dirname(__file__)) sys.path.insert(0, examples_dir) def tri_rods(): # Import the ModeSolver defined in the mpb_tri_rods.py example from mpb_tri_rods import ...
d4a4eb0332b877bc0acfcf1ef76a5aca96766518a7f1c7f3182d1040eece2151
Python
1,960
58
import json import matplotlib.pyplot as plt import numpy as np import os import pandas as pd from src.analyze.utils import init_mpl from src.analyze.performance_measures import PerformanceMeasures from constants import ABSOLUTE_ERROR, ERROR_TO_LABEL _FIG_SIZE = (8, 4) colors = init_mpl() def make_plot(results_dir,...
eb7446d74c3ef9e4e9176a81c42b4e0121b46229c9364818aa1e4c10b3e8b744
Python
1,961
59
import pytest import numpy as np @pytest.fixture(scope="session", autouse=True) def set_seed(): np.random.seed(42) # noqa: NPY002 import logging from ase.io import read from quacc import get_settings from pathlib import Path from ts_workflow_examples.geodesic_ts_without_hessian.using_mace import geodesic_ts_no...
12f812f89cf7b361942fad5294bec0500710892499a2e147e39af3140129ae74
Python
1,962
54
from collections.abc import Iterator from typing import cast import torch from elasticai.creator.nn.design_creator_module import DesignCreatorModule from elasticai.creator.vhdl.design.design import Design from .design import Sequential as _SequentialDesign class Sequential(DesignCreatorModule, torch.nn.Sequential)...
ed6e715229ed4bd69e4d91826a294dc0f7df57aa8e19f2b8251fb2d20bb163ec
Python
1,962
69
""" Changs's method {chang2005automatic, title={An automatic method for estimating noise-induced signal variance in magnitude-reconstructed magnetic resonance images}, author={Chang, Lin-Ching and Rohde, Gustavo K and Pierpaoli, Carlo}, booktitle={Medical Imaging}, pages={1136--1142}, year={2005}, organization={Interna...
0aee615a3f6d8c50ba673765558987047b21ccd070feb950d788354374d5a6e9
Python
1,963
68
## # \file data_reader_test.py # \brief Unit tests for data reader # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date January 2018 import os import unittest import numpy as np import re import SimpleITK as sitk import pysitk.python_helper as ph import niftymic.base.data_reader as dr from niftymic.de...
0c9d544ec3073f30565e1b39d5328d462c6734d5df45bb8e519e628573319da0
Python
1,963
68
"""Pure unit tests for --reg_effort emission from build_registration_cli_args. Qt-free; mirrors test_registration_cli_args.py. """ from regtools.registration.gui.cli_args import build_registration_cli_args, RegistrationOpts def _args(**kwargs): return build_registration_cli_args(RegistrationOpts(**kwar...
78186e67d95d4494b7223341bb80f5e75a64941b0ba9a64d7ab74bd099d35c4d
Python
1,964
72
## # \file installation_test.py # \brief Class to test installation # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date October 2017 # Import libraries import unittest from nipype.testing import example_data import niftymic.base.stack as st import niftymic.registration.flirt as flirt import niftymic....
23376573309c96a0da401dbb7794ff6fb44d3293bb0af08884a2e617ef757a82
Python
1,965
72
import imp import numpy as np import pandas as pd import axelrod process_data = imp.load_source("processe_data", "src/process_data.py") def test_strategies_properties(): df = process_data.get_strategies_properties() assert isinstance(df, pd.DataFrame) assert len(df) == len(axelrod.strategies) for...
36ff577699cb71875edd578ca6dc0f8740916040c75ada4e871dbf0a09b58cab
Python
1,965
52
import unittest import numpy as np import torch from torch_geometric.data import Data from torcheeg.datasets.constants import DEAP_ADJACENCY_MATRIX from torcheeg.transforms import ToDynamicG, ToG class TestPyGTransforms(unittest.TestCase): def test_to_g(self): eeg = np.random.randn(32, 128) tran...
6aa427ae421738a4776a630dabf343065a2f3621c59a83d3a5ac54169a36a19e
Python
1,965
43
"""Keyboard shortcut overlay text for the CCF boundary editor. Kept as plain HTML in a separate module so the (long, drift-prone) help block doesn't bloat viewer.py and so it can be edited / proof- read independently. Imported by the viewer; not used elsewhere. """ from __future__ import annotations SHORTCU...
8dc18d3e2ddda44242a3ec8d2134c625d39a13ab088765bbcf7f6ecc62f39f63
Python
1,965
68
# Node-group asset "Cumulative Length" (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_CHEC...
948d82a19931e16bcc873332660b76ef7a339c2d577174ac59a2cee5507b714d
Python
1,965
73
import os import hostlist from pathlib import Path import torch import torch.distributed as dist import segm.utils.torch as ptu def init_process(backend="nccl"): print(f"Starting process with rank {ptu.dist_rank}...", flush=True) if "SLURM_STEPS_GPUS" in os.environ: gpu_ids = os.environ["SLURM_STEP_...
0f73b5a41c6b299f950e36086d125fc820638d0b6165ad8df03a1038704869c0
Python
1,966
53
import unittest import numpy as np import torch from torcheeg.transforms import (after_hook_normalize, after_hook_running_norm, after_hook_linear_dynamical_system, before_hook_normalize) class TestHooks(unittest.TestCase): def test_before_hook(s...
10ee9cab0bd393e8003c7d17026831d18f76861c2c7ad7c016864034467bd16a
Python
1,966
62
import torch import numpy as np class Coord: idx2glb_scale = None # (w,h,d)->(x,y,z) idx2glb_trans = None # (w,h,d)->(x,y,z) @ staticmethod def idx2glb(idx): # (d,h,w)->(w,h,d) if type(idx) is torch.Tensor: is_tensor, device = True, idx.device ...
25a065490bec31573663e1690db8c71bec00c7af07f3a4fb2fb76fc2b05e4c8c
Python
1,966
49
from elasticai.creator.arithmetic import ( FxpArithmetic, FxpParams, ) from elasticai.creator.base_modules.hard_sigmoid import HardSigmoid as HardSigmoidBase from elasticai.creator.nn.design_creator_module import DesignCreatorModule from .design import HardSigmoid as HardSigmoidDesign class HardSigmoid(Desig...
2e7426e37c76063eff919ec0adf17edd25c0ce178782c1d5fddc88d63229de16
Python
1,966
62
import torch import torch.nn as nn import torch.nn.functional as F # noqa __all__ = ['shallow_cnn'] class ShallowCNN(nn.Module): def __init__(self, dropout, n_outputs): super(ShallowCNN, self).__init__() # setup layers self._conv1 = nn.Conv2d(1, 32, kernel_size=(5, 5)) self._co...
3270feaa8b7beeaef1938d071c8696b7994be1d5f1744e9f26aa9981b00fd1a5
Python
1,966
87
# 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...
34bd965d0d64a08467793232b88b7d2dbe7cc86947ddc89ae829e0a2ed1a5405
Python
1,967
60
import time import threading import numpy as np class ADC: def __init__(self, queue, is_values): self.queue = queue self.is_values = is_values self.t0 = time.time() for i in range(5): self.queue.put(['measure','adc']) time.sleep(1) ...
63f61a10284704ed0c88bd4cc005d123949df1170005dedd2e1ec3569388c5f8
Python
1,967
57
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...
b836d9df13c4df3d3bff17dbf7b3458cf4168a8e46c643d71e049e9b2565bc46
Python
1,967
75
import socket import _thread import sys import os from protonet_score import PretrainedProtonetDistScore, \ load_image_path, load_image cache = {} model = PretrainedProtonetDistScore(os.path.dirname(os.path.realpath(__file__)) + "/results-OM/best_model.pt") def eprint(*args, **kwa...
d107d6f6aaf0db5110f80ba87b1fcd20bcf3e0391c83971154f56b0c0bebbbbf
Python
1,967
56
from typing import Any, cast from elasticai.creator.arithmetic import ( FxpArithmetic, FxpParams, ) from elasticai.creator.base_modules.linear import Linear as LinearBase from elasticai.creator.nn.design_creator_module import DesignCreatorModule from elasticai.creator.nn.fixed_point.linear.design import Linear...
ef68d66485ebc681a7ec7e794035cda48a8f597e0ee7d9576c043f05fe6c7876
Python
1,967
51
"""Opt-in per-generation inference log capturing the exact model inputs. Levels: summary - counts, stop reasons, cache/hook/trim events and SHA-256 digests only; no conversation text or token ids leave the process. full - additionally the rendered chat template, input token ids, decoded ...
03403dc05b9dbffe3f6c05002a2765c17841c635386df61c73f665ac7682e0ea
Python
1,968
65
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
154161319cc6931f4c6e8468eddfd9b3da00f14ee5108b7234a52bf56f38892c
Python
1,968
112
pres_dose = { 'zzzCFPatient00': 50.4, 'zzzCFPatient01': 54 } dic_gamma = { 'name': [], 'noise': [], 'valid_gammas': [], 'pass_rate': [], 'mean_gamma': [], 'T2_gamma': [], } dic_roi = { 'name': [], 'noise': [], 'valid_gammas': [], 'pass_rate': [], 'mean_gamma': [],...
4a8e263e84a35e45e2487893cf3aae1f7555c950ff9e35e51c9484c583d7028c
Python
1,968
68
import functools from typing import Callable, Generator, Iterable, Iterator, Optional, Tuple from pip._vendor.rich.progress import ( BarColumn, DownloadColumn, FileSizeColumn, Progress, ProgressColumn, SpinnerColumn, TextColumn, TimeElapsedColumn, TimeRemainingColumn, TransferSp...
876730dd1258bd84b891bb9bc4445dbc888446e2668b29a04d4206f3cd18a8ac
Python
1,968
61
# 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...
ce77336e42882fa60f07ce36da5cbad8ba048974e68482bf050f7b1be97dc19c
Python
1,968
67
import re from collections.abc import Iterable from typing import Any import pytest import elasticai.creator.plugin as p import elasticai.creator.plugin.plugin_spec as ps def test_importing_plugin_with_missing_fields_raises_meaningful_error() -> None: config_from_file = { "api_version": "0.1", "...
cfce2110522322c9b25792b1094b4882de52d0c5fdd424891b9c79c38a04b3f5
Python
1,968
57
import numpy as np import matplotlib.pyplot as plt import nibabel as nib from matplotlib.colors import ListedColormap import argparse def overlay_slices(image_path, mask_path): # Load the NIfTI image and mask image = nib.load(image_path) image_data = image.get_fdata() image_data[image_data >200] = 200...
10ffa74e350856f893b9d6245bc143d219affae765286491c855250295e56cd3
Python
1,969
52
""" Compute modulation spectrum of the stimuli according to Ding et al. (2017). """ import brian2hears as b2h import brian2 as b2 import numpy as np import pandas as pd from pathlib import Path from helpers import load_config from speech_utils import compute_modulation_spectrum if __name__ == '__main__': config ...
44bba9ece1a436f7e1c3ba7cb34840064481f1b0ea022516e828b03a4496f81f
Python
1,969
58
#!/bin/env python3 ''' Define a Feynman diagram ''' import pdlfeynman as fy import yaml diagram = fy.diagram.Diagram() x = 1 time = 470 n00 = fy.diagram.Node.Reaction(time=time, reaction=fy.particle.growth.pair_production) diagram.add_node(n00, x=x, y=0) x += 1 time = 478 n10 = fy.diagram.Node.Reaction(time=time, re...
58eb37193ea026655214eea9eba43531c9cd384091763dc3e20f43d84ae30c71
Python
1,969
67
#! /usr/bin/env python # -*- coding: utf-8 -*- import itertools import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment from downward.reports.compare import ComparativeReport import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterP...
c05713ad3d73a642447d6b38ed9723ebbefe08cfc072f54778455f051e4aca67
Python
1,969
66
#!/usr/bin/env python3 import os import pandas as pd from nilearn import masking as nmask # ------------------------------------------------------------------ # Create group mask across subjects for HCP 7T movie data # ------------------------------------------------------------------ # base directory of HCP 7T data ...
2a689c1d14d2b5bedeceb4963d0157d40d379a5ded241a93a48ecd19939cff8d
Python
1,970
59
import numpy as np import networkx as nx import sys sys.path.append('../Model/ES/') sys.path.append('./MouseBrainLib/') import networkx as nx from ES_Adaptive import ES_Adaptive from DataUtils import DataUtils class MBN_No_RC(ES_Adaptive, DataUtils): def __init__(self, nepochs=10000, ...
061572d5975e8715cceeb1a9843bfdcc933a160832bb236e7961d0b49d6cf674
Python
1,971
35
# 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...
19a62188a431754b10f610a5f3a5cede51cf70f135147abbbc4ef633d1e72a9d
Python
1,971
86
import dataclasses as dc import dataclasses from jax import tree_util as jt import yaml # import torch def register_jax_dataclass(cls): """Registers a dataclass as a JAX pytree.""" if not dc.is_dataclass(cls): raise TypeError('%s is not a dataclass.' % cls) keys: float = [field.name for field in dc.fields(cls)]...
2b2d05b1a8c90946e676911fc1e6a368602f7b15c0902e98b8256a6ff151471d
Python
1,971
64
# 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 os import subprocess import pytest from pathlib import Path notebook_dir = Path(__file__).parents[1] / "examples" notebook_fns = noteb...
35507ae8628647249df9aebc11f171f4d245f6a754aba23817ee208ba5098ca5
Python
1,972
40
# 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...
8b703c2d5a821f101bd71f8d56262454886fcdebc223a65ebc83595f6147797a
Python
1,972
66
#!/usr/bin/env python import os import glob import torch from torch.utils.cpp_extension import CUDA_HOME from torch.utils.cpp_extension import CppExtension from torch.utils.cpp_extension import CUDAExtension from setuptools import find_packages from setuptools import setup requirements = ["torch", "torchvision"] ...
8f89fd7492e2b4fef1f22fb55d895f9d21f47659d7c8efe23d76df6849d27795
Python
1,972
63
##################################################################################################################### ''' TESTS ''' ##################################################################################################################### import os import control.core as core import control.core_tracking as...
c7edbfa63288f0f6512997ed860e339ae4d2626b24f35a70886389b1077bef23
Python
1,972
63
import matplotlib.pyplot as plt import matplotlib.ticker as ticker import numpy as np def plot_prop(prop): if "per_" in prop: x = np.load("target_{}.npy".format(prop[4:])) y = np.load("output_{}.npy".format(prop[4:])) n = np.load("n_atoms.npy") while len(n.shape) < len(x.shape): ...
0c3547f49fd4944030e53a197af5060e462298fdcf5aad0c79ef4f2d813fc679
Python
1,974
61
# 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...
80a2385f163b543c69bc92a51fcb2ce41732640b3d30a3a382742fac54bdcc90
Python
1,974
76
"""Shared pytest fixtures and synthetic-trace builders.""" from __future__ import annotations from dataclasses import dataclass import numpy as np import pytest from msfeature.config import DatasetConfig @dataclass class InjectedSaccade: onset_s: float duration_s: float amp_x_deg: float amp_y_deg:...
ae8f81415e4231400f18f931d05b900b6635159b7bb60d1e593cea4f59ba5cb7
Python
1,974
70
# Node-group asset "Is Backbone Edge" (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...
bcf020074bd938ed36afd27095260e32f0be57905d781da8f683ba15f414fdec
Python
1,974
59
r"""Test OpenBabel executables from Python Note: Python bindings not used On Windows or Linux, you can run these tests at the commandline in the build folder with: "C:\Program Files\CMake 2.6\bin\ctest.exe" -C CTestTestfile.cmake -R pytest -VV You could also "chdir" into bu...
43ef5c636d5c1d7002109d572fb9866f30d4174a74abfff17b6d705a35486a1d
Python
1,975
83
# -*- coding: utf-8 -*- """ Created on Wed Dec 4 11:54:21 2019 @author: rhann """ # Goal 1: # Write a script in Python/Java (other other programming language of interest) # that a) tries to find the issue we showed in that notebook above # Add a bit to your script that runs this expression a few (~100) times, # and...
62d9cc135948be3222ba14a6a4cf665da85024cebf91bdc9a6d92d0f43438a2d
Python
1,975
67
import argparse from pathlib import Path import json import typing from functools import partial import cv2 import numpy as np from tqdm import tqdm def main(args: argparse.Namespace): image_dir = Path(args.images) tracking_file = Path(args.tracking) output_dir = Path(args.output) output_dir.mkdir(ex...
87efab05b8f77c154b611cc8b0fb93e0bc552f257143a4d0f7d677a8eda2c0ca
Python
1,975
73
import numpy as np from vanhateren import VanHateren import vanhateren.preprocess as pp def load_patches(n, shape=(32, 32)): vh = VanHateren(calibrated=True) rng = np.random.RandomState(9) return vh.patches(n, shape, rng=rng) def show_patch(ax, patch): ax.imshow(patch, cmap='gray') ax.set_xtick...
d55982c519ad60135857a3cde559e6d7b41e63dd6d23521c8155cae216e97b57
Python
1,976
63
"""Base jobs for Gaussian.""" from __future__ import annotations from typing import TYPE_CHECKING from ase.calculators.gaussian import Gaussian from quacc import get_settings from quacc.runners.ase import Runner from quacc.schemas.cclib import CclibSummarize from quacc.utils.dicts import recursive_dict_merge if TY...
0e9bebf361d4fe31573525be8b55d31cd33b858ccb0f1ef8a2bf33b53be4f513
Python
1,977
42
import json import time from unittest.mock import MagicMock import pytest from NDATools.upload.validation.v1 import Validation @pytest.fixture def validation(monkeypatch, validation_config_factory, load_from_file, tmp_path, shared_datadir): file_path = (shared_datadir / 'validation/file.csv') args, config =...
c5b9146eb83f106aa436bfe2ddf7aa057cf421736a4bf8abc054b5318ead8b25
Python
1,977
50
import os import random import shutil import unittest from torcheeg import transforms from torcheeg.datasets import DEAPDataset from torcheeg.datasets.functional.operators import from_existing class TestOperators(unittest.TestCase): def setUp(self): # if os.path.exists('./tmp_out/'): # shutil...