eegdash.dataset.base module#
Data utilities and dataset classes for EEG data handling.
This module provides core dataset classes for working with EEG data in the EEGDash ecosystem, including classes for individual recordings and collections of datasets. It integrates with braindecode for machine learning workflows and handles data loading from both local and remote sources.
- class eegdash.dataset.base.EEGDashBaseDataset(record: dict[str, Any], cache_dir: str, s3_bucket: str | None = None, **kwargs)[source]
Bases:
BaseDatasetA single EEG recording dataset.
Represents a single EEG recording, typically hosted on a remote server (like AWS S3) and cached locally upon first access. This class is a subclass of
braindecode.datasets.BaseDatasetand can be used with braindecode’s preprocessing and training pipelines.- Parameters:
record (dict) – A fully resolved metadata record for the data to load.
cache_dir (str) – The local directory where the data will be cached.
s3_bucket (str, optional) – The S3 bucket to download data from. If not provided, defaults to the OpenNeuro bucket.
**kwargs – Additional keyword arguments passed to the
braindecode.datasets.BaseDatasetconstructor.
- property raw: BaseRaw
The MNE Raw object for this recording.
Accessing this property triggers the download and caching of the data if it has not been accessed before.
- Returns:
The loaded MNE Raw object.
- Return type:
mne.io.BaseRaw
- class eegdash.dataset.base.EEGDashBaseRaw(input_fname: str, metadata: dict[str, Any], preload: bool = False, *, cache_dir: str | None = None, bids_dependencies: list[str] | None = None, verbose: Any = None)[source]
Bases:
BaseRawMNE BaseRaw wrapper for automatic S3 data fetching.
This class extends
mne.io.BaseRawto automatically fetch data from an S3 bucket and cache it locally when data is first accessed. It is intended for internal use within the EEGDash ecosystem.- Parameters:
input_fname (str) – The path to the file on the S3 bucket (relative to the bucket root).
metadata (dict) – The metadata record for the recording, containing information like sampling frequency, channel names, etc.
preload (bool, default False) – If True, preload the data into memory.
cache_dir (str, optional) – Local directory for caching data. If None, a default directory is used.
bids_dependencies (list of str, default []) – A list of BIDS metadata files to download alongside the main recording.
verbose (str, int, or None, default None) – The MNE verbosity level.
See also
mne.io.RawThe base class for Raw objects in MNE.