API Reference#

Look through specific module or search through the entire list of APIs.

All APIs

Object

Description

collate

Extension of PyTorch’s default_collate function to enable more advanced

chain

Wrap an object to specify that it (or any of its members) should be stacked

pad

Wrap an object to specify that it (or any of its members) should be padded to

pad8

Wrap an object to specify that it (or any of its members) should be padded to

pad2d

Wrap an object to specify that it (or any of its members) should be padded to

pad2d8

Wrap an object to specify that it (or any of its members) should be padded to

track_batch

Wrap an array or tensor to track the batch_index.

track_mask

Wrap an array or tensor to specify that its padding mask should be tracked.

track_mask8

Wrap an array or tensor to specify that its padding mask should be tracked. This

track_mask2d

Wrap an array or tensor to specify that its padding mask should be tracked. This

track_mask2d8

Wrap an array or tensor to specify that its padding mask should be tracked. This

ArrayDict

A dictionary of arrays that share the same first dimension. The number of

Data

A flexible container for other data objects such as

Interval

An interval object is a set of time intervals each defined by a start time and

IrregularTimeSeries

An irregular time series is defined by a set of timestamps and a set of

RegularTimeSeries

A regular time series is the same as an irregular time series, but it has a

LazyArrayDict

Lazy variant of ArrayDict. The data is not loaded until it is accessed.

LazyInterval

Lazy variant of Interval. The data is not loaded until it is accessed.

LazyIrregularTimeSeries

Lazy variant of IrregularTimeSeries. The data is not loaded until it is

LazyRegularTimeSeries

Lazy variant of RegularTimeSeries. The data is not loaded until it is

BrainsetDescription

A container for storing brainset metadata.

DeviceDescription

A container for storing recording device metadata.

SessionDescription

A container to store experimental session related metadata.

SubjectDescription

A container for storing subject related metadata.

concat

Concatenates multiple time series objects into a single object.

get_default_serialize_fn_map

Returns the default serialization map used when saving Data to HDF5.

Dataset

PyTorch Dataset for loading time-slices of neural data recordings from HDF5 files.

DatasetIndex

Index for accessing a specific time interval of a recording within a Dataset.

NestedDataset

Dataset that composes multiple Dataset instances under a single interface.

OpenNeuroDataset

Base class for OpenNeuro datasets.

SpikingDatasetMixin

Mixin class for torch_brain.datasets.Dataset subclasses containing spiking data.

CalciumImagingDatasetMixin

Mixin class for torch_brain.datasets.Dataset subclasses containing calcium imaging data.

MultiChannelDatasetMixin

Mixin class for torch_brain.datasets.Dataset subclasses containing

PerichMillerPopulation2018

Motor cortex (M1 and PMd) spiking activity and reaching kinematics from four macaques

PeiPandarinathNLB2021

Curated spiking neural activity datasets from the Neural Latents Benchmark

ChurchlandShenoyNeural2012

Motor cortex (M1 and PMd) spiking activity and reaching kinematics from 2 monkeys

OdohertySabesNonhuman2017

Motor cortex (M1 and S1) spiking activity and reaching kinematics from 2 monkeys

VollanMoserAlternating2025

Neuropixels recordings from MEC and hippocampus in rats during spatial navigation

ShiraziHBNR1DS005505

Shirazi HBN Resting State 1 (HBN-R1) iEEG Dataset (OpenNeuro DS005505).

AllenVisualCodingOphys2016

Two-photon calcium imaging of mouse visual cortex from the Allen Brain

Neuroprobe2025

Neuroprobe 2025 iEEG benchmark dataset.

KochiVisualNamingDS006914

Kochi Visual Naming iEEG Dataset (OpenNeuro DS006914).

KlinzingSleepDS005555

Klinzing Sleep iEEG Dataset (OpenNeuro DS005555).

KempSleepEDF2013

Sleep-EDF Database Expanded containing 197 whole-night polysomnographic sleep recordings.

POYO

InfiniteVocabEmbedding

Embedding layer with a vocabulary that can be extended. Vocabulary is saved along

RotaryTimeEmbedding

Rotary time/positional embedding layer. This module is designed to be used with

SinusoidalTimeEmbedding

Sinusoidal time/position embedding layer.

RotaryCrossAttention

Cross-attention layer with rotary positional embeddings.

RotarySelfAttention

Self-attention layer with rotary positional embeddings.

BrainsetPipeline

