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. |
|
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 the Options menu 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)
print(com)
print(EEG_OPTIONS["option_allmenus"])
In a shared GUI/console session, the menu refresh uses the same
EEG_OPTIONS dictionary.
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.