pybemobil.preproc.remove_line#

pybemobil.preproc.remove_line(raw, noise_freqs, method='adaptive', method_kwargs=None)[source]#

Remove spectral line noise from EEG using ZapLine (DSS-based).

Operates on EEG channels only; all other channel types are left untouched, for every method.

Parameters:
rawmne.io.Raw

Continuous EEG recording.

noise_freqsfloat | "europe" | "usa" | None

Fundamental line-noise frequency in Hz (e.g. 50). Every method removes the fundamental together with all its harmonics below Nyquist, so harmonics must not be passed. Accepts the string shortcuts "europe" (50 Hz) and "usa" (60 Hz). For method="adaptive" you may pass None to let ZapLine-plus auto-detect line-noise frequencies.

methodstr

Algorithm to use. One of:

"adaptive" (default)

ZapLine-plus via mne_denoise.zapline.ZapLine with adaptive=True. Auto-detects the noise frequency when noise_freqs is None. Requires mne_denoise.

"zapline"

Standard (non-adaptive) ZapLine via mne_denoise.zapline.ZapLine with adaptive=False. Requires mne_denoise.

"dss_line"

Single-pass DSS via meegkit.dss.dss_line(). Requires meegkit.

"dss_line_iter"

Iterative DSS via meegkit.dss.dss_line_iter(). Requires meegkit.

method_kwargsdict | None

Extra keyword arguments forwarded to the backend of the chosen method: mne_denoise.zapline.ZapLine for "adaptive" and "zapline" (e.g. threshold, adaptive_params), meegkit.dss.dss_line() (e.g. nremove, nfft) or meegkit.dss.dss_line_iter() (e.g. n_iter_max). They override this function’s defaults. The sampling and line frequencies are set from raw and noise_freqs and cannot be passed here. None uses defaults.

Returns:
raw_cleanmne.io.Raw

Copy of raw with line noise attenuated.