pnpl.datasets.libribrain100.compat.LibriBrain100Speech

pnpl.datasets.libribrain100.compat.LibriBrain100Speech#

class pnpl.datasets.libribrain100.compat.LibriBrain100Speech(data_path, partition=None, subjects='all', corpus='all', preprocessing_str='bads+headpos+sss+notch+bp+ds', tmin=0.0, tmax=0.5, include_run_keys=None, exclude_run_keys=None, exclude_tasks=None, standardize=True, clipping_boundary=10.0, channel_means=None, channel_stds=None, include_info=False, oversample_silence_jitter=0, preload_files=False, stride=None, download=True, preload_h5=False)[source]#

Speech-vs-silence binary classification on LibriBrain100.

Parameters:
  • data_path (str)

  • partition (PartitionArg)

  • subjects (SubjectsArg)

  • corpus (CorpusArg)

  • preprocessing_str (str)

  • tmin (float)

  • tmax (float)

  • standardize (bool)

  • clipping_boundary (Optional[float])

  • channel_means (ndarray | None)

  • channel_stds (ndarray | None)

  • include_info (bool)

  • oversample_silence_jitter (int)

  • preload_files (bool)

  • stride (Optional[int])

  • download (bool)

  • preload_h5 (bool)

__init__(data_path, partition=None, subjects='all', corpus='all', preprocessing_str='bads+headpos+sss+notch+bp+ds', tmin=0.0, tmax=0.5, include_run_keys=None, exclude_run_keys=None, exclude_tasks=None, standardize=True, clipping_boundary=10.0, channel_means=None, channel_stds=None, include_info=False, oversample_silence_jitter=0, preload_files=False, stride=None, download=True, preload_h5=False)[source]#
Parameters:
  • data_path (str)

  • partition (str | None)

  • subjects (str | int | Sequence[str | int] | range | None)

  • corpus (str | Sequence[str] | None)

  • preprocessing_str (str)

  • tmin (float)

  • tmax (float)

  • standardize (bool)

  • clipping_boundary (float | None)

  • channel_means (ndarray | None)

  • channel_stds (ndarray | None)

  • include_info (bool)

  • oversample_silence_jitter (int)

  • preload_files (bool)

  • stride (int | None)

  • download (bool)

  • preload_h5 (bool)

Methods

__init__(data_path[, partition, subjects, ...])

calculate_standardization_params(h5_data_loader)

Calculate channel means and stds across all runs.

clip_sample(sample, boundary)

Clip sample values to [-boundary, boundary].

close_h5_files()

Close all open H5 file handles and drop preloaded arrays.

ensure_file(fpath)

Ensure a file exists locally, downloading if needed.

ensure_file_download(fpath, data_path[, repo_id])

Class method to download a file without requiring dataset instantiation.

get_bids_raw_path(subject, session, task, run)

Construct path to raw BIDS MEG file.

get_calibration_files()

Get paths to Maxwell filter calibration files.

get_derivatives_path(subject, session[, ...])

Construct path to derivatives directory.

get_events_path(subject, session, task, run)

Construct path to events TSV file.

get_h5_dataset(run_key)

Get (cached) H5 dataset for a run.

get_h5_path(subject, session, task, run[, ...])

Construct path to H5 file.

get_headpos_path(subject, session, task, run)

Construct path to cached head position file.

get_preprocessed_path(subject, session, ...)

Construct path to preprocessed file in derivatives.

get_sfreq_from_h5(h5_path)

Get sampling frequency from H5 file.

init_continuous_h5([preload_h5])

Initialize the H5 data cache.

load_continuous_window(subject, session, ...)

Load a time window from continuous H5 data.

load_continuous_window_from_sample(sample)

Load time window from a sample tuple.

load_head_positions(subject, session, task, run)

Load cached head positions from CSV file.

load_preprocessed_bids(subject, session, ...)

Load a preprocessed FIF file from the derivatives directory.

load_raw_bids(subject, session, task, run[, ...])

Load raw MEG data from BIDS structure.

prefetch_files(file_paths)

Prefetch multiple files in parallel.

raw_bids_exists(subject, session, task, run)

Check if raw BIDS data exists for given identifiers.

setup_standardization([standardize, ...])

Set up standardization parameters.

standardize(data)

Apply z-score normalization and optional clipping to data.

Attributes

HUGGINGFACE_FALLBACK_REPOS

HUGGINGFACE_REPO

broadcasted_means

broadcasted_stds

channel_means

channel_stds

label_info

n_channels

Number of MEG channels (306 for MEGIN TRIUX Neo).

n_times

records

The manifest records actually loaded by this dataset.