moabb.paradigms.base.BaseParadigm¶
-
class
moabb.paradigms.base.
BaseParadigm
[source][source]¶ Base Paradigm.
- Attributes
Methods
get_data
(dataset[, subjects, return_epochs])Return the data for a list of subject.
is_valid
(dataset)Verify the dataset is compatible with the paradigm.
prepare_process
(dataset)Prepare processing of raw files
process_raw
(raw, dataset[, return_epochs])Process one raw data file.
-
get_data
(dataset, subjects=None, return_epochs=False)[source][source]¶ Return the data for a list of subject.
return the data, labels and a dataframe with metadata. the dataframe will contain at least the following columns
subject : the subject indice
session : the session indice
run : the run indice
- Parameters
dataset – A dataset instance.
subjects (List of int) – List of subject number
return_epochs (boolean) – This flag specifies whether to return only the data array or the complete processed mne.Epochs
- Returns
X (Union[np.ndarray, mne.Epochs]) – the data that will be used as features for the model Note: if return_epochs=True, this is mne.Epochs if return_epochs=False, this is np.ndarray
labels (np.ndarray) – the labels for training / evaluating the model
metadata (pd.DataFrame) – A dataframe containing the metadata.
-
abstract
is_valid
(dataset)[source][source]¶ Verify the dataset is compatible with the paradigm.
This method is called to verify dataset is compatible with the paradigm.
This method should raise an error if the dataset is not compatible with the paradigm. This is for example the case if the dataset is an ERP dataset for motor imagery paradigm, or if the dataset does not contain any of the required events.
- Parameters
dataset (dataset instance) – The dataset to verify.
-
prepare_process
(dataset)[source][source]¶ Prepare processing of raw files
This function allows to set parameter of the paradigm class prior to the preprocessing (process_raw). Does nothing by default and could be overloaded if needed.
- Parameters
dataset (dataset instance) – The dataset corresponding to the raw file. mainly use to access dataset specific information.
-
process_raw
(raw, dataset, return_epochs=False)[source][source]¶ Process one raw data file.
This function apply the preprocessing and eventual epoching on the individual run, and return the data, labels and a dataframe with metadata.
metadata is a dataframe with as many row as the length of the data and labels.
- Parameters
raw (mne.Raw instance) – the raw EEG data.
dataset (dataset instance) – The dataset corresponding to the raw file. mainly use to access dataset specific information.
return_epochs (boolean) – This flag specifies whether to return only the data array or the complete processed mne.Epochs
- Returns
X (Union[np.ndarray, mne.Epochs]) – the data that will be used as features for the model Note: if return_epochs=True, this is mne.Epochs if return_epochs=False, this is np.ndarray
labels (np.ndarray) – the labels for training / evaluating the model
metadata (pd.DataFrame) – A dataframe containing the metadata