Skip to content

Preprocessing

AIME LOC provides a standard preprocessing pipeline extracted from established EEG research practices. All steps are logged for reproducibility.

Default Pipeline

recording.preprocess()

This applies:

  1. Channel selection — Pick only EEG-typed channels (exclude ECG, EOG, EMG)
  2. Bandpass filter — 0.5–45 Hz FIR filter
  3. Notch filter — 50 Hz powerline noise removal
  4. Re-reference — Average reference

Customization

Every parameter is configurable:

recording.preprocess(
    bandpass=(1.0, 40.0),     # Custom bandpass (Hz)
    notch=60.0,               # 60 Hz for US recordings (None to skip)
    reference="average",      # "average", or channel name(s)
    pick_eeg=True,            # Remove non-EEG channels
)

Bandpass Filter

Controls the frequency range of interest:

# Standard (default) — captures all LOC-relevant bands
recording.preprocess(bandpass=(0.5, 45.0))

# Conservative — less noise, but may clip Energy/Intuition bands
recording.preprocess(bandpass=(1.0, 40.0))

# Wide — for high-frequency gamma analysis
recording.preprocess(bandpass=(0.5, 100.0))

Notch Filter

Removes powerline noise:

# 50 Hz — Europe, Asia, Africa, most of South America
recording.preprocess(notch=50.0)

# 60 Hz — North America, parts of Asia
recording.preprocess(notch=60.0)

# Skip notch filter (data already clean)
recording.preprocess(notch=None)

Re-Reference

# Average reference (default, recommended)
recording.preprocess(reference="average")

Channel Selection

# Pick only EEG channels (default)
recording.preprocess(pick_eeg=True)

# Keep all channels (e.g., if you need EOG for ICA later)
recording.preprocess(pick_eeg=False)

Preprocessing Log

Every step is recorded for reproducibility:

recording.preprocess()

for step in recording.preprocessing_log:
    print(f"  - {step}")
# - Picked EEG channels only (32 channels)
# - Bandpass filter: 0.5-45.0 Hz
# - Notch filter: 50.0 Hz
# - Re-referenced to average

Include this in your paper's methods section for full transparency.

Advanced: Custom MNE Preprocessing

For ICA, source localization, or other advanced techniques, escape to MNE:

recording = eeg.load("subject01.set")
raw = recording.to_mne()

# ICA artifact removal
import mne
ica = mne.preprocessing.ICA(n_components=20, random_state=42)
ica.fit(raw)
# ica.plot_components()  # visual inspection
ica.exclude = [0, 3]     # exclude EOG components
raw = ica.apply(raw)

# Return to AIME pipeline
recording = eeg.from_mne(raw)
recording.preprocessed  # True — marked as preprocessed

Preprocessing Warning

If you skip preprocessing, the SDK warns you:

recording = eeg.load("subject01.set")
epochs = recording.extract_epochs()  # UserWarning: Recording has not been preprocessed

This is a warning, not an error — you can skip preprocessing if your data is already clean.

Recommendations by Data Source

Source Bandpass Notch Reference
Research-grade (64ch) 0.5–45 Hz 50/60 Hz Average
Clinical EEG 0.5–45 Hz 50/60 Hz Average
Consumer (Muse, etc.) 1.0–40 Hz 50/60 Hz Average
Pre-processed data Skip Skip Skip

Next Steps