Configuration#
EEGPrep keeps global options intentionally small. Use explicit function
arguments for preprocessing choices, and use EEG_OPTIONS only for session,
storage, compatibility, and GUI behavior that really is global.
EEG_OPTIONS is a dictionary, not a configuration object:
from eegprep import EEG_OPTIONS
print(dict(EEG_OPTIONS))
EEG_OPTIONS["option_allmenus"] = 1
EEG_OPTIONS["option_savetwofiles"] = 1
Save the previous values when a script changes global options:
from eegprep import EEG_OPTIONS
old_options = dict(EEG_OPTIONS)
try:
EEG_OPTIONS["option_memmapdata"] = 1
# Load or save datasets here.
finally:
EEG_OPTIONS.clear()
EEG_OPTIONS.update(old_options)
Common Global Options#
Key |
Effect |
|---|---|
|
Show advanced and legacy menu entries in the main GUI. |
|
Keep saved non-current |
|
Make |
|
Memory-map two-file |
|
Treat numeric |
|
Precompute ICA activations where supported. |
|
Use native OS file panels ( |
|
Scale ICA component activations to RMS microvolt during checkset paths. |
|
STUDY cache size in MB for implemented STUDY measure workflows. |
For storage details, see Large-Dataset Storage.
Set Options From GUI or Console#
Use File > Preferences in the GUI, or call pop_editoptions from
eegprep-console:
from eegprep import EEG_OPTIONS, pop_editoptions
com = pop_editoptions(option_allmenus=1, option_savetwofiles=1)
pop_editoptions("option_storedisk", 1)
print(com)
print(EEG_OPTIONS["option_allmenus"])
In a shared GUI/console session, the menu refresh uses the same
EEG_OPTIONS dictionary.
Pass native_file_dialogs=True or False to eeglab() or gui() to
override the global option for that window. The override also applies to file
panels opened from nested GUI callbacks. GUI preferences are saved to
~/.eegprep/options.json and loaded on the next GUI/console launch. This is
an EEGPrep file; it does not modify MATLAB’s eeg_options.m. Cancel leaves
both the current options and the file unchanged. Scripted changes stay in the
current process unless you pass persist=True to pop_editoptions.
Importing pop_editoptions does not load preferences or change
EEG_OPTIONS. A fresh eeglab()/gui() launch or eegprep-console
loads the file. Constructing windows or workspaces directly, or opening a GUI
with an existing session, preserves scripted in-process options. The console’s
gui() and eeglab() commands automatically use its existing session.
The dialog follows the memory-options layout and exposes working controls for storing inactive datasets on disk, saving two-file datasets, boundary events, menu visibility, and native file dialogs. Enable Show advanced options and reopen Preferences to access memory mapping.
Some preferences are visible but disabled because their global switches are not connected to EEGPrep workflows: single precision, ICA precomputation and RMS scaling, remembered folders, startup update checks, STUDY cache size, MATLAB save-version/struct choices, pending plugins, and HTML in graphics. Their registry values are retained for scripts, but changing those values does not change runtime behavior. Use explicit processing arguments where available and Help > Check for EEGPrep updates for a manual update check. MATLAB’s parallel toolbox, EEG object, and toolbox-path switches are also disabled because EEGPrep runs without MATLAB. These are current standalone limitations, rather than implemented equivalents of the EEGLAB preferences.
Preprocessing Parameters#
Most analysis choices are ordinary function arguments. This keeps scripts readable and prevents hidden global state from changing scientific results.
from pathlib import Path
from eegprep import pop_clean_rawdata, pop_eegfiltnew, pop_loadset, pop_resample
EEG = pop_loadset(Path("sample_data") / "eeglab_data.set")
EEG, filter_com = pop_eegfiltnew(
EEG,
locutoff=1,
hicutoff=40,
plotfreqz=False,
return_com=True,
)
EEG, resample_com = pop_resample(EEG, 64, return_com=True)
EEG, clean_com = pop_clean_rawdata(
EEG,
FlatlineCriterion=5,
ChannelCriterion=0.8,
LineNoiseCriterion=4,
Highpass=(0.25, 0.75),
BurstCriterion=20,
WindowCriterion=0.25,
return_com=True,
)
history = [filter_com, resample_com, clean_com]
The same rule applies to ICA, ICLabel, and BIDS preprocessing:
from eegprep import bids_preproc, pop_iclabel, pop_runica
EEG, ica_com = pop_runica(EEG, icatype="picard", gui=False, return_com=True)
EEG, label_com = pop_iclabel(EEG, "default", return_com=True)
bids_preproc(
"/path/to/bids-root",
OutputDir="/path/to/bids-root/derivatives/eegprep",
Subjects=["01"],
Tasks=["rest"],
WithInterp=True,
WithICA=False,
NumJobs=1,
)
Reusable Presets#
Represent lab presets as plain dictionaries and pass them explicitly:
CLEANING_PRESETS = {
"resting": {
"FlatlineCriterion": 5,
"ChannelCriterion": 0.8,
"LineNoiseCriterion": 4,
"Highpass": (0.25, 0.75),
"BurstCriterion": 20,
"WindowCriterion": 0.25,
},
"erp": {
"FlatlineCriterion": 5,
"ChannelCriterion": 0.85,
"LineNoiseCriterion": 4,
"Highpass": (0.1, 0.5),
"BurstCriterion": 20,
"WindowCriterion": 0.25,
},
}
EEG, com = pop_clean_rawdata(EEG, **CLEANING_PRESETS["resting"], return_com=True)
Keep these preset dictionaries in your lab package, notebook, or analysis repo so parameter changes are version-controlled with the study.
When to Use Which Surface#
Need |
Use |
|---|---|
Change menu visibility or storage behavior |
|
Change filtering, cleaning, resampling, ICA, ICLabel, or BIDS behavior |
Explicit function arguments. |
Record replayable commands |
|
Share settings across scripts |
A normal Python dictionary or module constant in your analysis code. |
Use the same state model as the GUI |
|
Troubleshooting#
Option Did Not Affect a Processing Step#
Check whether the function actually reads EEG_OPTIONS. Most processing
functions are configured through explicit keyword arguments.
Memory-Mapped Loading Did Not Happen#
option_memmapdata applies to two-file .set/.fdt datasets. Save with
savemode="twofiles" or set option_savetwofiles before saving, then load
again with option_memmapdata enabled.