sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fcd44ee0febb4262e3ae548300c06e0edfeee5b9a19c06670ed538c1e1d92595
Python
5,278
156
import logging import numpy as np from dipy.tracking.streamline import length, set_number_of_points from scilpy.tractograms.streamline_operations import smooth_line_gaussian def post_process_labels_discrete( nb_labels, bundle_label, bundle_mask, bundle_name ): """ Discretize the labels and apply a mask to t...
5dbaa3ef5e2a0349204eabaed3b60cd0c5097ea25e2d5ed9b2d521a9cd8fc8af
Python
5,281
184
import os.path def parse_tab_separated_value_file(file_path): header = list() rows = list() if not os.path.isfile(file_path): return header, rows, '{} is not a valid filepath'.format(file_path) with open(file_path, 'rt') as f_handle: for i, line in enumerate(f_handle): tok...
c1fbfc8be0ab4f79565c99b094cb202e5c9c375dcf8f53ca4fabdb9bbd607dc0
Python
5,281
171
"""CTF Rest Dataset: Static Network Analysis. In this script we calculate static network metrics using source reconstructed resting-state MEG data. The examples/toolbox_paper/ctf_rest/get_data.py script can be used to download the training data. """ import os import numpy as np import pandas as pd from osl_dynamics...
0976c75ca0a721cf90f342a77153edcf79aee357fb53b618b35f98d6b127053a
Python
5,282
126
from scvi.dataset import CsvDataset import os import numpy as np import pandas as pd from scvi.models import SCANVI from scvi.inference import SemiSupervisedTrainer import time as tm import rpy2.robjects as robjects def run_scVI(DataPath, LabelsPath, CV_RDataPath, OutputDir, GeneOrderPath = "", NumGenes = 0):...
f84f93527f8208554d1fc3547e0e5012af4b917122417b2530466df799f04e50
Python
5,283
173
import numpy as np import pandas as pd from sklearn.metrics import classification_report from sklearn.metrics.pairwise import cosine_similarity import sys from collections import deque import time import logging from sklearn.metrics import roc_curve, auc, matthews_corrcoef from scipy.spatial import distance from scipy ...
5b09dc9662ff1cd3ece81fb76d138dcce05edae88ab0b8ca19813cb9c7b85a61
Python
5,284
201
"""Functions to process data.""" from typing import Optional import mne import numpy as np from scipy import signal from osl_dynamics.utils import array_ops def standardize(x: np.ndarray, axis: int = 0, create_copy: bool = True) -> np.ndarray: """Standardizes a time series. Returns a time series with zero...
fa9d79f256e6021299c8368b210e52a383657265736557bb7e86018b829473ed
Python
5,284
140
import sys import yaml import os import numpy as np from matplotlib import pyplot as plt pathpath,myrun = sys.argv[1:] #pathpath = 'PATHS/filepaths_carlen.yml' #myrun = 'runC00dMP3_brain' with open(pathpath) as yfile: pathdict = yaml.safe_load(yfile) rundict_path = pathdict['configs']['rundicts'] srcdir = pathdic...
835be4f1dc210efaedc950c9f8ced4243fcaa759d60e8eac757057ebf5c8fa6f
Python
5,285
144
# Kai Sandbrink # 2023-05-27 # This script compares behavior and transdiagnostic scores # %% LIBRARY IMPORT from matplotlib.ticker import FuncFormatter import numpy as np import pandas as pd import matplotlib.pyplot as plt import os from scipy import stats import seaborn as sns from sklearn.decomposition import PCA ...
8785a0679835bfba74dd1e9833112ea437f6c44612a7487c6e1d37fb44bc7928
Python
5,285
170
import numpy as np class Distribution: """Base class for a Distribution.""" # Any subclass of Distribution will be registered here, for use by # `Distribution.from_json` subclasses = {} def __init_subclass__(cls, **kwargs): super().__init_subclass__(**kwargs) cls.subclasses[cls.__...
1404e885ce3c28cccc59c6a57eac0da04d31227920d715a4ab2e8e2b5f5fdc3f
Python
5,290
139
from pathlib import Path import zipfile from io import BytesIO from typing import Type, Literal from argclz import AbstractParser from neuralib.util.tqdm import download_with_tqdm from neuralib.util.utils import ensure_dir from rscvp.util.io import RSCVP_CACHE_DIRECTORY __all__ = [ 'DEMO_DATA_SOURCE', 'mkdir...
bb1bbcb32601081f1026b4587a644a24d91a67a71f5e89b0da1fbaf92798d2f8
Python
5,290
171
# utils/metrics.py # ────────────────────────────────────────────────────────────── # 多标签分类常用指标集合(纯函数、无任何训练逻辑) # ────────────────────────────────────────────────────────────── from __future__ import annotations from typing import Literal, Dict, Any import numpy as np from sklearn.metrics import ( roc_auc_score, ...
0eb1af4159f68710e0ebfc07550ad34828b7942a8a384e1853cf5603502ebf94
Python
5,291
154
import numpy as np from scipy import stats import statsmodels.api as sm import matplotlib.pyplot as plt from matplotlib.colors import Normalize from matplotlib.colors import ListedColormap import matplotlib.pyplot as plt import seaborn as sns from nilearn import plotting sns.set_style("white") class MidpointNormalize(...
a1e5e3bf37ca94d809e0131c405c41dcba1c94c1a711f9fb0b0da7ef0b41c19b
Python
5,291
142
from __future__ import print_function, absolute_import import time import collections from collections import OrderedDict import numpy as np import torch import random import copy from .evaluation_metrics import cmc, mean_ap from .utils.meters import AverageMeter from .utils.rerank import re_ranking from .utils import...
1718ce7a8009f24488be87a01940d5f246a24cd57dcef40e997679734ee9692f
Python
5,294
138
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Save connections of a hdf5 created with >> scil_tractogram_segment_connections_from_labels. Useful for quality control and visual inspections. It can either save all connections (default), individual connections specified with --edge_keys or connections from specific...
0ba4fa6036ce9410536d8fa7b9193f274110e73437a10dba8c4456958e33533e
Python
5,297
212
#real_time_ABRS # Copyright (c) 2019 Primoz Ravbar UCSB # Licensed under BSD 2-Clause [see LICENSE for details] # Written by Primoz Ravbar import numpy as np import matplotlib.pyplot as plt import cv2 import pickle import msvcrt from scipy import misc #pip install pillow import scipy from scipy impor...
17591b5f8d2358383bedfacc50db5debe6c0fb02b2ac2427b879f0dc7c66f029
Python
5,297
120
"""Recompute per-unit split-half (Spearman-Brown) reliability at the FIXED 70-170 ms window from raw GoodUnit rasters -- the window-matched noise ceiling for the fixed-window static Li2026 assembly. Streams one session at a time (low RAM). Output: CSV neuroid_id,reliability_window (neuroid_id = f"{ses}.{u}", GoodUnit...
dd49a0032f992056d25bdae309e9177d6aabe9689af0b74e0dcfee0cb81dfec2
Python
5,297
176
import os, sys, math, random, argparse, numpy as np import bpy import bmesh import json from math import radians from mathutils import Matrix print(os.getcwd()) import blender_util as bu from lib_alban import * # parse arguments parser = argparse.ArgumentParser() parser.add_argument('--nobjects', type=int, default=1...
c8f44daae94dfd4f43661c5c42fe6a680422e98c5fccc4974b79d9b0f3dd295a
Python
5,298
147
# MIT License # Copyright (c) Kentaro Wada from __future__ import annotations import math import uuid from typing import TypedDict import numpy as np import PIL.Image import PIL.ImageDraw from numpy.typing import NDArray from .._shape import CIRCLE_POINT_COUNT from .._shape import LINE_POINT_COUNT from .._shape imp...
3797733966a2d44c3f7c61a1b641aadaa157c1385e41b8af5c2191f51e8ef788
Python
5,299
143
import os from copy import deepcopy import numpy as np import argparse import innvestigate.utils as iutils from keras.models import Model from keras.preprocessing import image from keras.utils import to_categorical import keras import tensorflow as tf from numpy import average, dot, linalg from utils import * from lrp ...
7d2941a9f55f770391ab43ab147d284b5700186372e3bfccfee5a84d3d2ca40c
Python
5,299
126
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
924520e0ad84601c55bedce935629c05ca27d4639667f903d15de386b9a923d4
Python
5,299
150
from copy import deepcopy from dataclasses import dataclass from typing import TYPE_CHECKING from eir.models.input.sequence.transformer_models import SequenceModelConfig from eir.setup.input_setup_modules import setup_sequence from eir.setup.input_setup_modules.torchtext_port.vocab import Vocab from eir.setup.schemas ...
3898d7dc2387aefc3987a20e8bd461aa7de913d299b855912438bd6388f97fa9
Python
5,300
115
"""Run the Python MEA-NAP pipeline with parameters matched to the MATLAB parity run (parityRun/params_matlab_parity.mat), so the two runs' CSV outputs can be compared field-by-field. uv run python parityRun/run_python_parity.py """ import sys from pathlib import Path REPO_ROOT = Path(__file__).parent.parent sys....
51eca7997bf28c99ed4c71ef9cfb535964bbaadf92cf3900298f545184c132b4
Python
5,300
275
#! /usr/bin/env python # aponteeduardo@gmail.com # copyright (C) 2017 '''' Basic container classes. ''' from collections import Sequence import numpy as np from copy import deepcopy from scipy.integrate import cumtrapz class AlgebraicObject(object): ''' A class for the units statistics. ''' fields = [...
2e07d78b0abc63abb5ddf8dc0c8e0ee8ade0eef2ee38648ccc98c899a534555e
Python
5,302
150
"""Hyperparameter Configuration Space.""" import numpy as np import random class Hyperparameter: """ Class defines a hyperparameter and its range. """ def __init__(self, name, type, range=None, min_value=0, max_value=0, step=1): self.name = name self.min_value = min_value self....
d23c2dee19aa96ad3f4a00f41c94c463bae82f9330482b76d95c3e64cd9730a4
Python
5,302
125
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Henrik Zunker # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lice...
d6f0cd69040816d7fa85512f5c740dc69529343af13112663038823b3feddbcf
Python
5,302
156
import nibabel as nib import numpy as np from nibabel.streamlines import load, Tractogram, save def _apply_axis_flips_mm(streamlines, img_affine, img_shape, flip_x=False, flip_y=False, flip_z=False): """ Apply optional left-right (X), anterior-posterior (Y), and inferior-superior (...
ea6b2e62f5060cfad0a56aec2210d57d76bb2eec8cc7a29c04d985dc43e18063
Python
5,302
157
from unittest.mock import Mock, create_autospec, patch import numpy as np import pytest import torch from scipy.special import softmax from sklearn.preprocessing import StandardScaler from eir.models.output.sequence.sequence_output_modules import ( SequenceOutputModuleConfig as SeqOutputModuleConfig, ) from eir.s...
1983546c33a42dfa12b0eff7f7c5f8dbc931f737a36d3b52381414ca5f57ae61
Python
5,303
139
import torch from torch import nn, Tensor from torch.nn import init import my_setup from custom_layers.custom_module import BatchEvalModule from custom_layers.dense import Dense class RegressorModel(BatchEvalModule): def __init__(self, num_features=32, config=None): super(RegressorModel, self).__init__()...
2aacbe8507b7d2b3f4898d36f59cd76a8eb831b3f9dc06b64a108f93549041a6
Python
5,304
172
""" :mod:`ergodic` --- summary measures for ergodic Markov chains ============================================================= """ __author__ = "Sergio J. Rey <srey@asu.edu> " __all__ = ["steady_state", "fmpt"] import numpy as np import numpy.linalg as la def set_self_transition_zero(x): """Set cost/length of...
0f26fe26dc237d796313773a30c28c86c2f0be89cf806ee6226e2316f0c7dd5a
Python
5,306
145
"""LAION-fMRI baseline sweep across the 20 headline benchmark variants. Default lineup is the 5-model baseline reported in METHODS.md (alexnet, alexnet_random, resnet50_tutorial, convnext_tiny, resnext101_32x8d_wsl) + one additional shipped-layermap model (convnext_base). Edit ``MODELS`` below to swap in your own. Ru...
bbba7158f50fbe80fe02ecd6c0c4742e0f1d10724c99540c798cd4d27a218460
Python
5,307
139
import time import argparse import torch import torch.nn.functional as F from torch.utils.data import DataLoader from torch.nn import ModuleList, Linear, BatchNorm1d, Identity from ogb.lsc import MAG240MDataset, MAG240MEvaluator from root import ROOT class MLP(torch.nn.Module): def __init__(self, in_channels: i...
28eeebd5b90434fb9465808b48975f860885437e6a92d889316ed113a89c9185
Python
5,308
94
from brainscore_vision import metric_registry from .metric import CrossRegressedCorrelation, pls_regression, ridge_cv_regression, ridge_regression, \ dual_ridge_regression, dual_ridge_cv_regression, single_regression, linear_regression,\ pearsonr_correlation, ReverseCrossRegressedCorrelation, ReverseTrainTestSp...
40f74a6487b67155edc43b3d47ba9db162f4bcc42faa6d869bd307b8fe9acbe3
Python
5,308
183
import torch import torch.nn as nn from torch_geometric.nn import global_add_pool from torch_geometric.nn import ( JumpingKnowledge, global_add_pool ) from layers import ( AttentiveLayer, GATLayer, GINLayer, MPNNLayer ) from activation import get_activation class Atte...
5fc4e41315e541e2df37130e6e9cf12e2246593e88608d27d1a3c391f5367904
Python
5,308
133
"""Hermetic contribution checks for portable and bundled skills.""" import importlib import json from pathlib import Path import shlex import sys from markdown_it import MarkdownIt import pytest import yaml from chemgraph.registry import ToolRegistry from chemgraph.skills.lint import lint_skills ROOT = Path(__file_...
a96b4cc35876bb62cc19e6c3595fc7a372389be16493040fff3ca95ce1fc94a4
Python
5,308
173
def get_indx(scrub_input, frames_in_1D_file): """ Method to get the list of time frames that are to be included Parameters: in_file (str): path to file containing the valid time frames Returns: scrub_input_string (str): input string for 3dCalc in scrubbing workflow, ...
e323747c4bb2a7bc025ec30961cd1796078eda7e99c1bb0fb538abcbe2ce7cb3
Python
5,310
142
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license # Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved """Necks are the interface between a vision backbone and the rest of the detection model.""" from __future__ import annotations from copy import deepcopy import torch from to...
dca453090dfe2e0bf9544b8b08946c9f7937f05ea81132ae2f2219c293356c0c
Python
5,311
154
#!/usr/bin/env python3 """ Usage: ./prepare.py --tech nanopore --cohort clinical --proj_dir /path/to/long_read_archive/nobackups/ Author: Mei Wu, https://github.com/projectoriented """ import os import glob import sys import logging import argparse import pandas as pd import pysam LOG = logging.getLogger() logging.ba...
7633fd8a56e03ab6975252c941e7d8772aa1ca0ad74ed92706cea5c2491e2f70
Python
5,312
139
# -*- coding: utf-8 -*- """TODO""" import numpy as np import core.core_global as core from core.core_definitions import simulation_timestep from core.spiking_group import SpikingGroup class PoissonPatternGroup(SpikingGroup): """TODO""" def __init__(self, size, rate=1.0, rate_bg=1.0, params={}): """...
05512c0392045d60d85e650b658826fb546e621d641c3628741169ee87359a71
Python
5,313
109
import itertools import numpy as np from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_core import Metric from brainscore_vision.metrics import Score from brainscore_vision.metric_helpers.transformations import apply_aggregate class AccuracyDistance(Metric): ...
7d58fe43e5fef8551ab936cea73deb949cf5580c7bf60bd5052f4a2f8b32c3cf
Python
5,313
135
import fcn_megfmri import numpy as np import pandas as pd import seaborn as sns import scipy.stats as stats import matplotlib.pyplot as plt # get custom colormaps cmap_seq, cmap_seq_r, megcmap, megcmap2, categ_cmap = fcn_megfmri.make_colormaps() plt.rcParams['svg.fonttype'] = 'none' plt.rcParams['font.sans-serif'] =...
1446cc2449ef5c42bfc52453dd8c68d6fea5c7705a85b721e9f0105b480db1b9
Python
5,314
180
# Copyright 2015 Numenta Inc. # # Copyright may exist in Contributors' modifications # and/or contributions to the work. # # Use of this source code is governed by the MIT # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. """ Tests the score normalization scheme. """ import c...
5728a8bef3819205c08452e8abf95bee951770f3bbc948fbada40f841b857868
Python
5,314
144
from __future__ import absolute_import from torch import nn from torch.nn import functional as F from torch.nn import init import torchvision import torch from .pooling import build_pooling_layer from .xception_model import * __all__ = ['Xception', 'xception'] class Xception(nn.Module): __factory = { ...
9dc6aabe24ee11835c4ad614fbd900062b344953698eb5c28a2caede3b29137f
Python
5,315
172
import re import sys import enum import pathlib import argparse import warnings import collections import pandas import numpy from pprint import pformat from .record_reader2 import RecordReader class DataFrameBuilder: class Type(enum.Enum): Analog = enum.auto() Text = enum.auto() Invalid = enum.auto()...
e437c0674bfbe1e6f2f34379241a02229edb85c3264678a3feb28218e87302ef
Python
5,318
211
"""mobilenet in pytorch [1] Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, Hartwig Adam MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications https://arxiv.org/abs/1704.04861 """ import torch import torch.nn as nn cl...
108b0d9cade5a6c72e535c8f249d06cabeb4ad2987c42e7cb6a925a79c22b4a2
Python
5,319
142
from brainscore_vision.model_helpers.check_submission import check_models import functools from transformers import AutoFeatureExtractor, CvtForImageClassification from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image import numpy as np import torch """ Template module fo...
13d4708804a6a47b1a8608b1ca3e79fae345c42a3ddf2f56183314acaaf7b751
Python
5,319
180
#!/usr/bin/env python """ split bam file into .shrt.bam and .long.bam Created by Rongxin Fang Modified by Armen Abnousi """ import sys import pysam import collections from itertools import islice from itertools import combinations import time import os import subprocess import shutil import glob def main(): input_t...
b23b906126ca629c19c5e2bdf1970223d6b26e1833aa0ea4bcc89fbb6cc33e0e
Python
5,319
142
from brainscore_vision.model_helpers.check_submission import check_models import functools from transformers import AutoFeatureExtractor, CvtForImageClassification from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image import numpy as np import torch """ Template module fo...
d4447be55855b6bf90696db54bf976f07f812df0a0ccf1042f59f643209dcecd
Python
5,319
122
import pandas as pd import matplotlib.pyplot as plt import numpy as np import os import seaborn as sns # Load the CSV file file_path = 'INSERT_PATH_HERE' output_dir = 'INSERT_PATH_HERE' df = pd.read_csv(file_path) # Define brain regions and name mapping brain_regions = [1011, 7, 2, 174, 173, 175, 1030, 17, 1024, 102...
448d6af7067095e3f9312fe3eefae09f6a7de0d43108a70b8c212f0725e88318
Python
5,321
119
import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader, TensorDataset, random_split from sklearn.preprocessing import StandardScaler import numpy as np import pandas as pd import os import argparse from model_options import TransformerClassifier, load_compatible_state_dic...
c31099948fcfddec78f6f3e503ec0889b652404b115527a9539757e3303bf4be
Python
5,321
149
import os import numpy as np import git import yaml import sys pathpath = 'PATHS/sompaths_units_IBLpassive.yml'# myrun = 'runIBLPasdMP3_brain_pj' ncluststr = '8' cmethod = 'ward' ncl = int(ncluststr) nshuff = 2000 signif_levels = np.array([0.05,0.01,0.001]) tuning_attr_names = ['stimTuned','choiceTuned','feedbTune...
e7805cfb96a242f5889a82d69cdfc160d0f9ba5744609de02f64e0a62ec20bc1
Python
5,325
127
"""Using for merged ab-ig graph """ import sys sys.path.append('..') import torch import torch.nn.functional as F from torch import nn from torch.nn import Linear from layers.conv import ConvBlock, GINEConvBlock from layers.predictor import Predictor, MixtureDensityNetwork from common import utils from common.mapping...
ee2ddec95ffb11c8daa662f2957330ac2ed73e4e74cc64532614c0234fc1caad
Python
5,326
118
import numpy as np import pickle import math import os from Functions import load_result from Functions import save_result from Trace_Value_Extraction import test_top_value def NED_SED(c, test_path): # Calculate NED and SED # A is related to NED and B is associated with SED layers = model_layers Cmodels = class...
4221b4c172c735707a6e1306b0fd93357058b9bfda40b96bdda304c855dc3d44
Python
5,327
141
"""Test pipeline Step 4 — network metrics parity with MATLAB. Run from the repo root:: uv run python python/test_pipeline_step4.py Only the deterministic metrics in ``meanap.pipeline.network_metrics`` are checked here (see that module's docstring for what's out of scope — anything depending on randomized null mo...
649e4bead9ce9a11cbf80fa463aad04bdebcf193c7711c68a0f8184eef9e3a95
Python
5,328
153
"""Preprocess BraTS volumes into normalized 3-channel .npy training data.""" from __future__ import annotations import argparse from pathlib import Path import nibabel as nib import numpy as np import splitfolders from sklearn.preprocessing import MinMaxScaler def parse_args() -> argparse.Namespace: parser = a...
24e8b9830196e7a243ef48df6898fe78fc7a9d50fc7fbab91a065bda6efa6634
Python
5,331
165
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from collections.abc import Sequence from typing import TypedDict import attrs import attrs.validators import torch import torch.utils.data from torch import Tensor from cvat_sdk.datasets.common import UnsupportedDatasetError from cvat_sdk.pytorch....
d6b10e81b5d5bc1fd5225ed35c5da1ba683d6df42e725fd6db2569d993cb6d01
Python
5,331
113
from PUMI.pipelines.func.func2standard import atlas2func from nipype.interfaces import afni import nipype.interfaces.utility as utility from PUMI.engine import GroupPipeline, FuncPipeline, NestedNode as Node, QcPipeline from PUMI.utils import relabel_atlas, get_reference, TsExtractor, timeseries_carpet_plot @QcPipeli...
5f01a0ea230fc8ab937e6a0c15f06666c877da3519df5b4844b131ea24ec33c6
Python
5,332
71
# fsl_anat # Usage: fsl_anat [options] -i <structural image> # fsl_anat [options] -d <existing anat directory> # Arguments (You may specify one or more of): # -i <strucural image> filename of input image (for one image only) # -d <anat dir> directory name for existing .anat directory...
71667931eab91874476d24f847e1711ebbf449c3d3fa702b657fa264b4c3744f
Python
5,333
142
from brainscore_vision.model_helpers.check_submission import check_models import functools from transformers import AutoFeatureExtractor, CvtForImageClassification from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image import numpy as np import torch """ Template module fo...
a4e099471b747b9fadf7800a0013a4ba17c213cbcb2eb16b8574c825964c246d
Python
5,333
145
import os import logging import shutil import xnat from xnat.mixin import ImageScanData import dicom2nifti from dicom2nifti.exceptions import ConversionValidationError from util.config_vars import config from util.io import make_dir_if_not_exists class DataImport: """ Imports the MRI-data as DICOMs using sp...
e5c46ec55498183980bd617b2c69e55be2cad6666d7e5a5c95ce9a93a4ffcadd
Python
5,333
142
from brainscore_vision.model_helpers.check_submission import check_models import functools from transformers import AutoFeatureExtractor, CvtForImageClassification from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from PIL import Image import numpy as np import torch """ Template module fo...
b6affc7a25f98152f6a45df9bc312ce67064bb53bdf269b6b5a912b6a4c58cd4
Python
5,334
152
#!/usr/bin/env python """ Wraps the pySerial library for RS232 communication. Hazen 3/09 """ import serial import time class RS232(object): """ The basic RS-232 communication object which is used by all the objects that communicate with their associated hardware using RS-232. """ ...
c848865648bfb1a9bff5221b0a9eeb43eb9b7c46752dd35c0784846eab912089
Python
5,334
152
from __future__ import division import numpy.ma as ma import numpy as np import scipy as s import scipy.special as special from mofapy2.core.utils import * from mofapy2.core import gpu_utils # Import manually defined functions from .variational_nodes import Gamma_Unobserved_Variational_Node from mofapy2.core.distrib...
8e77459f74632e73ef7eb76547be8805afca71fb34a838fcba88ce1073faeb25
Python
5,335
137
import sys import numpy as np from scipy import sparse import scipy.stats import tempfile from pathlib import Path import subprocess import multiprocessing import boto3 import nibabel as nib import nibabel.processing import time import os import pickle chunklistfile=sys.argv[1] parcname=sys.argv[2] reffile=sys.argv[3...
4f40f0c7719f4a546596d65872a8a1ba6b84df2df7965534b935fe9d01421c61
Python
5,343
163
import random from typing import Optional, Sequence from pathlib import Path import hydra import numpy as np import omegaconf import pytorch_lightning as pl import torch from omegaconf import DictConfig from torch.utils.data import Dataset from torch_geometric.data import DataLoader from xrdsol.common.utils import PR...
98c89ae3b7213ac53a395f84a982aa5cbdf5f0e19235ffaa785486527f280ea9
Python
5,345
133
""" Metrics to assess performance of weight models. Function named as ``*_error`` return a scalar value to minimize: the lower, the better. Metrics' interface doesn't strictly follow skleran's metrics interface. """ import pandas as pd import numpy as np from ..utils.stat_utils import ( calc_weighted_ks2samp, ...
faa98b8e54222955a6b4779f008204f7b750c4471a05f7ad3099ef81866ec248
Python
5,347
153
import glob import os import os.path as osp from typing import Callable, List, Optional import torch from torch_geometric.data import ( Data, InMemoryDataset, download_url, extract_zip, ) from torch_geometric.io import fs, read_off class ModelNet(InMemoryDataset): r"""The ModelNet10/40 datasets ...
1d2ccc7c0d88bcb4675f7f4fd637e66dd0855daea3701d3da3aa3beff132a27f
Python
5,348
186
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015-2022 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 PA...
297db13ede7d3deb3fb14a52009f44c55b7721345c0f6e37dfb70f8912a29eae
Python
5,348
186
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015-2022 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 PA...
39c95bd357bbf42f358a786f926b4453d5cc6ef89672fcd303192d8b1abea961
Python
5,348
186
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015-2022 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 PA...
917b1aef7a970bfbfc76918b04029983272afdab5a0ef508bbd2e4101222566c
Python
5,349
189
# %% import csv import json import torch from argparse import ArgumentParser import re import torch def clean_str(string): """ Tokenization/string cleaning for all datasets except for SST. Original taken from https://github.com/yoonkim/CNN_sentence/blob/master/process_data.py """ string = re.sub(r"...
cf512624ab453208ebf0d50ae5297cad22c4a1d7f1d774afc79948b0c3d5d515
Python
5,349
139
import os import numpy as np import argparse import subprocess import psutil import re def kill_process_tree(pid, including_parent=True): try: parent = psutil.Process(pid) children = parent.children(recursive=True) for child in children: child.kill() psutil.wait_procs(...
343290386c911f835c2eefc6e1381be4e683238a347a183e6c4ee1c1d2db74ad
Python
5,350
186
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015-2022 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 PA...
8bb0940afafa8e38b8999edbe85986748fa87937f0df6d6875e121a7ed75438d
Python
5,350
139
# This file contains experimental modules import numpy as np import torch import torch.nn as nn try: from ..models.common import Conv, DWConv from ..utils.google_utils import attempt_download except: from keypoint.models.common import Conv, DWConv from keypoint.utils.google_utils import attempt_downlo...
fc5823fab581a7a282a4f2a234d4bcd1b985e3afb7422d044fc7c87b17943fb9
Python
5,350
141
#! /usr/bin/env python """Summarize what has been computed for each segmentation in a dataset. ``status config.yml`` scans the work_dir and reports, per segmentation and per membrane surface, which steps have run: meshing, curvature, refinement (and the accepted iteration), and which distance / orientation / thickness...
16e715661664d5b4d63fe1dd42727813676300b9dc838a4e60357a89d198d2ea
Python
5,352
171
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL from dataclasses import dataclass from pathlib import Path import json from click.testing import CliRunner from connectome_manipulator.cli import app from bluepysnap.circuit import Circ...
3c291ed5d836f75785f9ac91e1ad0d2779e36ca571b4c599a64902bcdc3acd18
Python
5,352
186
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015-2022 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 PA...
56a5b7d24087c81c00d7aa29c8d05502acee63243294e047a5d155c7a97722c8
Python
5,352
186
#!/usr/bin/env python """Python script to run cell model""" """ /* Copyright (c) 2015-2022 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 PA...
3f7c7952bb8c97535aaa9a813a74e0e183a0cc0e28a3f336f20d490f5d86d901
Python
5,353
118
"""Which earlier runs this one may read from. This used to sit on the Paths tab, three groups below the folders it had nothing to do with, while the switch that turns it on — **Use prior analysis** — was on another tab entirely. You could fill these in and have them do nothing, or tick the box and have it fail on a fo...
be767771de4bde197620b0492d4d48719657324dc4a95cd60c0869c6f292fb7e
Python
5,353
153
############################################################################### #################### Boilerplate ######################## ############################################################################### import pandas as pd import matplotlib.pyplot as plt import os import matplotlib...
f6243d9afa99f8f1b5672a0e09ae28b786814f420c7094a1881a50cfa1a0f3c4
Python
5,355
170
from __future__ import annotations from dataclasses import dataclass from functools import cached_property from typing import Optional, Sequence, Union import cv2 import numpy as np import torch from brainglobe_atlasapi import BrainGlobeAtlas from numpy.typing import NDArray from brainways.utils.atlas.slice_atlas im...
a50a128aa0a777fbfa5dc5bbdf57546e9fcd9ef53e9ffc9058c0720b8f3c699c
Python
5,356
112
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import ast from urllib.parse import urlsplit import numpy as np class TritonRemoteModel: """Client for interacting with a remote Triton Inference Server model. This class provides a convenient interface ...
b44cf08be7a7510c4bfaa762ea6104d668387573dd7e62e792cffa59d83186f1
Python
5,356
138
"""A module that contains unit tests for the :py:mod:`corelay.processor.flow` module.""" import pytest from corelay.processor.base import FunctionProcessor from corelay.processor.flow import Shaper, Parallel, Sequential class TestShaper: """Contains unit tests for the :py:class:`~corelay.processor.flow.Shaper` ...
95a0627f216bc9fad73df140266ef8df4f7b5c79a3eda53195783ca9b0693214
Python
5,357
180
import base64 from collections.abc import Sequence from functools import partial from pathlib import Path from typing import Any import numpy as np from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save from docs.doc_modules.serve_experiments_utils import copy_inputs from docs.doc_module...
a351490051f73436b53787d820331b99ce4695001b0afae5a3e3e43c85fef896
Python
5,357
142
"""LangChain ``@tool`` wrappers for the ALCF IRI Facility API. Each tool delegates to the pure-Python implementation in :mod:`chemgraph.tools.alcf_iri_core`. Seven category tools (facility, status, account, compute, filesystem, task, auth) instead of one @tool per endpoint. Each accepts an ``action`` enum plus option...
073038ad5563ca8a57a92748649c6123e7d097e839a1962d3a6c41a61c5d9bc5
Python
5,358
180
import numpy as np import concurrent.futures from heig.utils import inv class LDSC: """ cross-trait LDSC for estimating the intercept when there is sample overlap """ def __init__( self, ldr_z, y2_z, ldscore, ldr_heri, y2_heri, n1, n2, ...
2175f3010de1fb0fc776dfd1941186523bbc8fe48b4a4dc80a4fa90ad70521c5
Python
5,358
186
#!/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 PARTICUL...
46711a387f6556a257f7b9ccd8bcc849bb055ab19db467bf7993dec647003f22
Python
5,358
168
from __future__ import annotations import dataclasses import numpy as np import osam from loguru import logger from numpy.typing import NDArray from .._ai_models import supports_point_prompts from .._shape import Shape from ._geometry import _round_bbox_to_int from ._osam_session import OsamSession from ._shape_buil...
6cb01fcc4ed6ae3868c61bbe6b71c2c6157f1ffe9a406036a2830bde45fd640c
Python
5,358
153
import tempfile from pathlib import Path from typing import Optional import click import numpy as np import tqdm from simple_mri import SimpleMRI, load_mri, save_mri from loguru import logger from dti.utils import mri_number_of_frames from gmri2fem.reslice_4d import reslice_4d def construct_tensor_from_eigs( dt...
baa8552fe76ebfa5aac476c122b4ae682da619a52f85ce25dd71abe235feb8b6
Python
5,358
181
# Authors: Lucas Berg and Elnaz # # Program that calculates the APD for a single cell in the grid by passing its # transmembrane potential over the time as input. # # This program also works with multiple AP's ! import sys import subprocess import time import numpy as np def forwarddiff(y, h): n = len(y) re...
cfe274f9759e48dd146d5b3f18b2bd3ee24700d67992d2794c98235f5bd922a1
Python
5,358
186
#!/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 PARTICUL...
e4249d33a65f008d095afde0af78f6f01539a0af9a69978105e028a9aa8b4903
Python
5,358
186
#!/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 PARTICUL...
4f77b238f4231366cc39455aea3c5a8fef6205dfa247eea9ecb0ea01fcdebe77
Python
5,359
192
""" This script demonstrates * the kx-ky sampling pattern in diffusion MRI, * the ky-diff sampling pattern in diffusion MRI. Author: Zhengguo Tan <zhengguo.tan@gmail.com> """ # %% import numpy as np import matplotlib.pyplot as plt import argparse # %% parser = argparse.ArgumentParser(description='plot sampling ...
0c6c754aa84919cea129350e85e2440ff6c2b398eaeea395412f33896a147d00
Python
5,360
201
#!/usr/bin/env python3 """ Pre-download BigWig/BigBed tracks for Docker image This script pre-downloads all genomic tracks specified in a bwq_config.yaml file into a persistent cache directory. Used during Docker build to create "prewarmed" images with tracks already cached. Usage: python predownload_tracks.py <b...
3ac03556018722d20cb8eb27c15e140c3d78aa6e833aa5a01a0fbbd97f624cc6
Python
5,361
170
#!/usr/bin/env python """ Generic Obis laser control (RS-232 over USB). Hazen 7/10 """ import traceback import storm_control.sc_hardware.serial.RS232 as RS232 class Obis(RS232.RS232): """ This controls a Coherent Obis laser using RS-232. """ def __init__(self, **kwds): """ ...
b16eaa103560bdbc3e899c8cd749e1e79545ec74e030e80261b94b73151f1a91
Python
5,361
172
from dataclasses import dataclass from pathlib import Path from typing import Literal, Optional import numpy as np import torch from eir.setup import schemas from eir.setup.input_setup_modules.common import ( DataDimensions, get_data_dimension_from_data_source, get_dtype_from_data_source, ) from eir.setup...
545f01fc2baa59842bfe4094b70ec037f1449b06c8555ba2af9539a9d940a9d8
Python
5,362
186
#!/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 PARTICUL...
303d3c1a0912de91bb947709dffabea7ae2bb92df7e4a9b0367e6bb7bbbf907d
Python
5,363
153
import torch import torch.nn as nn import numpy as np import ase from ase.io import read # utils imports from utils.plot_corr import plot_corr from utils.neuralnets.FFNet import FFNet from utils.distances import get_bond_length_hoxa from utils.kernels import get_1D_kernels_k33 # define options torch.set_printoptions(...
7d10ff8fc8165130a1a1914dfa34814fc8287de6b3847e580b1f4e36fc64c9bd
Python
5,363
128
""" This module contains both standard metrics from libraries and custom ones for evaluation of our models. The idea is to gather all of them in one module for better imports and referencing. """ import os import numpy as np from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, confu...
17e3623b9b7cf739ca8cd922c9973dd76347f9b281919ec0284db6bd521629e0
Python
5,364
147
# -*- coding: utf-8 -*- # python standard library inputs import os # external inputs import numpy as np import nibabel as nb from nipype.interfaces.fsl import ErodeImage, DilateImage from scipy.ndimage.morphology import binary_fill_holes def skullstrip_epi(file_in, roi_size=5, scale=0.75, nerode=2, ndilate=1, ...
665eb7c6bf936f565fb91aaf56e32c4e1f4211f54e944683da4c239845d76e2f
Python
5,364
186
#!/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 PARTICUL...