moabb.paradigms.p300.BaseP300

class moabb.paradigms.p300.BaseP300(filters=([1, 24]), events=None, tmin=0.0, tmax=None, baseline=None, channels=None, resample=None)[source][source]

Base P300 paradigm.

Please use one of the child classes

Parameters
  • filters (list of list (defaults [[7, 35]])) – bank of bandpass filter to apply.

  • events (List of str | None (default None)) – event to use for epoching. If None, default to all events defined in the dataset.

  • tmin (float (default 0.0)) – Start time (in second) of the epoch, relative to the dataset specific task interval e.g. tmin = 1 would mean the epoch will start 1 second after the begining of the task as defined by the dataset.

  • tmax (float | None, (default None)) – End time (in second) of the epoch, relative to the begining of the dataset specific task interval. tmax = 5 would mean the epoch will end 5 second after the begining of the task as defined in the dataset. If None, use the dataset value.

  • baseline (None | tuple of length 2) – The time interval to consider as “baseline” when applying baseline correction. If None, do not apply baseline correction. If a tuple (a, b), the interval is between a and b (in seconds), including the endpoints. Correction is applied by computing the mean of the baseline period and subtracting it from the data (see mne.Epochs)

  • channels (list of str | None (default None)) – list of channel to select. If None, use all EEG channels available in the dataset.

  • resample (float | None (default None)) – If not None, resample the eeg data with the sampling rate provided.

Attributes
datasets

Property that define the list of compatible datasets

scoring

Property that defines scoring metric (e.g.

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.

used_events

property datasets

Property that define the list of compatible datasets

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.

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

property scoring

Property that defines scoring metric (e.g. ROC-AUC or accuracy or f-score), given as a sklearn-compatible string or a compatible sklearn scorer.