sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
242cb45910bc8b06b9e0cc5b139ccb86eb7b80e153f5aea5804a7ef8998bfa1b
Python
10,259
315
import glob import os import socketserver import threading import tempfile from urllib.parse import urlparse from typing import Dict, Tuple from cloudvolume import CloudVolume from cloudvolume.server import ViewerServerHandler import napari from napari import Viewer import fastremap import numpy as np import neurogl...
0fae0ee8dc33881a61b5d1bdb749be66e2945b2c56b73980d839e508eacf6653
Python
10,260
251
import collections from typing import ClassVar, NamedTuple, Literal import numpy as np import polars as pl from rscvp.util.cli import SelectionOptions, CodeAlias, HEADER, get_headers_from_code from scipy.stats import zscore from typing_extensions import Self from argclz import argument from neuralib.typing import fla...
9f0984cface875a3365ec6f60524b1eac28b7a3003e2df5a206599d3a46fb96c
Python
10,260
238
import os import pandas as pd import json import nibabel as nib import numpy as np import re import glob from nipype import Node, Workflow, MapNode from nipype.interfaces.utility import IdentityInterface, Merge, Function from cvdproc.pipelines.dmri.lqt.lqt_nipype import LQT from cvdproc.bids_data.rename_bids_file imp...
eadbced952cd6e229d6833551d5dca2d3d0beaf814a6893088b5efb264aebb68
Python
10,260
189
import pygame import time import re import numpy as np ############################## # training ############################## def practice(screen_width, screen_height, window, application_path, stimuli_width, stimuli_height, give_a_fixed_time_interval, from_xy_to_position, position_x_list, position_y_...
a61f29e810e929b172f2e9be2e11e54ab49e432bfa2f452ad3406a3abfc0fcf2
Python
10,261
281
import os import shutil def importElastix(): # Import Elastix import sys, os sys.path.insert(0, '/home/acorver/ClearMap2/') _cwd = os.getcwd() os.chdir('/home/acorver/ClearMap2/') from ClearMap.Environment import elx, res, p3d os.chdir(_cwd) # Return modules return elx...
e95969575bdbcff5855b55d02f4eb930004319deec4c1d98f86ee2178237f9dc
Python
10,262
254
""" MSI Delocalization Scoring Pipeline ──────────────────────────────────── Quantifies lipid delocalization from tissue into the background region using spatial metrics (mean distance, nonzero area). Workflow: 1. Load overlaid h5ad (with tissue mask from the annotation tool) 2. TIC-normalise intensities 3. Remo...
f423a4d6c7ed28eedc2add0eec2f52c7b7383dcf837a4705684911b6bd375aaf
Python
10,269
254
from brainscore_core.supported_data_standards.brainio.assemblies import PropertyAssembly from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set from brainscore_core.supported_data_standards.brainio.s3 import load_assembly_from_s3, load_stimulus_set_from_s3 BIBTEX = """@article{malania2...
0ed59fd38ece28fb546ba1d64d3ba71a8feb353bb3a17c98ea1ea59a4dde9835
Python
10,270
225
import pandas as pd import shutil, os import os.path as osp import torch import numpy as np from dgl.data.utils import load_graphs, save_graphs, Subset import dgl from ogb.utils.url import decide_download, download_url, extract_zip from ogb.io.read_graph_dgl import read_graph_dgl, read_heterograph_dgl from ogb.io.read_...
a60f060099b1340273060a989e2d68c5740036339de81b73b4710f5968bc8b98
Python
10,273
327
''' Models used across multiple scripts. ''' import sys, time import numpy as np import rsa from typing import Any, Union, Callable class InformationTheoretic: ''' Placeholder class to obtain IT measures through inheritance. ''' def __init__(self) -> None: ''' Never used. ...
0d06581c319bbaaea7c6c748e0de02a403ce413681606444e886097235216184
Python
10,276
218
import warnings warnings.filterwarnings("ignore", message="It is not recommended to directly access") import os import argparse import numpy as np import pandas as pd import torch import torch.nn as nn import torch.optim as optim from torch_geometric.data import DataLoader from model import HimNet from dataset import s...
0c7aa01177d5996c8f69e34ba2debfb20a10c174aa2e4de84ee5e2060625c81a
Python
10,282
280
import torch import torch.nn as nn import torch.nn.functional as F from torchvision import models from torch.nn import Module, Conv2d, Parameter, Softmax from collections import OrderedDict def conv3otherRelu(in_planes, out_planes, kernel_size=None, stride=None, padding=None): # 3x3 convolution with padding and r...
c21010972895d5b48d640d248a82a9a9d9512072225e3f53bbe222c094b7dcbd
Python
10,283
259
import os import pandas as pd import numpy as np import torch import librosa import librosa.display import matplotlib.pyplot as plt from torch.utils.data import Dataset from torchvision import transforms import sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from da...
7e6bb833372e104199234cfa13b3ee20995a9196b37a14e9d8c18e39a926bfaf
Python
10,285
235
import os from typing import List import pandas as pd # Variant-level SNV TSV file name, which is used for implementing the following # known column display order change: # - Move Variant_ID_hg38 and Protein_change columns after the # Gene_symbol column VARIANT_SNV_FN = "variant-level-snv-consensus-annotated-mut-fr...
7adac492c22620f8e8eb7d86c8803d43056ba320572d6f9f53d8d9fbbfb6739f
Python
10,290
259
import os import h5py import yaml import sys import numpy as np from copy import deepcopy trans_fac = 1.5 #stds from mean applied on #(transients) to include/exclude transients ditch_lonely_offperiods = False maxdist_lonelies = 2. ww_smooth_trans_s = 0.1 thr2_perc = 50 #to detect network transient bursts, percentage...
5d9233472f1003ec59580b6c16a2187d97a44c13b3d665ecd8f1f74d8d0942b5
Python
10,292
261
""" This is a demo function for very basic grid search style parameter selction. By default a 3 X 3 X 3 paramater space is searched and the Sprod performance is prioritized based on the qualities of the constructed latent graph. Parameter sets that preserve the overall spot physical struction and image similarity bett...
79aa828a655fc7253b05dd7f04b0620c791d081c4c747159d86d5e038fe209fc
Python
10,292
321
""" Validation and test data generation script with 1000M photons (10x regular photon count). This script generates validation and test datasets with increased photon counts for more accurate Monte Carlo simulations. It supports both physiological and physical parameter types and can be run on cluster environments. "...
cda68c70b74ee05db278c83d409614c68709fe73d2028d8a680f657ab2e13e0f
Python
10,300
271
import os import time import copy import argparse import torch import torchvision from torchvision import datasets, transforms, models from torch.utils.data import DataLoader, random_split, Dataset import matplotlib.pyplot as plt import seaborn as sns from tensorboardX import SummaryWriter import numpy as np from torch...
8ffe7214a598210e78022a83df82a643a38521ad066885857ccc5a0ad518c94d
Python
10,301
204
import os import random import argparse import numpy as np import os.path as op import torch from torchinfo import summary import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from sklearn.model_selection import StratifiedKFold from sklearn.utils.class_weight import compute_class_w...
8cdb15af2b57699d368c98019088f6d0d84acfa5fb7077b61b2ddcbacb809372
Python
10,303
276
""" foundcog_glm.py — Subject-level GLM pipeline for the FOUNDCOG dataset (pictures task). This script builds and runs a NiPype workflow that fits a General Linear Model for each subject/session/run in the BIDS dataset. For each run it: 1. Resolves file paths (functional image, events, motion parameters) 2. Builds...
1a80117866ad443c9b18f30d6ae140bb5e2c76f5e0370dc2b3d065f4dd7a2bb3
Python
10,306
221
import os import numpy as np import skimage.io as io import glob from natsort import natsorted import json import tqdm from helper import reading_data import shutil def extract_cubes_for_hyperparams_search(im_stack, cube_dict, save_dir, padding=32): im = im_stack max_z, max_y, max_x = im.shape save_path = ...
40a641855cdea49b34514ef2bf70e48c9da14480e50c5bb7d8afd91b495677bf
Python
10,306
176
"""Validate manifest structure and reconstructed OpenPlant output against it.""" from __future__ import annotations import argparse import json import os import sys from collections import Counter from pathlib import Path from PIL import Image from .rebuild import IMAGE_EXTENSIONS, atomic_write, manifest_statistics,...
addc14171c71a8b8d72be8b2d4bd6c5e2c1237001fa9396f1cb6aa559fa3c02b
Python
10,315
251
import inspect import warnings from typing import Any, Callable, Dict, Final, List, Optional, Union import torch import torch.nn.functional as F from torch import Tensor from torch.nn import Identity from torch_geometric.nn.dense.linear import Linear from torch_geometric.nn.resolver import ( activation_resolver, ...
4295d9574827f1bd03847d2fed2b29f507bcf68301d58a92ca3f3014268bec04
Python
10,316
250
import os from copy import deepcopy from typing import Optional, Union, Dict import torch_geometric.utils from omegaconf import OmegaConf, open_dict import pytorch_lightning as pl from overrides import overrides from pytorch_lightning.utilities import rank_zero_only from torch_geometric.utils import to_dense_adj, to_de...
ca7ed5d03b86719341b46fc199c63b7576e6dcaa2e95183200821000bc61b6be
Python
10,316
206
# add the path of custom functions import sys from pathlib import Path import os script_dir = Path(__file__).parent project_root = script_dir while not (project_root / 'Deps').exists() and project_root.parent != project_root: project_root = project_root.parent # Add project root to the Python path if it's not alre...
0c753fa2096d1881105df336953923a6be85e199cd974c40e7fbaf4a94449da7
Python
10,320
232
from __future__ import annotations import torch from torch import Tensor, nn from torch.nn import functional as F class CNN(nn.Module): def __init__(self, features: nn.Module, readout: nn.Module): super().__init__() self.features = features self.readout = readout def forward(self, in...
5b31a3ba92aed44a3f4af706325c37ea7e074e4a01bbca7c7c88106ecff40e79
Python
10,323
356
############################################################################### #################### Boilerplate ######################## ############################################################################### import pandas as pd import matplotlib.pyplot as plt import os import matplotlib...
3765a10b379e94c73b181a25ea128b1aa760d0f6f14550f01b2994a5beaac741
Python
10,324
283
""" Image to Patch Embedding using Conv2d A convolution based approach to patchifying a 2D image w/ embedding projection. Based on code in: * https://github.com/google-research/vision_transformer * https://github.com/google-research/big_vision/tree/main/big_vision Hacked together by / Copyright 2020 Ross Wightma...
8c60cda8c54784631ee77e09d72e7ff8681162c04a18d5f9e53d5c9c319a10ab
Python
10,329
291
from __future__ import annotations from dataclasses import replace from typing import TYPE_CHECKING, Any, Callable import napari.layers import numpy as np from PyQt5.QtWidgets import QApplication from brainways.pipeline.brainways_params import AtlasRegistrationParams, BrainwaysParams from brainways.ui.controllers.ba...
c702fa823f93191739400c4bd709806d4bdf04311b9d79a73e9f14462c66841d
Python
10,330
267
''' Quick script to aggregate results from increasing k analysis in encoders. All options supported by `subject_rsa_enc.py` are also available here, of course. NOTE: The output report created by this script isn't necessarily going to include the prettiest figures; it's mostly to get a quick overview & to get all the ...
6550e9d1bf1f4cd79290224fb54692134fad840856dabe4901a667bb78cd26eb
Python
10,332
249
''' Quick script to collect data from rERP models in learning task and perform statistical inference. All options supported by `subject_rerp_mt1.py` are also available here, of course. NOTE: The output report created by this script isn't necessarily going to include the prettiest figures; it's mostly to get a quick o...
b11460289a2808a79becdd65fba5d11947935843542f5a987e2c273c63114427
Python
10,334
255
""" DMC-BrainMap widget for padding .tif files to match atlas resolution. 2024 - FJ """ from qtpy.QtCore import Signal from qtpy.QtWidgets import QPushButton, QWidget, QVBoxLayout, QMessageBox, QProgressBar from napari import Viewer from napari.qt.threading import thread_worker from napari.utils.notificatio...
093522bd65f58272826c6e3b3bee8f8c4b992b168493e2cd6d7f8be76c617225
Python
10,342
248
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Script to compute Multishell Multi-tissue Constrained Spherical Deconvolution ODFs. By default, will output all possible files, using default names. Specific names can be specified using the file flags specified in the "File flags" section. If --not_all is set, only ...
d01bad6cd46910c7979a09c96e49526ecfadbf574c832527cc1af67d39b6885d
Python
10,342
250
import sys import numpy as np import yaml import os import matplotlib as mpl from matplotlib import pyplot as plt pathpath = 'PATHS/filepaths_carlen.yml' fformat = 'svg' with open(pathpath, 'r') as myfile: pathdict = yaml.safe_load(myfile) sys.path.append(os.path.join(pathdict['code']['workspace'],'pfcmap','python',...
139bf749402ff56ada5d7f8a61d95e31b55bf83433448adaa6afb1e605368d60
Python
10,344
297
from argparse import Namespace from pathlib import Path from typing import TYPE_CHECKING import numpy as np import pandas as pd import torch from eir.setup.output_setup_modules.survival_output_setup import ( ComputedSurvivalOutputInfo, ) from eir.setup.schemas import SurvivalOutputTypeConfig from eir.train_utils....
e819e5026b53f330566292d3537b09421699ac2a22d0a1c6f623d6e30e63dabc
Python
10,359
210
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
f0656d1073a5cc6d2c387c04b0e5ad454ccea2cb7e31caf21ee2233aa19a55bc
Python
10,361
216
import argparse from os.path import join import pickle import keras from keras.optimizers import Adam from keras.callbacks import EarlyStopping, ReduceLROnPlateau import utils import h5py from model_zoo import DeepSTARR import pandas as pd import wandb from wandb.integration.keras import WandbMetricsLogger import yaml ...
1f1ad5872f942f90902ee2fd5c20c06d248a29d218e91d0822674ac7c00b1cec
Python
10,363
278
""" This module implements a Residual Network Author: Burhaneddin Yaman Zhengguo Tan <zhengguo.tan@gmail.com> """ import torch import torch.nn as nn from typing import Tuple, Union # %% class ComplexBatchNorm2d(nn.Module): def __init__(self, num_features): super().__init__() self.real_bn...
811cc62fd9edccbbe40cc3bb0dc897a6c2e1edba733bdbdd3db886b6f1df58b1
Python
10,363
239
"""Backend-agnostic, lazily configured single-component gRASPA-SYCL MCP server.""" import asyncio import math from pathlib import Path, PurePath, PurePosixPath, PureWindowsPath import uuid from chemgraph.execution.base import TaskSpec from chemgraph.mcp.cg_fastmcp import CGFastMCP from chemgraph.schemas.graspa_schema...
0b884f5214cc88f22657b28a3deb69b7ab33974b107796c4f8a3d2592d0e5c29
Python
10,370
341
##################################################################################################### ### Utility functions for different purposes, mainly regarding the processing of simulation data. ### ##################################################################################################### ### Copyright...
8fe40dae2a270c3813a3bbdd3208be4d581a7b3d317728b932eb4fb7b8172fbc
Python
10,370
329
# -*- coding: utf-8 -*- """ Created on Thu Mar 26 17:12:40 2020 Collection of functions for dealing with two-photon recordings and suite2p outputs. @author: Samuel Failor """ from os.path import join import numpy as np from . import timelinepy as tl from . import cortex_lab_utils as clu import scipy.io as sio def...
93324c6f04e5b0a51efbf89412c3077e020b98ea10915ed4d8fb7e8b6bf5ac57
Python
10,370
202
import os import re import zipfile from glob import glob import brainscore_vision import h5py import numpy as np import pandas as pd import xarray as xr from brainscore_vision.knownfile import KnownFile as kf from brainscore_vision.lookup import pwdb from brainscore_vision.assemblies import AssemblyModel, AssemblySto...
8db24a608c065953cada5af2e29964054049c17d7742604612902269d327196c
Python
10,372
302
import os from types import SimpleNamespace os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") import pytest from magicgui.widgets import FunctionGui from qtpy.QtWidgets import QApplication from napari_dmc_brainmap.padding import padding from napari_dmc_brainmap.params import params from napari_dmc_brainmap.prepr...
ccfb25d2d4fd2124962b5c4fd4a2a97b566351aae1481ef7e964edab07260c8a
Python
10,372
258
import logging from typing import Optional, Union import torch from torch import Tensor from torch.nn import ReLU, Sequential from torch_geometric.explain import Explanation from torch_geometric.explain.algorithm import ExplainerAlgorithm from torch_geometric.explain.algorithm.utils import clear_masks, set_masks from...
79befcdbd1ca2f9f94cf92281818f761be2bd26a2ef91a126200af5b57170a74
Python
10,382
335
"""Main score_dm extension for predefined diabetes PRS.""" import argparse import logging import os import sys import pandas as pd from .grouped_scoring import score_grouped from .hla_int_grs import score_int_hla from .SQL.get_dm_sql import get_dm_sql, get_dm_meta from ..core.score_bcf import score_bcf from ..core.ut...
cc7c21105113834a47d66acedba2d7fe4a9faf015d8fd2b9d71685547ef16af1
Python
10,385
345
"""CLI entry point for ChemGraph evaluation benchmarks. Usage:: # Quick local evaluation using a profile chemgraph eval --profile quick --models gpt-4o-mini --judge-model gpt-4o # Standard evaluation with LLM judge chemgraph eval --profile standard --models gpt-4o-mini gemini-2.5-flash # Explici...
497d86d0e07e3345d12c3dd05a8b844943ad593caf1330756604219887e130b1
Python
10,391
196
import mat73 import argparse import numpy as np import cebra from pathlib import Path from choice_mode_functions.combine_all_trials_all_brain_regions import dataset_all_sessions, choice_sampled_population, ablate_all_regions_except_one from choice_mode_functions.split_dataset import split_train_test_data from choice_mo...
6535db7d58ce01a5757729c3f060e79d0e83b1c08e5aab2cb900b00daca1437f
Python
10,391
311
""" This script computes three dimensions from neural activity: switch evidence, actor outcome, and observer outcome, using TDR Based on these dimensions angles between these are computed. Each calculation is repeated resulting in a distribution of angles. """ import sys import os sys.path.insert(0, os.path.dirname(o...
4842381ff9de7b7fd3b09554f36a908b8b3f3c24dee0b70f0201594e08c6f623
Python
10,397
197
import nipype.interfaces.afni as afni import nipype.interfaces.fsl as fsl import nipype.interfaces.ants as ants from PUMI.engine import NestedNode as Node from PUMI.pipelines.anat.anat2mni import anat2mni_fsl, anat2mni_ants_hardcoded, anat2mni_ants from PUMI.pipelines.multimodal.masks import create_ventricle_mask, resa...
d241f1e09a080582fd37ec99e50410cbabfb101a77ee11ef1d384f5e5808bb4d
Python
10,397
283
import gc import os import torch import tqdm from scipy.stats import spearmanr from sklearn.metrics import r2_score from torch.optim.lr_scheduler import MultiStepLR from SWOW_prediction.data_preprocessing import construct_property_dataset from SWOW_prediction.evaluation import evaluate from SWOW_prediction.models imp...
29cbc76c2d3a8ea039ea94f36652a3a4bed4e067a7a10950717fb93b3d3f3e43
Python
10,398
231
import argparse from os.path import join import pickle import keras from keras.optimizers import Adam from keras.callbacks import EarlyStopping, ReduceLROnPlateau import utils from model_zoo import DeepSTARR import plotting import pandas as pd import wandb from wandb.integration.keras import WandbMetricsLogger import y...
43fbdff65149c30e502fe07d13fd2b072f70a7ca8cf122bb8eb9832de7e404b8
Python
10,399
302
#!/usr/bin/env python3 """ ============================================================================= Austin Dibble University of Glasgow 2026 neurofm/inference.py Core inference logic. The NeuroFM class is the primary user-facing API. ============================================================================= "...
0f64c87c000986b561f28ef2db856766df23385cdbcf0f707be64e1dd4f1b903
Python
10,404
283
import os from sklearn import preprocessing as pp import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.stats import pearsonr from sklearn.metrics import mean_squared_error from math import sqrt import scanpy as sc import torch import torch.nn as nn from torch.backends import cudnn import ra...
9041cffaacb6168d6c298d40a286e49d30730694fcc2723449e86c1604304f4b
Python
10,407
282
import math import typing from typing import Optional, Tuple, Union import torch import torch.nn.functional as F from torch import Tensor from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.dense.linear import Linear from torch_geometric.typing import ( Adj, NoneType, OptTensor, ...
697a596a8f2a0c15cf86cf243e242267097b5f398b506722330f8a2cc7118636
Python
10,413
296
#!/usr/bin/env python # Copyright (c) 2015 Tobias Neumann, Philipp Rescheneder. # # This file is part of Slamdunk. # # Slamdunk is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the #...
5eafdc8f1a9395372cb9bdb1313c25a9d174177c478fc1700be263231d5b0ca4
Python
10,417
329
# -*- coding: utf-8 -*- """ Zebrafish ANATOMICAL ONTOLOGY """ import obonet import numpy as np import os import networkx as nx import matplotlib.pyplot as plt import pandas as pd import matplotlib as mpl from scipy.cluster.hierarchy import dendrogram from matplotlib import cm from sklearn.decompositi...
f94eb6c86195bc0ee696b9b2f1f18b6810eedbb39e511bd6ec969716a67c0530
Python
10,420
273
"""Electrodermal activity features from the UL-DD EDA channel (Empatica E4, 4 Hz). Tonic/phasic separation uses cvxEDA (Greco et al., IEEE TBME 63(4):797-804, 2016) when cvxopt is installed, and falls back to a zero-phase Butterworth split otherwise. Both paths are exposed so the choice can be reported in the paper. "...
fe23bf88b0cd1fbba6b033e9cc683cc5fa690454495bb0b1c1bd630c75fad9a5
Python
10,425
296
import argparse import torch import torch.nn.functional as F from torch.utils.data import DataLoader import torch_geometric.transforms as T from torch_geometric.nn import GCNConv, SAGEConv from ogb.linkproppred import PygLinkPropPredDataset, Evaluator from logger import Logger class GCN(torch.nn.Module): def ...
43bcb8bf4799269f5229f4504291cc165c62ca409507aaf6b3095d3eada9e23d
Python
10,429
321
import torch import torch.nn as nn from einops import rearrange from einops.layers.torch import Rearrange def conv_3x3_bn(inp, oup, image_size, downsample=False): stride = 1 if downsample == False else 2 return nn.Sequential( nn.Conv2d(inp, oup, 3, stride, 1, bias=False), nn.BatchNorm2d(oup),...
6ba7ac0f092de446b38c9b65df20b20dadfd8722afc78c2318c02f28b231f81e
Python
10,431
181
from PyQt5.QtWidgets import QLabel,QGraphicsScene,QFrame, QGraphicsItemGroup, QGraphicsPixmapItem, QGraphicsEllipseItem from PyQt5.QtGui import QColor, QPen from PyQt5.QtCore import Qt from napari_dmc_brainmap.registration.sharpy_track.sharpy_track.view.QGraphicsViewerMT import QGraphicsViewMT from napari_dmc_brainmap....
aa6199b1f385b9b205280ee5350d098c8be6e214154a1788f457400d97eed916
Python
10,439
272
""" lasagna plugin for exploring the Allen Brain Atlas: 1. Display of average template brain. 2. Reporting of brain area name more stuff... Rob Campbell """ import os from PyQt5 import QtGui, QtCore # For the UI from lasagna.plugins.ara import ara_explorer_UI # For contour drawing from lasagna.plugins.ara.ara_pl...
1e0a6b1920bb5bf7b3262fc8d1d7bb7efc6bf155a4827b29d14689b8ff1facdf
Python
10,440
330
import numpy as np import pytest from brainscore_vision import load_stimulus_set, load_dataset from brainscore_vision.benchmarks.geirhos2021.benchmark import DATASETS def test_count(): assert len(DATASETS) == 12 + 5 @pytest.mark.parametrize('assembly_identifier', [ pytest.param('Geirhos2021_colour', marks=...
0360da7688c3381855acd898a438d446af2d864f5d37099fd5cad60cde1834cb
Python
10,444
223
import os from collections import defaultdict import pandas as pd import numpy as np import scipy as sp from matplotlib import pyplot as plt import matplotlib as mpl from .utils import neighbors as nb from .utils import stat, vis, util, io def vis_single_edge_stat_traces(edge_trace_stat): """ Input: ...
73bdd48130cd75e43665f1cdb298ebe71c614d3ca7b6553a48381d59f5e8c4b7
Python
10,454
205
import nighres import os import nibabel import numpy import glob inpath = '/home/pilou/Projects/Cerebellum/Cerebellar-segmentation-ABC/' prev_sfx = 'nighres/denoise/' out_sfx = 'nighres/coreg/' t1map_sfx = '_anat_inv1_s2c10_lcpca-den_qt1map-t1.nii.gz' t1w_sfx = '_anat_inv1_s2c10_lcpca-den_qt1map-uni.nii.gz' t1ref_sf...
9b9e758035547497896ddad3271c4ffa9a2d7cd6e0b56d84f93c20e940297e39
Python
10,454
302
from os import mkdir from os.path import exists, join from collections import defaultdict import pylab from sklearn.datasets import fetch_lfw_people from sklearn.impute import IterativeImputer import numpy as np from fancyimpute import ( SimpleFill, IterativeSVD, SoftImpute, BiScaler, KNN ) from ...
ede5d6881fd053f83987940ccf8cfa56dc95862f1a27928c4c2d5b2c42b4ce2c
Python
10,454
223
import logging import os from pathlib import Path import pytorch_lightning as pl import torch.nn as nn from pytorch_lightning.plugins import DDPPlugin from project.datasets.PICP.picp_dgl_data_module import PICPDGLDataModule from project.utils.deepinteract_constants import NODE_COUNT_LIMIT, RESIDUE_COUNT_LIMIT from pr...
a49a4bf0f507d40da38ac963914cd371afdf5cf4879c1126ad062ef755d1a3ad
Python
10,457
299
""" Readers extracting gene (exon and intron) information from bed / gtf / gff formats. - GeneReader: yields exons - CDSReader: yields cds_exons - FeatureReader: yields cds_exons, introns, exons For gff/gtf, the start_codon stop_codon line types are merged with CDSs. """ import sys from bx.bitset_utils import ( ...
e84a9af53129c6c4c3b529943e5f9b880d9d809b8fa7bf4de4417d8d56ce3d0c
Python
10,457
281
""" Module for optimal battery construction Author: Bassel Arafat """ import numpy as np import pandas as pd from numpy.linalg import eigh import torch as pt import PcmPy as pcm def eigenval_crit(G, center=True): """Computes various criteria based on the eigenvalues and mutual information of a matrix G. Assum...
eb74c15c6eb4034a6e954a6117ec9883819564646be42068dd5db529de4081d4
Python
10,457
254
""" Loading Data ============ In this tutorial we demonstrate the various options for loading data. This tutorial covers: 1. The Data Class 2. Getting Example Data 3. Loading Data in NumPy Format 4. Loading Data in MATLAB Format 5. Loading Data in fif Format 6. Loading Data in txt Format """ #%% # The Data class # ^...
95b1c77acf956c1ae7a7483ae432ec1354c2bb13803b4ebc5e554b1f3553db28
Python
10,463
201
# Set CUDA device BEFORE importing torch import os os.environ["CUDA_VISIBLE_DEVICES"] = "7" # add the path of custom functions import sys from pathlib import Path script_dir = Path(__file__).parent project_root = script_dir while not (project_root / 'Deps').exists() and project_root.parent != project_root: project...
12afe24806d5c6b20c65eee52387ccc93fdc765bd585a11d9ff35af4f2456694
Python
10,470
288
import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.data import Data import torch.nn as nn from lib_3d_OT.ottools.utils import log_string from lib_3d_OT.ottools import ot, reconstruction as R from lib_3d_OT.ottools.losses import compute_loss_unsupervised,chamfer_loss from lib_3d_OT.u...
5a3736e153eafe4063854bf216369445fa46d55e8cbd0cc01f6dd3f37b9fedb7
Python
10,470
288
""" AFMmeasurements_timelapse.py Check/Amend the following: - Directory of experimental folder (line 34) - 'App' (approach height) (line 45) - 'StepHeight' (line 52) which is the height in µm which the AFM head is retracted before moving to the next measurement position, where it is extended by StepHeight-2µm - Line...
b4e40ddcb4fbd79b9758a09983c52b0ff7378f0633c695051cefd13e6441941a
Python
10,471
238
"""Test the lag-independent activity metrics on the CAT-NAP path. Run from the repo root:: uv run python python/test_catnap_lag_independent.py ``effRank`` and the NMF fields are read off the *activity* matrix, not off any adjacency matrix, so they live outside ``compute_network_metrics`` — the piece CAT-NAP and ...
0272bcc66f5ccf4707e66ea091ddcabb49268b992360ad252094592a41628359
Python
10,473
272
#%% # so we need a comment? import os from argparse import ArgumentParser import torch from model import BERT_GAT from torch.utils.data import Dataset from torch_geometric.data import Data from torch_geometric.loader import NeighborLoader import pytorch_lightning as pl from pytorch_lightning.callbacks import EarlySt...
4995647941c05996922e5d4f591916d9a9f5440e9120086f15e71848236963db
Python
10,474
260
# -*- coding: utf-8 -*- import os import re import sys def extract_reference_values(ref_pcr_path): values = { 'zero': '', 'bg_coeffs': [], 'scale': '', 'u': '', 'v': '', 'w': '' } try: with open(ref_pcr_path, 'r') as file: lines = f...
29a9e9d48062fb56df3646052f3e2fd90650a5abd6e00f2ca39e02920fb7a475
Python
10,475
284
import torch import torch.nn as nn import torch.nn.functional as F import os, wget from .functions import ReverseLayerF import gdown def init_layer(layer): """Initialize a Linear or Convolutional layer. """ nn.init.xavier_uniform_(layer.weight) if hasattr(layer, 'bias'): if layer.bias is not None...
ea36b5359520aad7cb50b6d293e2639d14612e2f426737467895fb360575231c
Python
10,477
256
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Maximilian Betz # # 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 Li...
ddb4f52a6ba9ce54719ec1804bc01ce6121545078bd697e585578a45d24545df
Python
10,482
206
from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, roc_auc_score from torch_geometric.nn import HGTConv import pytorch_lightning as pl from torch import nn import torch from Dataset import BotDataset from torch.utils.data import DataLoader import argparse from torch.optim.lr_scheduler ...
17e4f5ea321be5fd6425a7960d0b538c0c86b73add69d1bb952e4ea7030ad4b8
Python
10,484
281
from typing import Optional, Union, Dict import os import shutil import os.path as osp import torch import numpy as np from ogb.utils.url import decide_download, download_url, extract_zip, makedirs class WikiKG90MDataset(object): def __init__(self, root: str = 'dataset'): self.original_root = root ...
21c7ab43df8d1f96d282396f3ded8ce7dc69fee689057a7ac0797b4764648b95
Python
10,486
280
from __future__ import annotations import argparse import asyncio import pathlib import signal from typing import Any from academy.handle import Handle from academy.runtime import Runtime from academy.runtime import RuntimeConfig from chemgraph.academy.core.peer_protocol import build_message from chemgraph.academy.r...
b9e3fd2b730e78395c6552d7622038402d9aa796dbb4ea5a57c038769ffe821b
Python
10,489
285
import os import SimpleITK as sitk import numpy as np from PIL import ImageDraw, ImageFont import torch from torch.utils.data.dataset import Dataset from torchvision.transforms import Compose, RandomCrop, ToTensor, ToPILImage, CenterCrop, Resize, InterpolationMode, Normalize import torch.nn.functional as F def is_ni...
10ea951fe2f9555465635e42b2bc4a51a1ad3566f965f5adfe60fe4c9f935b14
Python
10,490
256
''' Quick script to collect data from rERP models in final task and perform statistical inference. All options supported by `subject_rerp_mt2.py` are also available here, of course. NOTE: The output report created by this script isn't necessarily going to include the prettiest figures; it's mostly to get a quick over...
be1cfd1063ee110d8b033546230d89e2a51318ab9c39ea7c91d4c6b434193939
Python
10,492
263
import os import json import pandas as pd from openai import OpenAI import concurrent.futures import time from tqdm import tqdm from prompt import SYSTEM_PROMPT_FINDINGS_CHINESE, SYSTEM_PROMPT_FINDINGS_ENGLISH import argparse ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) removed_case_list = [...
272726d7061b9f263185b4877f59993bcb6cfdf79d7a196b408b7e7fca9c94e5
Python
10,494
270
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This script is intended to score many versions of a same bundle, compared to ONE ground truth / gold standard. All tractograms must be in the same space (aligned to one reference). Our bundle tractometry analysis scripts --------------------------------------- - scil...
5ecbdd9293c208ef0f530646664d3057ae2df665a1e3162ad82a1ead958d0b4c
Python
10,498
284
from qtpy.QtWidgets import ( QApplication, QGroupBox, QHBoxLayout, QVBoxLayout, QLabel, QLineEdit, QPushButton, QSpinBox, QDoubleSpinBox, QCheckBox, QWidget ) from qtpy.QtCore import QThread, Signal import napari from typing import TYPE_CHECKING if TYPE_CHECKING: import napari from ._inpu...
f6842ddc86d1ae1b6b5b3e9fdb1e7247fba63c9d8ac217aecdbe412872fb504f
Python
10,499
293
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 8 12:34:39 2023 @author: rl05 """ import os import os.path as op project = 'fake_diamond' cbu_repo_meg = op.join('/megdata/cbu', project) project_repo = op.join('/imaging/hauk/rl05/', project) bids_root = op.join(project_repo, 'data', 'raw') # d...
67ec6febb2fa8bd6c9928cd1a1f68b978fb7bf994115f621a0cabf3914e568a5
Python
10,500
274
# This file is part of connectome-manipulator. # # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2024 Blue Brain Project/EPFL """Useful converters for circuits data""" import glob import os import subprocess from pathlib import Path import numpy as np import pyarrow as pa import pyarrow.parquet as pq from .. ...
796593b64913ec0ed143c94a097805e556be12534205ee0bc02794bfb639844f
Python
10,500
290
from typing import Any import numpy as np import obspy import torch import torch.nn as nn import seisbench.util as sbu from .eqtransformer import ( EQTransformer, SeqSelfAttention, Decoder, Encoder, ResCNNStack, Transformer, ActivationLSTMCell, CustomLSTM, ) class EQTP(EQTransformer)...
9a2da484c7502284ec819b6bc6c588fc9ad93b43925ca84494abb7ed2c535e04
Python
10,500
283
""" Metrics that quantify how a candidate adapter compares to the reference. We deliberately keep this small and explicit; the runner calls the public helpers and lets pandas do the heavy lifting downstream. """ from __future__ import annotations from typing import Dict, Iterable, Iterator, List, Mapping, Optional ...
c9a43e5267bbca7925aa28b5a3b52c85157693d30ae797754c227b20fac63403
Python
10,502
353
import unittest import warnings from unittest.mock import patch from argclz import AbstractParser # from rscvp.atlas._ccf.main_slice_transform import plot_slice_view_transform from rscvp.atlas.main_expr_range import RoiExprRangeBatchOptions from rscvp.atlas.main_roi_atlas import RoiAtlasOptions from rscvp.atlas.main_r...
ac5af75a2a6c45dde8951889ea70cc1a4e49c86eeb199a96c4f7817a85d5e5d1
Python
10,507
306
'''Generic Object Decoding: Feature prediction Analysis summary ---------------- - Learning method: Sparse linear regression - Preprocessing: Normalization and voxel selection - Data: GenericDecoding_demo - Results format: Pandas dataframe ''' from __future__ import print_function import os i...
cb21708ca3a464297cbe060b5c0c23cb86ec4055b94922617d99a4ce16c00aac
Python
10,508
324
import logging import os.path as op from enum import IntEnum from time import time import numpy as np from scipy.ndimage import gaussian_filter from skimage.segmentation import find_boundaries from AFQ.data.fetch import afq_home, fetch_synthseg_models from AFQ.nn.utils import prepare_t1_for_nn, resample_output logge...
a6a6f31f74d63747fdb2ae67b3359183840729d4cd624b2efad8ad263c54124a
Python
10,513
231
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import os from pathlib import Path import numpy as np from PIL import Image from ultralytics.data.utils import IMG_FORMATS from ultralytics.utils import LOGGER, TORCH_VERSION from ultralytics.utils.checks import c...
7748c983b5f63ecb63c748cc081fd53a9a6c21a026ff6b4dbe2f79c801977c4c
Python
10,515
302
""" Fast KNN implementation using FAISS. This implementation is significantly faster than scikit-learn's KNN, achieving speed-ups of over 1000x for typical use cases (1702s with scikit vs 1.5s on GPU). Supports multiple distance metrics: L2, L1, cosine similarity, spectral angle mapping (SAM), weighted L2, and hierar...
0e0ba6214914027b3b56c7c7236cc41cd5319a7abcde6071f14ca2acb1fb295d
Python
10,520
236
#!/usr/bin/env python3 # -*- coding: utf-8 """ Script that simulates data for benchmarking of DestVI, with answers to reviewer's comments. Created on 2021/08/03 @author romain_lopez """ import os import click import numpy as np np.random.seed(0) from logzero import logger from utils import get_mean_normal, catego...
c741bf1f656c7b260d8f9ff9243c1b5b9226595c9476d849f30d1ea819dd26cb
Python
10,524
199
from src.wrappers.OsipiBase import OsipiBase import numpy as np import IVIMNET.deep as deep import torch import warnings from utilities.data_simulation.GenerateData import GenerateData class IVIM_NEToptim(OsipiBase): """ Bi-exponential fitting algorithm by Oliver Gurney-Champion, Amsterdam UMC """ # I...
18a7d7bf9b324bd134e99036f5e55383a003046a1d56a1efd21a1955d842f510
Python
10,529
224
#!/usr/bin/env python3 """Estimate PVeD with ANTs Atropos from MNI-space dtifit maps.""" import argparse import json import os import shutil import subprocess import time import nibabel as nib import numpy as np from nibabel.processing import resample_from_to, resample_to_output from scipy import ndimage from scipy.s...
197445704e1b1b093f1d07dda3397353b830c338045e9efc3292cb5e8715c391
Python
10,529
315
"""Skill inference task. Project for Setayesh Radkani and Michael Yoo. """ #pylint: disable=import-error, no-name-in-module import numpy as np import pdb from moog import action_spaces from moog import observers from moog import physics as physics_lib from moog import game_rules from moog import tasks from . import...
80f17b3e2fc0ad4b9d9eb0851d898ce17997456214214e7dd30930660c5c1b4f
Python
10,529
277
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
525824a6246f7d5494417da5f4a690518b1f5fb6c6bb71c2b39b230988c1fb36
Python
10,531
296
import argparse import torch import torch.nn.functional as F from torch.utils.data import DataLoader from torch_geometric.utils import negative_sampling import torch_geometric.transforms as T from torch_geometric.nn import GCNConv, SAGEConv from ogb.linkproppred import PygLinkPropPredDataset, Evaluator from logger ...
8fa2381775be0a793fc65139d3f1ca205fabc0ddf27cf9c6f73d360b74d1fe2c
Python
10,531
246
""" Custom Synaptic Input Test Author: Aaron Miller Max Planck Institute for Human Cognitive and Brain Sciences, Leipzig Germany Brain Networks Group Tests the custom synaptic input point processes h.SunCur and h.SynCurNMDA, defined by neuron_interface/neurosim/mechanisms/synCur.mod neuron_interface/neurosim/mechanism...