BCICIV2a
BCICIV2a.py
Description
This code is used to load EEG data from the BCICIV2a dataset. It modifies the data to fit the requirements of the eegdata dict, which is used to store and process EEG data.
Dependencies
numpy pandas scipy mne
- bciflow.datasets.bciciv2a.bciciv2a(subject: int = 1, session_list: List[str] | None = None, labels: List[str] = ['left-hand', 'right-hand', 'both-feet', 'tongue'], path: str = 'data/BCICIV2a/') Dict[str, Any][source]
Description
This function loads EEG data for a specific subject and session from the bciciv2b dataset. It processes the data to fit the structure of the eegdata dictionary, which is used for further processing and analysis.
- The dataset can be found at:
- param subject:
index of the subject to retrieve the data from
- type subject:
int
- param session_list:
list of session codes
- type session_list:
list, optional
- param labels:
dictionary mapping event names to event codes
- type labels:
dict
- param path:
path to the directory tha contains the datasets files.
- returns:
A dictionary containing the following keys:
X: EEG data as a numpy array [trials, 1, channels, time].
y: Labels corresponding to the EEG data.
sfreq: Sampling frequency of the EEG data.
y_dict: Mapping of labels to integers.
events: Dictionary describing event markers.
ch_names: List of channel names.
tmin: Start time of the EEG data.
data_type: Type of the data (‘epochs’).
- rtype:
dict
Examples
Load EEG data for subject 1, all sessions, and default labels:
>>> from bciflow.datasets import bciciv2a >>> eeg_data = bciciv2a(subject=1) >>> print(eeg_data['X'].shape) # Shape of the EEG data >>> print(eeg_data['y']) # Labels '''