meeg_utils.qc.NarrowbandNoise#

class meeg_utils.qc.NarrowbandNoise(*, fline=None, fmin=17.0, fmax=None, threshold_db=4.0, window=6.0, tolerance=0.5, outlier_z=5.0)[source]#

Power-line noise and other narrowband noise in the raw spectrum.

Narrowband peaks are found with the ZapLine-plus detector (Klug & Kloosterman, 2022; mne_denoise.zapline.adaptive.find_noise_freqs()): a peak of the channel-averaged log spectrum more than threshold_db above the mean of the outer thirds of a window Hz neighbourhood. Peaks at the line frequency or its harmonics are line noise, which is reported but not flagged (it is removed in preprocessing); other peaks point to equipment in or near the recording room. Channels picking up much more line noise than the others usually have poor contact.

Parameters:
  • fline (float | None) – Power-line frequency; None uses info["line_freq"].

  • fmin (float | None) – Search range in Hz (ZapLine-plus default 17-99 Hz; fmax=None searches up to the low-pass or 95 % of the Nyquist frequency).

  • fmax (float | None) – Search range in Hz (ZapLine-plus default 17-99 Hz; fmax=None searches up to the low-pass or 95 % of the Nyquist frequency).

  • threshold_db (float) – Peak height above the local baseline (ZapLine-plus default 4 dB).

  • window (float) – Width of the local baseline in Hz (ZapLine-plus default 6 Hz).

  • tolerance (float) – Peaks within this distance (Hz) of a harmonic are line noise.

  • outlier_z (float) – Robust z-score (median / MAD) of a channel’s line-noise amplitude relative to its noise floor above which it is flagged (the threshold PREP uses for its noise criteria, 5).

metrics_#

Per channel type: line_db (median peak height of each harmonic), other_peaks (Hz) and line_outliers (channels).

Type:

dict

Notes

Figures: "psd" (spectra with line harmonics and other peaks marked) and "line_channels" (line-noise level of every channel).

__init__(*, fline=None, fmin=17.0, fmax=None, threshold_db=4.0, window=6.0, tolerance=0.5, outlier_z=5.0)[source]#

Methods

__init__(*[, fline, fmin, fmax, ...])

compute(raw)

Measure the recording.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

not_applicable(raw)

Return why the check cannot run on raw, or None if it can.

plot([kind, inst])

Draw quality-control figures.

set_params(**params)

Set the parameters of this estimator.

Attributes

level

The worst verdict of the findings ("ok" if there are none).

modalities

Data types the check needs at least one of ("meg", "eeg").

name

Key of the check in reports.

plot_kinds

kind -> whether it needs data (inst).

systems

Acquisition systems the check applies to; None means all.

name: ClassVar[str] = 'narrowband_noise'#

Key of the check in reports.

plot_kinds: ClassVar[dict[str, bool]] = {'line_channels': False, 'psd': False}#

kind -> whether it needs data (inst). Each kind is drawn by a _plot_<kind>(inst, **kwargs) method.

Type:

Figures the object can draw once fitted