mne_denoise.qa.underclean_proportion#

mne_denoise.qa.underclean_proportion(freqs: ndarray, psd_after: ndarray, target_freq: float, peak_bw: float = 2.0, surround_bw: float = 5.0, threshold_ratio: float = 2.0) float[source]#

Fraction of channels where the line-noise peak remains prominent.

Parameters:
  • freqs (array of shape (n_freqs,)) – Frequency vector.

  • psd_after (ndarray) – PSD after cleaning.

  • target_freq (float) – Centre frequency (Hz).

  • peak_bw (float) – Bandwidths for peak and surround.

  • surround_bw (float) – Bandwidths for peak and surround.

  • threshold_ratio (float) – Ratio above which a channel is considered under-cleaned.

Returns:

proportion – Value in [0, 1].

Return type:

float

Notes

A channel is flagged as under-cleaned when noise_surround_ratio() exceeds threshold_ratio.

Examples

>>> import numpy as np
>>> from mne_denoise.qa import underclean_proportion
>>> freqs = np.arange(0, 100, 0.5)
>>> psd = np.ones((4, len(freqs)))
>>> underclean_proportion(freqs, psd, 50.0)
0.0