Abstract base class for defining processing pipelines.

OpenNeuroPipeline

Abstract base class for OpenNeuro dataset pipelines.

RandomFixedWindowSampler

Samples fixed-length windows randomly from a collection of time intervals.

SequentialFixedWindowSampler

Samples fixed-length windows sequentially in a deterministic, reproducible order.

TrialSampler

Samples complete trial intervals without windowing.

DistributedEvaluationSamplerWrapper

Wraps any sampler for use in distributed evaluation without dropping samples.

DistributedStitchingFixedWindowSampler

Distributed sliding-window sampler that co-locates windows for prediction stitching.

Compose

Compose several transforms together. All transforms will be called sequentially,

RandomChoice

Apply a single transformation randomly picked from a list.

ConditionalChoice

Conditionally apply a single transformation based on whether a condition is met.

UnitDropout

Augmentation that randomly drops units from the sample. By default, the number

TriangleDistribution

Triangular distribution with a peak at mode_units, going from min_units to

RandomTimeScaling

<no summary>

RandomOutputSampler

<no summary>

RandomCrop

<no summary>

BinSpikes

Bin spike events into fixed-width time bins.

UnitFilter

Drop units based on the mask_fn given in the constructor.

UnitFilterById

Keep/drop units based on the keyword/regex given in the constructor.

isin_interval

Check if timestamps are in any of the intervals in the Interval object.

np_string_prefix

Adds a string prefix to each element of a numpy string array.

bin_spikes

Bins spikes into time bins of size bin_size. If the total time spanned by

fetch_eeg_recordings

Discover all EEG recordings inside a BIDS dataset or list of files.

fetch_ieeg_recordings

Discover all iEEG recordings inside a BIDS dataset or list of files.

group_recordings_by_entity

Group BIDS-compliant recordings by specified fixed entities.

check_eeg_recording_files_exist

Check if EEG data files corresponding to a BIDS recording_id exist in the BIDS root directory.

check_ieeg_recording_files_exist

Check if iEEG data files corresponding to a BIDS recording_id exist in the BIDS root directory.

build_bids_path

Build a mne_bids.BIDSPath for a given recording_id, modality, and BIDS root directory.

load_json_sidecar

Load the JSON sidecar file for a given BIDS file.

load_participants_tsv

Load participants.tsv data from a BIDS root directory.

get_subject_info

Retrieve demographic information (age, sex) for a given subject from a participants DataFrame.

extract_subject_from_nwb

Extract a SubjectDescription from an NWBFile

extract_spikes_from_nwbfile

Extract spikes and unit metadata from an NWBFile

download_file

Download a file from DANDI

get_nwb_asset_list

Get a list of all remote NWB assets in the given dandiset

extract_measurement_date

Extract the measurement date from MNE Raw recording data.

concatenate_recordings

Concatenate a list of MNE Raw objects into one, validating metadata.

extract_signal

Extract entire time-series signal from an MNE Raw object.

extract_channels

Extract channel metadata from an MNE Raw object, with support for custom channel name, type, and position mappings.

OPENNEURO_S3_BUCKET

str(object=’’) -> str

construct_s3_url_from_path

Construct an S3 URL prefix for a recording.

download_dataset_description

Download dataset_description.json from OpenNeuro S3.

download_recording

Download all files matching an S3 prefix pattern for a recording.

fetch_latest_snapshot_tag

Fetch the latest snapshot tag for an OpenNeuro dataset.

fetch_all_filenames

Fetch all filenames for a given OpenNeuro dataset using AWS S3.

fetch_participants_tsv

Fetch and parse participants.tsv from OpenNeuro S3.

fetch_species

Fetch species metadata for an OpenNeuro dataset from GraphQL.

get_cached_s3_client

Get a cached S3 client configured for anonymous access to public buckets.

get_object_list

List all object keys under a prefix (excludes directories).

download_prefix

Download all files matching a prefix pattern.

download_prefix_from_url

Download all files matching an S3 URL prefix pattern.

downsample_wideband

Downsample wideband signal to LFP sampling rate.

extract_bands

Extract bands from LFP

cube_to_long

Convert a cube of threshold crossings to a list of trials and units.

generate_stratified_folds

Generates stratified train/valid/test splits using a two-stage splitting process.

generate_string_kfold_assignment

Generate deterministic per-fold train/valid/test assignments for one ID.

stitch

Pools values that share the same timestamp using mean or mode operations.