EEGLAB Migration Notes#
EEGPrep is a Python port, not a MATLAB compatibility layer. Use these notes when translating EEGLAB habits into EEGPrep scripts and GUI workflows.
What Carries Over#
EEGLAB habit |
EEGPrep equivalent |
|---|---|
|
Same public names, Python arguments, and replayable command strings. |
|
Same workspace names inside |
GUI menu action then command history |
GUI actions update |
|
Same dictionary field names. |
Bundled plugins |
clean_rawdata, FIRFilt, ICLabel, DIPFIT, and EEG-BIDS are in-package Python ports or explicit standalone boundaries. |
STUDY |
Implemented as EEGPrep-owned dictionaries and JSON-safe measure caches. |
What Changes#
pop_select and pop_selectevent preserve the input data precision.
Selecting imported BDF data in float64 does not round it to float32. Embedded
.set save precision is a separate serialization policy; two-file .fdt
storage uses float32. Release-readiness F50’s embedded-save policy is assigned
to stream S1, outside the selection fixes.
Event selection accepts numeric codes and their textual spelling, such as
255 and '255'. For a dataset with numeric event types, its history
records numeric criteria, avoiding EEGLAB’s silent mismatch with a string cell
selector. Numeric-looking string event types remain strings. When cropping
introduces a text boundary event, event consistency can convert all types
to strings, as in EEGLAB.
Epoch cropping with pop_select includes both endpoints, as its time and
point range documentation specifies. EEGLAB pop_select.m calls epoch
with an upper-exclusive window and drops the final sample. For the tutorial
eeglab_data_epochs_ica.set, selecting epochs [1, 3, 5, 7, 9] and time
[-0.5, 0.5] therefore retains 129 points and 8 events in EEGPrep, with
xmax=0.5. The recorded EEGLAB 8ac485f6 result is 128 points and 8 events,
with xmax=0.4921875. EEGPrep retains each event only if its position within
its original epoch is inside the crop, then recalculates its concatenated
latency using the new epoch length.
pop_selectevent emits a warning when no events match the selection, with
instructions to check type names/codes and field ranges. Continuous data can
still be returned with no events (or only retained boundary events). EEGLAB
can return this empty selection silently; EEGPrep deliberately reports it.
The data and ICA rejection menus calculate marks, open scrolling data for
inspection, and retain the calculation commands when you choose Close (keep
marks). The probability and kurtosis PLOT buttons calculate marks and open
the same scrolling rejection browser as Scroll Data or Scroll Acts.,
where you can inspect and change epoch marks interactively. EEGLAB’s PLOT
opens the interactive rejstatepoch viewer, which has not been ported to
EEGPrep. Edit thresholds in the rejection menu and calculate again to change
the limits. Cancelling the menu discards its changes.
Topic |
Migration rule |
|---|---|
Arrays |
Use Python/NumPy zero-based indexing when slicing data. |
User-facing selectors |
Keep channel, component, dataset, and epoch numbers one-based in GUI dialogs and command strings unless a function documents otherwise. |
|
Python |
Globals |
EEGPrep functions take explicit inputs. The shared console namespace is session state, not a hidden global dependency. |
Runtime EEGLAB checkout |
Installed EEGPrep does not read from |
Optional toolboxes |
MATLAB-only LIMO, FieldTrip STUDY source statistics, MRI BEM creation, AFNI atlas clipping, and unavailable ICLabel network artifacts fail clearly instead of being faked. |
Scripts |
Assign return values explicitly outside |
Command Translation Examples#
Migration intent |
EEGPrep Python |
|---|---|
Load a dataset |
|
Filter |
|
Resample |
|
Average reference |
|
Epoch |
|
Run ICA |
|
Classify ICs |
|
Create a STUDY |
|
History Replay#
In MATLAB EEGLAB, menu commands appear in the MATLAB command window. In
EEGPrep, use LASTCOM and ALLCOM:
EEG, LASTCOM = pop_resample(EEG, 64, return_com=True)
ALLCOM.append(LASTCOM)
Inside eegprep-console, a bare call can update the current dataset:
pop_resample(EEG, 64)
In normal Python, assign the return value:
EEG = pop_resample(EEG, 64)
Indexing Boundaries#
EEGPrep intentionally keeps both conventions visible:
Python arrays are zero-based:
EEG["data"][0, :]is the first channel.GUI channel/component/dataset selectors are one-based.
abspeak,matcorr,mapcorr,matperm,hungarian,getchanlist,shuffle, andeeg_amplitudeareause 1-based indices, includingshuffle’s dimension. Subtract 1 before indexing a NumPy array.Event
latencyfields are sample positions in the EEGLAB-facing event model.icachansindis normalized after loading so internal indexing is consistent, then converted back when saving.
MATLAB Structure Transport#
When passing lists of dictionaries through the MATLAB bridge, numeric and text
values in the same field retain their individual types regardless of record
order. For example, 42.0 remains a MATLAB double when another record holds
"boundary"; it does not become "42.0". eeg_checkset then converts
that mix with the same rules as num2str (eeg_checkset.m lines
1235-1242): 65.0 next to boundary becomes '65'. A list that is
entirely numeric stays numeric.
Known Differences from EEGLAB#
These are intentional. EEGPrep does not reproduce the EEGLAB result.
Topic |
What EEGPrep does |
|---|---|
Empty |
|
Channel-coordinate validation |
|
Channel-coordinate transforms |
|
Channel-location count mismatch |
|
BIDS TSV bytes |
TSV sidecars are decoded as UTF-8, and a leading UTF-8 BOM is removed.
A file that is not valid UTF-8 is decoded as Latin-1, so |
BIDS JSON bytes |
JSON sidecars must be UTF-8. A leading UTF-8 BOM is removed and the
file is accepted. Bytes that are not UTF-8 raise
|
STUDY |
EEGLAB calls |
STUDY clustering dialog |
EEGLAB’s dialog calls |
ASR calibration on a short recording |
|
ASR on a very short recording |
With calibration reference selection off, |
ASR reference selection leaving three RMS windows |
Automatic reference selection can leave three RMS windows.
|
One-channel |
|
One ASR calibration window |
|
ASR at a low sampling rate |
|
NaNs during re-referencing |
|
Repeated |
With |
Baseline across a boundary |
On continuous data with a boundary event, |
BDF |
|
BDF |
|
BDF window shorter than the channel count |
|
BDF trigger codes |
|
BioSemi Status channel |
|
BDF event modes 3 and 5 |
|
EGI |
|
EGI |
|
Epoched event sort |
|
Continuous rejection with |
|
Numeric boundary types |
Consecutive equal-latency boundaries are merged whether |
Quoted channel-selection text |
|
Spectrum frequency range |
|
Identical dataset comparison |
|
Component-envelope dataset indices |
|
Component head-plot color scale |
Component |
Head-plot history assignment |
EEGLAB prefixes |
Plugin Migration#
Bundled plugins are importable from eegprep:
from eegprep import pop_clean_rawdata, pop_eegfiltnew, pop_iclabel, pop_dipfit_settings
External EEGLAB MATLAB plugins are not loaded by path. EEGPrep extensions are
normal Python packages discovered through the eegprep.extensions entry
point. See Bundled Plugins and Extensions and External Extensions for the package format.
When to Stay in MNE or MATLAB#
Use MNE-Python when your analysis depends on MNE-native object workflows, forward models, reports, or statistics. Use MATLAB EEGLAB when you need an unported MATLAB-only plugin or toolbox today. Use EEGPrep when you want familiar preprocessing and review workflows in Python with standalone package behavior.