pnpl.datasets.libribrain2025.sentence_dataset.LibriBrainSentence#
- class pnpl.datasets.libribrain2025.sentence_dataset.LibriBrainSentence(data_path, partition=None, preprocessing_str='bads+headpos+sss+notch+bp+ds', include_run_keys=[], exclude_run_keys=[], exclude_tasks=[], standardize=True, clipping_boundary=10, channel_means=None, channel_stds=None, include_info=False, preload_files=False, preload_h5=False)[source]#
- Parameters:
data_path (str)
partition (str | None)
preprocessing_str (str | None)
include_run_keys (list[str])
exclude_run_keys (list[str])
exclude_tasks (list[str])
standardize (bool)
clipping_boundary (float | None)
channel_means (ndarray | None)
channel_stds (ndarray | None)
include_info (bool)
preload_files (bool)
preload_h5 (bool)
- __init__(data_path, partition=None, preprocessing_str='bads+headpos+sss+notch+bp+ds', include_run_keys=[], exclude_run_keys=[], exclude_tasks=[], standardize=True, clipping_boundary=10, channel_means=None, channel_stds=None, include_info=False, preload_files=False, preload_h5=False)[source]#
- Parameters:
data_path (str)
partition (str | None)
preprocessing_str (str | None)
include_run_keys (list[str])
exclude_run_keys (list[str])
exclude_tasks (list[str])
standardize (bool)
clipping_boundary (float | None)
channel_means (ndarray | None)
channel_stds (ndarray | None)
include_info (bool)
preload_files (bool)
preload_h5 (bool)
Methods
__init__(data_path[, partition, ...])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.
load_sentences_from_tsv(subject, session, ...)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_REPOSHUGGINGFACE_REPObroadcasted_meansbroadcasted_stdschannel_meanschannel_stds