Migrating from EEGLAB¶
To read in data exported from EEGLAB, MNE offers an EDF reader mne.io.read_raw_edf()
and a set
file reader.
To read in set files containing raw
data, use mne.io.read_raw_eeglab()
and to read in set
files containing
epochs
data, use mne.read_epochs_eeglab()
.
Here is a cheatsheet to help users migrate painlessly from EEGLAB. For the sake of clarity, let us assume
that the following are already defined or known: the file name fname
, time interval of the epochs tmin
and tmax
,
and the conditions cond1
and cond2
. The variables l_freq
and h_freq
are the frequencies (in Hz) below which
and above which to filter out data.
Processing step |
EEGLAB function |
MNE |
---|---|---|
Get started |
addpath(…);
eeglab;
|
|
Import data |
EEG = pop_fileio(fname); |
|
Filter data |
EEG = pop_eegfiltnew(EEG, l_freq, h_freq); |
|
Run ICA |
EEG = pop_runica(EEG); |
|
Epoch data |
event_id = {‘cond1’, ‘cond2’};
Epochs = pop_epochs(EEG, event_id, [tmin, tmax]);
|
|
Selecting epochs |
Epochs = pop_epochs(EEG_epochs, {cond2}); |
|
ERP butterfly plot |
pop_timtopo(EEG_epochs, …); |
|
Contrast ERPs |
pop_compareerps(EEG_epochs1, EEG_epochs2); |
|
Save data |
EEG = pop_saveset(EEG, fname); |
Note that MNE has functions to read a variety of file formats, not just mne.io.Raw()
. The interested user is directed to the IO documentation.
Pitfalls¶
Python methods often operate in-place. This means the object the method is called on is modified in-place (e.g., see the filter example above). This can be confusing to new users migrating from Matlab. However, it is also possible to ask MNE functions not to modify the input. To do this, call the
copy
method of the object (.e.g, useraw_filtered = raw.copy().filter(l_freq, h_freq)
).The concept of channel types is critical in MNE because it supports analysis of multimodal data (e.g., EEG, MEG, EOG, Stim channel) whereas most EEGLAB functions assume the same channel type (EEG).