ffrprep.preproc.epoch_data

ffrprep.preproc.epoch_data(eeg_data, baseline, events_file=None, picks=None, tmin=None, tmax=None, reject=None, on_missing='warn', event_id=None, derivatives_root=None, subject=None, task=None, run=None, trial_types=None, verbose=True)[source]

Epoch the provided EEG data object based on events.

Parameters:
  • eeg_data (MNE data object) – MNE data object containing EEG data and metadata.

  • baseline (float or 1-D array) – In seconds: start of baseline period (if float); baseline window (if array).

  • events_file (str, optional) – Path to events file. If provided, events will be loaded from file. If None, events will be found from the data annotations or triggers.

  • picks (list, optional) – Channels to include in epochs.

  • tmin (float, optional) – Start time before event (in seconds).

  • tmax (float, optional) – End time after event (in seconds).

  • verbose (bool) – Whether to print verbose output.

Returns:

epoched_data – MNE epoch object containing time-locked epochs.

Return type:

MNE epoch object

Examples

Epoch an EEG data object with a baseline time start of 50 ms before event onset.

>>> epoched_data = epoch_data(eeg_data, baseline=-0.05)

Epoch an EEG data object with a baseline window of 200 to 50 ms before event onset.

>>> epoched_data = epoch_data(eeg_data, baseline=[-0.2, -0.05])

Load events from external file:

>>> epoched_data = epoch_data(eeg_data, baseline=[-0.2, -0.05],
...                          events_file='/path/to/events.tsv')