Preprocessing (Resampling & Filtering)
Preprocessing is where the pipeline makes its first irreversible decisions about the data. Every filter applied, every bad channel detected, every sample resampled changes the signal in ways that propagate through every downstream analysis. This is why preprocessing parameters deserve more scrutiny than any other stage—and why every choice documented here includes the reasoning behind it.
Resampling
Section titled “Resampling”Resampling is disabled by default (preprocessing.resample.enabled: false). Many clinical EEG systems record at 256 Hz natively, which provides adequate frequency resolution up to 128 Hz (Nyquist) and is well-suited for clinical analysis up to the 50 Hz gamma ceiling. There’s no reason to resample data that’s already at the target rate.
The resampling option exists for recordings from other systems that arrive at higher sampling rates (512 Hz, 1024 Hz, or higher). In those cases, downsampling to 256 Hz reduces computational load without sacrificing any information in the clinical frequency range (0.5–50 Hz). The target rate is configurable:
preprocessing: resample: enabled: false target_sfreq: 256.0When resampling is enabled, MNE-Python’s raw.resample() applies an anti-aliasing low-pass filter before decimation to prevent spectral folding. This is standard practice—but it’s another reason to avoid unnecessary resampling. Every filter changes the data.
Bandpass Filtering
Section titled “Bandpass Filtering”The pipeline applies a bandpass filter with cutoffs at 0.5 Hz (high-pass) and 100.0 Hz (low-pass):
preprocessing: filter: l_freq: 0.5 h_freq: 100.0These cutoffs are wider than what most clinical pipelines use, and both choices are deliberate.
The 0.5 Hz high-pass preserves the full delta band (1–4 Hz). Many clinical pipelines use a 1.0 Hz high-pass, which is easier on ICA convergence but attenuates low-delta activity. Delta power is clinically significant—elevated delta is one of the most reliable markers of cortical slowing, and losing the bottom half of the band compromises that measurement. The trade-off is that a 0.5 Hz high-pass makes ICA decomposition harder to converge. We solve this with the two-stage filtering approach described in the ICA section: ICA is fitted on a 1.0 Hz-filtered copy of the data for convergence, then applied to the 0.5 Hz-filtered original for analysis. This gives us both delta preservation and stable ICA decomposition.
The 100.0 Hz low-pass preserves the full gamma band (30–50 Hz) without filter roll-off artifacts. Most clinical pipelines filter at 40–50 Hz because gamma activity is hard to distinguish from muscle artifact. We keep the higher cutoff because gamma analysis is a core feature of the Coherence Workstation, and because muscle artifact in the 50–100 Hz range is handled by ASR rather than by filtering it out entirely. If gamma analysis is not needed for your clinical context, a 45 Hz low-pass is a reasonable alternative.
Notch Filtering
Section titled “Notch Filtering”Power line interference is removed with a notch filter at 60 Hz and its harmonics at 120 Hz and 180 Hz:
preprocessing: filter: notch_freq: 60.0 notch_harmonics: - 120.0 - 180.0 notch_width: 2.0The notch width is 2.0 Hz—narrow enough to remove the line frequency without disturbing nearby EEG frequencies. For European, Australian, or other 50 Hz power systems, change notch_freq to 50.0 and update the harmonics to 100.0 and 150.0.
Harmonics matter. The 60 Hz fundamental is the most visible line noise, but its harmonics at 120 Hz and 180 Hz can alias into lower frequencies after resampling or interact with nonlinear artifact rejection algorithms. Removing them at the source prevents downstream contamination.
Bad Channel Detection
Section titled “Bad Channel Detection”After filtering, the pipeline identifies and interpolates bad channels using the RANSAC (Random Sample Consensus) method from the autoreject library:
preprocessing: bad_channels: method: ransac correlation_threshold: 0.75RANSAC works by randomly selecting subsets of channels, predicting each channel’s signal from the subset using spherical spline interpolation, and comparing the prediction to the actual signal. A channel that consistently disagrees with its neighbors—showing a correlation below the 0.75 threshold—is flagged as bad. The logic is elegant: a good channel’s signal can be predicted from surrounding channels (because EEG is spatially smooth at the scalp), while a bad channel’s signal is dominated by local noise that doesn’t correlate with the rest of the montage.
Detected bad channels are interpolated from neighboring electrodes using spherical spline interpolation before any further processing. Interpolation creates a synthetic signal that’s consistent with the surrounding channels—it recovers the spatial topology but not the original neural signal at that location. This is honest: an interpolated channel contributes to topographic completeness but shouldn’t be over-interpreted as reflecting actual cortical activity beneath that electrode.
The identity of interpolated channels is logged in the stage output and displayed in the preprocessing report so the clinician knows exactly which channels are synthetic.
Why Not Automatic Epoch Rejection Here?
Section titled “Why Not Automatic Epoch Rejection Here?”Some pipelines reject bad epochs (time segments) during preprocessing. The Coherence Workstation separates this into two distinct steps: ASR handles continuous artifact reduction before ICA, and the post-ICA artifact rejection stage handles epoch-level filtering after ICA components have been removed. This separation is deliberate.
Rejecting epochs before ICA reduces the data available for ICA decomposition, which can degrade component quality—especially with only 19 channels, where every sample matters for convergence. By deferring epoch rejection to after ICA, we give the decomposition the maximum amount of data to work with, then clean up residual artifacts after the main contaminants (eye blinks, muscle bursts, cardiac artifact) have been removed as components.
The Preprocessing Sequence
Section titled “The Preprocessing Sequence”The full preprocessing sequence, in order:
- Load the raw recording and standardize channel names (see Data Ingestion)
- Resample to target rate if enabled (default: disabled)
- Bandpass filter at 0.5–100 Hz
- Notch filter at 60 Hz + 120 Hz + 180 Hz harmonics
- Bad channel detection via RANSAC; interpolate detected channels
- Average re-reference (see Referencing)
- ASR artifact subspace reconstruction (see Artifact Rejection)
- ICA decomposition and classification (see ICA)
- Source estimation via sLORETA (see Source Localization)
Steps 1–5 are covered on this page. Steps 6–9 have their own pages because each involves substantial clinical reasoning worth documenting separately.
Every parameter in this sequence is logged in the session’s parameter sidecar, and every parameter is configurable in configs/default.yaml. If you need to reproduce a processing run or verify what settings were used, the information is always available.