sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b9154feb7b75464d0667c49b92105a097210f8eb36d9934f56f34b52a5304010
Python
4,878
219
# laminar_rs/__init__.py """ Laminar resting-state analysis toolkit (functional API). Public surface: - LaminarConfig - IO utilities - Connectivity & adjacency builders - Embedding & diagnostics - Embedding-space plots and brain maps - Graph metrics & connectograms - Statistical models - Reliability analyses - Gradien...
2c2bdc7dd7dd0485621fb60730966c689166ccff89971efa541f899d3ba3623a
Python
4,881
123
import tensornetwork as tn from my_tensornetwork import FinitePollmann import numpy as np import time class DMRGPollmann: def __init__(self, n_qubits): self.n_qubits = n_qubits # train1 read_data = self._dataset_Pollmann("train1") self.h1h2_i_train1 = read_data[0] ...
49f0bdb3aa0293dae541855b7c1633dde4ae3d4277bb21bfe0db9a026a462a01
Python
4,882
114
import numpy as np from nems.models.base import DataSet def test_array_input(spectrogram, response, state): # Array, no samples. d = DataSet(input=spectrogram) assert d.inputs == {DataSet.default_input: spectrogram} assert d.outputs == {} assert d.targets == {} d2 = DataSet(input=spectrogram...
e5d9ccf45afadc50474c1c26364ecfb3ffdf60be1a0897ea51b5a114b0189b42
Python
4,882
173
""" Activations A collection of activations fn and modules with a common interface so that they can easily be swapped. All have an `inplace` arg even if not used. Hacked together by / Copyright 2020 Ross Wightman """ import torch from torch import nn as nn from torch.nn import functional as F def swish(x, inplace:...
67c8b064c4549cbb39732759e4d60a319ec34c2e5fab9b2a2b026d5b9ded5e5a
Python
4,883
138
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from collections.abc import Callable from datetime import timedelta from typing import Any, Protocol from django.conf import settings from django.http import HttpRequest, HttpResponse from django.utils.functional import SimpleLazyObject from rest_fr...
dbc80241ae39d8bb1c0322a19ec0a0d5126c8267d11d03c660efb498f590b1cd
Python
4,883
171
from mpi4py import MPI import sys import __main__ import math import pandas as pd import numpy as np from sklearn.neighbors import NearestNeighbors import pywt from scipy.signal import hilbert, hilbert2 def get_coords(index): coords = pd.DataFrame(index=index) coords['x'] = index.str.split('x').str.get(0).ma...
ba1dbbc31903e05da252a5c4ac9fb3e497916bd36f83fb7b411580a7fcb8ceb0
Python
4,885
162
from types import SimpleNamespace import numpy as np import pytest from matplotlib.backends.backend_agg import FigureCanvasAgg from matplotlib.figure import Figure from napari_dmc_brainmap.registration.registration import RegistrationWidget from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.model.HelperM...
e360d1660eba95e7c6fb81c33d3913b908e3a16a53c095e10c2141bea6d5d5ce
Python
4,885
136
# TODO add typing and docs from typing import Optional import os import itk from brainles_preprocessing.registration.registrator import Registrator from brainles_preprocessing.utils import check_and_add_suffix class ElastixRegistrator(Registrator): def __init__( self, ): pass def regist...
44f7dbd456f6068fc95c07d3cb7a810c0aff86c32d96e0828882648a997639b8
Python
4,886
164
# -*- coding: utf-8 -*- """ Created on Mon Jun 19 15:36:01 2017 @author: goel """ import operator as op from functools import reduce from os import remove def readfaidxbed(f): """ Reads .faidx file from a genome assembly and returns a BED file consisting for entire chromosomes """ from collections...
10bc9d32dc14a6b697d90801946b5218375a0c8c7d7c57481204f563d1244cd7
Python
4,888
148
#!/usr/bin/env python3 import arbor as A from arbor import units as U from argparse import ArgumentParser import numpy as np import pandas as pd # You may have to pip install these. import seaborn as sns # You may have to pip install these. import matplotlib.pyplot as plt class TwoCellsWithGapJunction(A.recipe): ...
6feb99a70a246ae05285a165dd98ccecb14a1520766f59c68f5610d3b4cd518b
Python
4,888
114
#@LogService log """ file: Sholl_Extract_Profile_From_Image_Demo.py author: Tiago Ferreira info: Demonstrates how to programmatically obtain a Sholl profile from a segmented image """ from ij import IJ from sc.fiji.snt.analysis.sholl import (Profile, ShollUtils) from sc.fiji.snt.analysis.s...
1a9fd719ec244b8237b8b1d0bd3b1c6ec7f080886f6c1c19cd0a7d4690de00f3
Python
4,890
129
""" SwinSite — Protein Binding Site Prediction Predicts binding pockets using a 4-fold ensemble of 3D Swin Transformers. Large proteins (>70A span) are automatically handled via multi-grid surface sampling with C-alpha farthest-point sampling. Usage: python predict.py -i <input_dir> -o <output_dir> python pre...
8bb814ab53001cc72fd31a24dd0a04de75e1b30b907c922434c66aca167303a1
Python
4,890
124
############################################################################# # 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...
d2755863a342160c882066dc9392b850a8e7c0cbf88ee637bcea0743ab2c93dd
Python
4,890
126
"""Parity test: Python stim detection vs MATLAB detectStimTimes/getStimPatterns. Ground truth is generated by ``python/test_fixtures/gen_stim_detection_reference.m`` (MATLAB called directly on the two testMEAstim raw recordings). Validates that the Python port reproduces, per channel: - the exact stim onset times, ...
67605f238f77a082b4b1b4a9826cf4784d60fc7e7b1a019f27107cad37b2c2ba
Python
4,892
173
""" Discover and catalog neural scaling model paths and metadata. This script scans a base directory for model paths, extracts metadata like training data ratios, and creates a CSV file with model information for use by evaluation scripts. """ import glob import os import re import pandas as pd from dotenv import lo...
7ffd98888eb6bd1113c47a9dd12a361e49faf40d1cc873ca47d0be0b9988ae79
Python
4,892
115
########################################################################################## ### Functions to calculate the quality coefficient Q from the firing rate distribution ### ### during recall of an input-defined cell assembly ### ###############################################...
c4db72790b12fded97b3d9cf9921fa4e99b6fe11f62b1e77c44e155e76c4133d
Python
4,893
153
""" DyNeMo: Plotting Networks ========================= In this tutorial we will plot networks from a DyNeMo model trained on source reconstructed MEG data. This tutorial covers: 1. Load regression spectra 2. PSDs 3. Power maps 4. Coherence networks 5. Coherence maps """ #%% # Download post-hoc spectra # ^^^^^^^^^^^...
f5be83de64f0afa714ba334269fed5486a17bdf7c6531a4fc32c13b6c460e9ec
Python
4,893
156
"""MCP client utilities for the ChemGraph CLI. Handles connecting to MCP servers and loading tools for use with MCP-enabled workflows (single_agent, multi_agent, etc.). """ from __future__ import annotations import os import shlex import time from typing import List, Optional from rich.progress import Progress, Spi...
9ef950bba55fa9b36a25e2e025ffd79223cc68d8c6cc3dab8462d716a79a8cea
Python
4,894
143
#!/usr/bin/env python3 """ main.py ------- Train MoAGNN on custom graphs (.pt) with 5-fold cross-validation. - Reads folds from data_load.load_5fold_splits (no TU datasets). - Early stopping on val loss; saves best model per fold. - NLLLoss (Net outputs log_softmax). """ import os import argparse import torch import t...
fc05cb6401c0706ee9618611bafa54d95f9143a0d473149ab067894b6ee63165
Python
4,895
157
import numpy as np import torch import matplotlib.pyplot as plt from scipy import stats import os def compute_rmse(predictions, targets): """计算RMSE""" return np.sqrt(np.mean((predictions - targets) ** 2)) def compute_accuracy(predictions, targets): """计算准确率""" return np.mean(predictions ==...
db17caeb69417911fbb0df30ddb04a4a38e60ebbb5cc6dde5f5f9f98e99af476
Python
4,896
161
''' C6H6O ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for C6H6O: P: potential energy, G: Gradient, D: Nonadiabatic coupling vector U: diabatic potential energy matrix UG: gradient of diabatic potential energy matrix This is listed at the e...
2eefe64923a23202a114e7102e9eeab3ab12843589f9134562c4908ca2865963
Python
4,898
140
import torch from torch import Tensor from typing import Tuple, List, Optional @torch.jit.script def _crop3d(img: Tensor, x: int, y: int, z: int, w: int, h: int, d: int) -> Tensor: """ torch scriptable function which crops an image :param img: torch.Tensor image of shape [C, X, Y, Z] :param x: x coor...
bd1d6f2443814ee800383539d797bc07557f444d31b96591c87f4cdf5092d5ee
Python
4,898
73
import argparse def update_data_args(parser): parser.add_argument("-g", "--genome", type=str, required=True, help="Genome fasta") parser.add_argument("-b", "--bigwig", type=str, required=True, help="Bigwig of tn5 insertions. Ensure it is +4/-4 shifted") parser.add_argument("-p", "--peaks", type=str, requir...
a6954438813a5fe4eb5363fc5e2a20c2e988a68000c1b06f468ab9319ee4f0b1
Python
4,900
144
from pathlib import Path from typing import Type import polars as pl import sqlclz from argclz import AbstractParser, argument from argclz.dispatch import Dispatch, dispatch from rscvp.util.database import RSCDatabase, PhysiologyDB, BaseClassDB, BayesDecodeDB, VisualSFTFDirDB, ResultDB __all__ = ['DatabaseViewOption...
bf621f752de0e65c065a6d9bcc3b5f77341c38afbdbe866cd93e241209119ebd
Python
4,900
169
""" Extracts QA values from perimeter. """ import numpy as np import nibabel as nb import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import glob import os # Set data path ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti' # Set subjects to work on subs = ['sub-05', 'sub-06', 'sub-07', '...
0a18218e723dda2c59225f0549f3404045c924512514630a20027d374207780d
Python
4,901
133
import math from typing import Literal, Final import polars as pl from argclz import as_argument, argument from argclz.dispatch import Dispatch, dispatch from neuralib.plot import plot_figure from neuralib.plot.venn import VennDiagram from neuralib.util.verbose import publish_annotation from rscvp.statistic.core impo...
41c9db0881e87bea44b4af85098dce87c894ac727d27f2afa93c2a1e131c968a
Python
4,902
118
import pandas as pd from sklearn.preprocessing import OneHotEncoder from ast import literal_eval from hashlib import sha256 def load_data_2024_10_10(data_path: str, ignore_hash: bool = False): expected_hash = "01d513fe3165bd5eb3ea6a9be52dc54afcf3d7f06cd398c18979653812797d18" # intentiona...
647b2da6d92529303d32641ca22c6794196a2a6de971919dc10295a69fd005d9
Python
4,902
128
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jul 16 12:55:01 2023 @author: jstout """ import os, os.path as op import glob import copy os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152 os.environ["CUDA_VISIBLE_DEVICES"] = "" from tensorflow import keras import numpy as np import p...
169d6c1d68c6e9659a1842fa850996c93f9ef678c091d30cd227a0dddd87a65c
Python
4,903
149
# Copyright 2016 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. import math import simplejson as json from subprocess ...
5fb001c9968538a2e28a575fdf9fdb9b30ddd884772136b4fc439eb91469d467
Python
4,904
137
## Nhat Duong & J Shapiro ## 2019 - 2020 # Imports in the pep8 order https://www.python.org/dev/peps/pep-0008/#imports # Standard library import argparse import subprocess import sys import os # Related third party import numpy as np import pandas as pd ## Define the callers and the extension to give the intermedia...
cbd76135c8fdc2dfe464a9833784edb5bc5423f61431ae75e83d4cf5ddd79935
Python
4,904
118
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import warnings import torch import torch.nn as nn import torch.nn.functional as F from torchvision.transforms import Nor...
df7445802fee07a864c1e958fb096e473e209d3b41da7188f6c207b3617023de
Python
4,904
192
################################################################################## ### Module : utils.py ### Description : Utility functions ### ### ### ### Written by : scalphunter@gmail.com , 2021/08/31 ### Copyrighted reserved by Sentinel Holdings LC ################################################################...
40b26d0682162c7caf5ea494a033f2f02d9b28151251ebad845e5573cdaa89e6
Python
4,905
108
from .survival_utils import canonize_dtypes_and_names from .standardized_survival import StandardizedSurvival from causallib.estimation.base_weight import WeightEstimator import pandas as pd from typing import Any, Optional class WeightedStandardizedSurvival(StandardizedSurvival): def __init__( self, ...
319bda3eeed4937b2e6776d5c0bb88e5830cac30ee211c743c36f62e1955a489
Python
4,907
135
from typing import Optional, Union, Any import torch from torch import Tensor import torch.nn as nn if torch.distributed.is_available(): from torch.distributed import ReduceOp ######################### # From pytorch lightning def distributed_available() -> bool: return torch.distributed.is_available() and...
6f485c8a68569f055b84d582d8654fce1f81a7c1add0bae0fbfe91ba10905807
Python
4,907
154
from functools import cached_property from typing import ClassVar import numpy as np from argclz import argument from stimpyp import ( STIMPY_SOURCE_VERSION, Session, PyVlog, RiglogData, get_protocol_name, ProtocolAlias, SessionInfo, RigEvent ) from .cli_core import CommonOptions __all__ = ['Stim...
01d3d78edc23608f166786e0936d75f5f445ff227c3d9a050e1c812ce2b9b3a3
Python
4,908
122
"""Full end-to-end CAT-NAP example run, to inspect what the port produces. Run from the repo root:: uv run python python/run_catnap_example.py [--out DIR] [--lags 1000 2500] Uses the gitignored ``local/example2pdataWCellTypes`` dataset and writes a complete output tree — every per-recording figure, the cell-type...
3104e6b12a4ad34946964d29fdd0468c09c9b08b62afcd51eefa6001b6de5a3a
Python
4,908
139
from collections import Counter, OrderedDict from collections.abc import Iterable from eir.setup.input_setup_modules.torchtext_port.vocab import Vocab def vocab( ordered_dict: dict[str, int], min_freq: int = 1, specials: list[str] | None = None, special_first: bool = True, ) -> Vocab: """ Fac...
800b186d898f9a5b07495c4e5778c6b031c4af1e39b8316f788ae0adc9bfd5b4
Python
4,908
133
# -*- coding: utf-8 -*- import numpy as np from scilpy.tractanalysis.voxel_boundary_intersection import\ subdivide_streamlines_at_voxel_faces def mrds_metrics_along_streamlines(sft, mrds_pdds, metrics, max_theta, length_weighting): """ ...
4b0576ca3fb299db24a5681648413f0cfcc937cfc0cbdd9ceb124cf92775de0c
Python
4,909
94
import csv import os from os.path import join as ospj from numpy import savetxt import pandas as pd import re import sys import json import shutil """ This script collates the pyAFQ tract profiles output across subjects in preparation for visualization and fitting GAMs. Each pyAFQ tract profiles csv should be a 1D arr...
85cf3a84969d3b305058a171c51977e2595fd4f07453b0c9b91bb3b1b0a7bbed
Python
4,909
123
# (C) Copyright 2021 IBM Corp. # # 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 applicable law or agreed to in writing...
ed7373cecb15f4465b17c98483192bf392ace6a100468938bd5cde9ac1cca771
Python
4,909
125
"""Repackage per-subject .nc files into Brain-Score S3-ready format. The only transform is **single-data_var collapse**: ``xr.DataArray.to_netcdf`` (xarray 2022.x) serialises non-dimensional coords as data_vars, which makes ``brainscore_core.brainio.s3.load_assembly_from_s3`` fail ("Given file dataset contains more th...
3ff8532b6363e353cb08e31d0bae7fde2bff4b637f09455fec8f291a6a4bdb06
Python
4,910
109
import torch from torch import nn import torchvision def get_resnet_backend( num_classes:int, p_channels:int, m_channels:int, layers:int=18, with_voneblock:bool=False, tiny:bool=False ): """Returns ResNet18 or ResNet50 backend. :param num_classes (int): number of clas...
630a660a542f58d63baab5469016d21581682896e8f067669869e0866271b284
Python
4,911
107
import random import numpy as np from tqdm import tqdm from brainscore_core import Score from brainscore_core.benchmarks import BenchmarkBase from brainscore_vision import BrainModel, load_stimulus_set, load_metric from brainscore_vision.metrics.dimensionality import Dimensionality BIBTEX = """@inproceedings{ ...
0443b71da874dfad231c6a8ab30e9cb795af5165edc96f0e074b65566c4f76e6
Python
4,912
147
from __future__ import print_function as _, division as _ import numpy as np def nonnancount(x): return (~np.isnan(x)).sum() #different methods of shuffling def shuffle_everything(T,shuffles,netsize): dT = np.diff(T, axis=1) dT = np.hstack((T.T[:1].T, dT)) dT = np.concatenate([dT[None,...] for _ in ra...
4b5c6605997ae67e78c6da1b4bff3808d33bfdbcd4e3822141f1a81df1867a0e
Python
4,912
124
from onnx import ModelProto from zigzag.classes.io.onnx.default import DefaultNodeParser from zigzag.classes.io.onnx.gemm import GemmParser from zigzag.classes.io.onnx.matmul import MatMulParser from zigzag.classes.io.onnx.conv import ConvParser from zigzag.classes.io.onnx.utils import ( parse_mapping_from_path, ...
5330ce29897dd8d379107e2f33e780669544a67755cf8f49f4659da309f4b1d9
Python
4,913
131
#!/usr/bin/env python """ Voltage controlled Z stage functionality. Hazen 05/17 George 02/18 - Abstracted from mclVoltageZModule.py """ from PyQt5 import QtCore import numpy as np import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.daqModule as daqModule import...
c57eb18d8c8983a8bdb02b7925819524b334c0453b7aa0ffa697b91edbb588a1
Python
4,916
169
import logging import warnings from typing import List, Sequence import pytorch_lightning as pl import rich.syntax import rich.tree from omegaconf import DictConfig, OmegaConf from pytorch_lightning.utilities import rank_zero_only def get_logger(name=__name__) -> logging.Logger: """Initializes multi-GPU-friendly...
dfc7b7e739de2305d519beaf01b90792f5a01c607b14b9dc81f6d319eacd88aa
Python
4,917
146
#!/usr/bin/python # -*- coding: latin-1 -*- # ============================================================================================= # Librairies importation import numpy as np import nrrd import sys import re import os import nibabel as nib # ===============================================================...
f8e137bd9015379337b864e38353200e7b36adbc2f8c3f70bd3c03d4f16ef896
Python
4,917
158
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Author: Yong Bai, yong.bai@hotmail.com @License: (C) Copyright 2013-2022. @File: _utils.py @Desc: """ import numpy as np from scipy.spatial import Delaunay import matplotlib.pyplot as plt from matplotlib.colors import BoundaryNorm def _panel_grid(fig_w, fig_h, hsp...
3cab1bcec4335f9558849cea3d62527cd1e92b5c0962d17d883d440b549f7f05
Python
4,919
161
''' C6H5SH ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for C6H5SH: P: potential energy, G: Gradient, D: Nonadiabatic coupling vector U: diabatic potential energy matrix UG: gradient of diabatic potential energy matrix This is listed at the...
fac6ba921277c05425a840d5ffcf9d11a109be6ba99b8b7d4c65de67ecc1992d
Python
4,919
131
# Generated by Django 3.2.15 on 2022-09-19 08:26 import django.db.models.deletion from django.conf import settings from django.db import migrations, models import cvat.apps.webhooks.models class Migration(migrations.Migration): initial = True dependencies = [ ("engine", "0060_alter_label_parent"),...
27bb6e41bbf545482a71131c35d7d00b3f0d6bdb82de100f153867e0d761500d
Python
4,921
140
import unittest import logging import numpy as np import diffxpy.api as de class _TestContinuousDe: noise_model: str def _test_wald_de( self, constrained: bool, spline_basis: str, ngenes: int ): if self.noise_model == "nb": from batchgl...
5322655038e53e4427a54114c66cc1239d1f727942b4840de3c6af2b0c86b84c
Python
4,921
121
import numpy as np import torch import random import pickle as pkl class NBodyMStickDataset(): """ NBodyDataset """ def __init__(self, partition='train', max_samples=1e8, data_dir='', n_isolated=5, n_stick=0, n_hinge=0): self.partition = partition self.data_dir = data...
78d23abbcbdb996fe95d9ffa553cc152fec50d5ec92a27fa9c3f6760434801df
Python
4,921
76
""" This script investigates the features within the components of the trained neural network. """ import os import argparse from utils.env_config import setup_environment from data.dataloader import prepare_dataloaders from model_analysis.interpret_model import execute_class_activation_mapping from utils.mlflow_custo...
bf08149232c19153166510a735c92ec4daa723e69da60e34493e29d9d36dec60
Python
4,921
93
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/media/lg/disk2/PycharmProjects/ISAT_with_segment_anything/ISAT/ui/file_dock.ui' # # Created by: PyQt5 UI code generator 5.15.10 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this fil...
ca37dc55dfa11471b32591b3cb320f476c9e0d45b46315bce94a3836386e40e6
Python
4,922
113
import pandas as pd import py_neuromodulation as py_nm import numpy as np import os import sys import re import glob from joblib import Parallel, delayed sys.path.append('./') sys.path.append('./') sys.path.append('./neurokin/') sys.path.append('./neurokin/experiments/') #sys.path.append('./neurokin/utils/') #sys.path....
f58947e0c3415833a075c61a7d1b58f9ac8bd2345d3b195d061b4adeefc510bd
Python
4,922
152
import argparse import logging import os.path import matplotlib.pyplot as plt import torch from skoots.validate.lib import ( get_segmentation_errors, mask_iou, accuracies_from_iou, f1_score, mask_dice, mask_soft_cldice, ) from skoots.validate.utils import imread def main() -> None: """ ...
4a8a38360adbb13375168635e1f88b020b912cefbc0339b9c3031374afc2b0c3
Python
4,923
157
"""Capture reproducible screenshots of the local browser interface.""" from __future__ import annotations import argparse import os from pathlib import Path import subprocess import sys import time from urllib.error import URLError from urllib.request import urlopen ROOT = Path(__file__).resolve().parents[1] STATIC...
c6ca027048cda2cb1439a72efa3fa8e4e29f852bba8e642262c2a908a80b406a
Python
4,923
166
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import contextlib import http.server import ssl import textwrap import threading from collections.abc import Container, Generator from dataclasses import dataclass from pathlib import Path from typing import Any from urllib.parse import urlparse imp...
b6c258683716f68b40f539b99c1cea6aac5c8e9e6e61ee37ff253ae8aa08337c
Python
4,925
142
"""Perform MDS on the trial-average fMRI responses for the NSD-core training images and the NSD-synthetic images. Parameters ---------- subject : str String indicating the number of the subject used. If 'all', then use all subjects. zscore : int Whether to z-score [1] or not [0] the fMRI responses of each vertex ac...
c73dbdf98d42c1574e2233120285df5ba92a087c02450d9a29ac959fe26f50d6
Python
4,925
135
import math import torch import torch.nn as nn class Identity(nn.Module): def forward(self, x): return x class LinearWithLoRA(nn.Module): """ Wraps an existing nn.Linear-like module and adds a LoRA branch. The wrapped base module is stored as `base`, and its parameters are left as-is (y...
a57cac7e595e806885da11ae6952b3649b7bc7c51045f146af2fe6863786563e
Python
4,926
116
import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches # from tqdm.notebook import tqdm def draw_pie(dist, xpos, ypos, size, colors, ax): cumsum = np.cumsum(dist) cumsum = cumsum/ cumsum[-1] pie = [0] + cumsum.tolist() i = 0 for r1, r2 in zip(pie[:-1], pie[1:]): ...
c98b4b57069ef9966764991b197bfd5a7f589ba61d3fd813c8bce72ad4f96ddf
Python
4,927
132
"""Tests for the linked optimization-step explorer.""" import json import re import pytest from ui import opt_explorer @pytest.fixture() def traj_path(tmp_path): """Write a short EMT optimization trajectory of a Cu dimer.""" from ase import Atoms from ase.calculators.emt import EMT from ase.optimiz...
7440fb1ea7d45139670172f52b0d648934bdf9cdbc3238d08144cd76904b09e2
Python
4,928
120
"""ROI footprints as a registration signal. The obvious way to align two recordings is to correlate their mean images, and on this data it does not work: every ``ops_fields.npz`` mean image carries the same vertical scan-line texture, and it dominates the pixel variance. Unrelated cultures correlate at 0.87; an image ...
6f26d321c3b6ca73dc3970a12b6442c77a2618d09939e975d2f14175466d118e
Python
4,929
125
#!/usr/bin/env python ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the gradunwarp package for the # copyright and license terms. # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## import argparse as arg impor...
cd28a58de4081bc6955c32fd268c2fe962729df8922eddb0dbd5f3512bb9f422
Python
4,930
156
r"""Utility package.""" import copy from ._scatter import scatter, group_argsort, group_cat from ._segment import segment from ._index_sort import index_sort from .functions import cumsum from ._degree import degree from ._softmax import softmax from ._lexsort import lexsort from ._sort_edge_index import sort_edge_in...
fe98702b12b2299db9db6e1547feeea4b59a6867a05fabb079f29f45b57bbad6
Python
4,930
88
import pytest from tests.utils import pytest_importorskip def test_qtdatavisualization(): """Test the qtpy.QtDataVisualization namespace""" # Using import skip here since with Python 3 you need to install another package # besides the base `PyQt5` or `PySide2`. # For example in the case of `PyQt5` yo...
d4c73668965496cee4ba9a6c651d553bc92612bf7be20120e6dbeb7e6362c99f
Python
4,931
158
#!/usr/bin/env python """ FIXME! usage: %prog feature.bed ar.bed snp.bed div_directory [options] -m, --mask=M: Mask AR and features with this file -s, --suffix=S: append suffix to chromosomes to get filenames from div_directory -l, --lens=l: Set chromosome ends using LEN file """ import sys from bx.bits...
36a92a40deef44f8e676056dbaca10585fa302d29e401eeb92834123520cdad1
Python
4,933
146
# -*- coding: utf-8 -*- """ Created on Thu Apr 2 13:15:59 2015 @author: ajaver """ import os import re import warnings import subprocess as sp import numpy as np from tierpsy.helper.misc import FFMPEG_CMD, ReadEnqueue class ReadVideoFFMPEG: ''' Read video frame using ffmpeg. Assumes 8bits gray video. ...
c0cf61799992b6b3d25bb7a8f6a5aeb0a748fe55640e42e575af082c1a82d9cf
Python
4,933
124
from typing import Callable, Dict, List, Optional, Tuple, Union import torch from torch_geometric.distributed import ( DistContext, DistLoader, DistNeighborSampler, LocalFeatureStore, LocalGraphStore, ) from torch_geometric.loader import LinkLoader from torch_geometric.sampler.base import Negative...
560980189c50048b7e3ad9356bed7cb69b64a025d224efeb1ef9601db1e7247b
Python
4,935
135
""" Originally vgm_MakeTrigInfoFlex.m by Vikram Gadagkar Ported to python by Ruidong Chen This function creates time-aligned spike counts for each trial. """ import numpy as np def _inrange(x, center, width, binsize): if x < center - width: return False if x > center + width + binsize: return...
ec1f0d039d4a74310e5de8297c80a81149beacc172b603d9441ada48f3f26035
Python
4,936
110
import matplotlib.pyplot as plt import pygpc import numpy as np import os import h5py import matplotlib import pathlib matplotlib.use("Qt5Agg") from helper_functions import __file__ MODULE_BASE = pathlib.Path(__file__).parent.parent if __name__ == '__main__': SAVE = False # load time axis fn_data = str(MO...
4430b27bf8b74e73f7c8bddb312b599314bc4009d0abf95445257d6c3502eaa0
Python
4,937
147
''' NH3OH ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for NH3OH: P: potential energy, G: Gradient, D: Nonadiabatic coupling vector This is listed at the end of description to show the availability. For example: P/G means both potential energy a...
9d499d0cae79f27133e77ae330a7925a0ce51b633947b59900c7792d2c209443
Python
4,937
134
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 ...
d1414ac7ab011a49a10685b47c721d3525dad3ccf0c95b4c6dbe50d141fc1e8b
Python
4,937
126
from collections.abc import Sequence from dataclasses import dataclass from typing import Literal @dataclass class ImageOutputTypeConfig: """ :param adaptive_normalization_max_samples: If using adaptive normalization (channel / element), how many samples to use to compute the normalization par...
ed786516789b9d916d2d5c8782dff2bf27ceb131133b40550d6a9906e65ad94d
Python
4,937
126
from collections.abc import Sequence from dataclasses import dataclass from typing import Literal @dataclass class ImageOutputTypeConfig: """ :param adaptive_normalization_max_samples: If using adaptive normalization (channel / element), how many samples to use to compute the normalization par...
f75f6023bf6384c76c494952036fbfd5747fa239734205561f0fce3101f8a1f1
Python
4,937
122
############################################################################# ### Recursively moves through directories and extracts parameters and the ### ### mean weights across neuronal subpopulations ### ############################################################################# ### Cop...
6cfba57021a586417c24f3090b0002dad328c30e3001d2c0357a3040daf7eaf0
Python
4,940
148
import numpy as np import pandas as pd import scanpy as sc from tqdm import tqdm import leidenalg as la import igraph as ig try: from scipy.sparse import coo_array except ImportError: # google colab compatibility from scipy.sparse import coo_matrix as coo_array from scipy.spatial import KDTree def segmen...
934dd6c753c9c0c0313f5dd108135d47a11a9c17a8c9ad191a9ac3599d5e2681
Python
4,940
159
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 ''' Calculator for the atomic simulation environment (ASE) that evaluates energies and forces using a neural network ''' class KerNNCa...
06156ccc68094b2ee9d058f0d18d744cd1aad91491ba2bcb3d6dd8b67e8d8e3f
Python
4,942
140
import torch import torch.nn as nn import numpy as np from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file, sha1_hash from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from...
0ecf8aeef6f033ab3c161b13b7564c5a83d833662b40e728c9a82f85823cb8e4
Python
4,942
207
"""[ma_task data utilities] """ import os import glob import re import json import numpy as np from PIL import Image from .utils import reorder_rdm __all__ = [ "meadows_subjects", "load_json_data", "get_matask_stim", "get_stim_ids", "get_matask", "get_dragrate"] def meadows_subjects(subj): ...
1d8af43d7c42a564e85808724d7bfb16078f264086c50425bcd140cbe65238f3
Python
4,942
101
from nipype.interfaces import fsl from PUMI.engine import AnatPipeline, NestedNode as Node, QcPipeline from PUMI.pipelines.multimodal.image_manipulation import pick_volume, vol2png @QcPipeline(inputspec_fields=['registered_func', 'func_2'], outputspec_fields=['out_file']) def qc(wf, registered_func_volume...
1dc41ac373c28d9a8f489417ad5e7b6bb666bc57fef0212c9baa1edd64f22acf
Python
4,942
140
import torch import torch.nn as nn import numpy as np from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file, sha1_hash from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from...
21b064a2325e685434f61d13e29e4f2349feb3d209baa2610528df47383ca0e6
Python
4,942
140
import torch import torch.nn as nn import numpy as np from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file, sha1_hash from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from...
3f3f51d7446779cb0bb9c901f58fef7c445c84c3ce08e0700a35258c91f6ad4a
Python
4,942
140
import torch import torch.nn as nn import numpy as np from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file, sha1_hash from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from...
786369d6ae03dede6063a30c3cf4834df309d37c348bc14e995b5335144806fc
Python
4,942
113
import numpy as np from sklearn.linear_model import TheilSenRegressor from scipy import signal def compute_quantal_size(scan): """ Estimate the unit change in calcium response corresponding to a unit change in pixel intensity (dubbed quantal size, lower is better). Assumes images are stationary from one ...
7f818a7f21a0bcffc2f3425e22f26088bf802abaac21f2106a64e2ff3712afe5
Python
4,942
140
import torch import torch.nn as nn import numpy as np from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file, sha1_hash from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from...
8267fbe09dc526424d58e4537de21893538e40c6eb24076f66acdaa60e2d2e86
Python
4,942
140
import torch import torch.nn as nn import numpy as np from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file, sha1_hash from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from...
a4558361f0f20fc9979c584d2814dff0cfae466ac91964dbf3d4746ee721a7ea
Python
4,942
140
import torch import torch.nn as nn import numpy as np from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file, sha1_hash from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from...
b2443a14e6664495d8da2423fae88e3140cb838d1df63674f22db32f655fb873
Python
4,942
140
import torch import torch.nn as nn import numpy as np from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file, sha1_hash from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from...
b5d92647cfb4ce0d540ccccfd3317cddc9eeac5ded5f58a883cdca7610b5740b
Python
4,942
140
import torch import torch.nn as nn import numpy as np from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file, sha1_hash from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from...
f966b22a040f2e990f28369799acf75ecd8079f0b1a7c2a905dc7600ab5cef5e
Python
4,942
140
import torch import torch.nn as nn import numpy as np from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file, sha1_hash from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from...
a21613eced0a68ed3cbb1401362dcf9d92cfbd530177995a358576a5a2d579d9
Python
4,945
166
# ----------------------------------------------------------------------------- # Copyright © 2009- The QtPy Contributors # # Released under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------------- """Provide a CLI to allow configuring...
39b427e9dba6d32c0d8320f2842878d82a4e40d9a20c030e68e36c82c94cad9f
Python
4,946
156
#!/usr/bin/python # -*- coding: latin-1 -*- # ============================================================================================= # Librairies importation import numpy as np import nrrd import sys import os from voxcell import RegionMap # ==================================================================...
06a08b4f504819f5d159c8d9269cba1dbcd13cfd5b82d0995a85027b307790e7
Python
4,947
147
import numpy as np def compute_log_idx(bins_per_step: int, idx_max: int) -> np.ndarray: """ Compute the indices at which to resample data to get "log" spacing of values from a linear sampling with increment = 1. Returns an array of indices where the spacing between values doubles every bins_per_s...
25d7c280a679e05ffa6bf1321cbcbd23e44d6a0515044a84bbcd8bf7003f8ba0
Python
4,947
154
import numpy as np import scipy.ndimage from . import _perlin XYSCALEBASE = 100 def filter_frames(im, filt, *args, frame_start=0): """Apply a filter/transformation to an image batch Parameters ---------- im : 3D float ndarray, values ∈ [0,1] Frames to filter filt : str The name of...
676bf6f3999bcbd3b8529c39bfdd6d356c4ccdc9735dbb6c0013798834c13c42
Python
4,947
162
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
620e027fb86cf9b560ab91e0977747d1708a1294507000cbdcdd6e1399f2da06
Python
4,948
153
import logging from pathlib import Path import click import pandas as pd from pandas import ExcelWriter from tqdm import tqdm from brainways.project.brainways_subject import BrainwaysSubject from brainways.utils._imports import NAPARI_AVAILABLE from brainways.utils.cells import get_cell_struct_ids, get_struct_colors ...
3af957e8fecef35dceab2ed1f5b7adc432cb0d730c2c467c7e40968f9968cc70
Python
4,950
172
""" Test the sensitivity of nest results on input parameters """ import numpy as np import scanpy as sc import pandas as pd import os import matplotlib.pyplot as plt import random import seaborn as sns import nest from anndata import AnnData from typing import Optional, Tuple from numpy.typing import ArrayLike from...
01a705093fe349ab5c0225dbd13bf83b84c232667e01d359816402ce120205e3
Python
4,951
142
import numpy as np import scipy import scipy.signal import scipy.ndimage as ndimage def plot_C(ConSink): plt.close('all') fig = plt.figure(figsize=(7, 7)) ax = fig.add_subplot() ax.imshow(ConSink, cmap='jet') ax.get_xaxis().set_ticks([]) ax.get_yaxis().set_ticks([]) ax.get_xaxis().set_ticks...