mne_denoise.viz.plot_narrowband_score_scan#

mne_denoise.viz.plot_narrowband_score_scan(frequencies, eigenvalues, peak_freq=None, true_freqs=None, ax=None, show=True, fname=None)[source]#

Plot score/eigenvalue profiles from a narrowband scan.

Parameters:
  • frequencies (array-like of shape (n_freqs,)) – Frequency grid used in the scan.

  • eigenvalues (array-like of shape (n_freqs,) | (n_freqs, n_components)) – Scan scores. For 2D inputs, the first column is treated as dominant.

  • peak_freq (float | None) – Optional frequency to highlight with a marker and vertical line.

  • true_freqs (sequence of float | None) – Optional reference frequencies to mark.

  • ax (matplotlib.axes.Axes | None) – Target axes. If None, create a new figure and axes.

  • show (bool) – If True, display the figure.

  • fname (path-like | None) – Optional output path used to save the figure.

Returns:

fig – Figure handle.

Return type:

matplotlib.figure.Figure

Raises:

ValueError – If frequencies is not 1D, if eigenvalues is not 1D/2D, or if their first dimensions do not match.

Notes

This function is plotting-only and does not run frequency estimation. peak_freq and true_freqs are optional annotations supplied directly by the caller.

Examples

>>> import numpy as np
>>> from mne_denoise.viz import plot_narrowband_score_scan
>>> freqs = np.linspace(6, 40, 50)
>>> scores = np.exp(-0.5 * ((freqs - 12.0) / 1.5) ** 2)
>>> fig = plot_narrowband_score_scan(
...     freqs, scores, peak_freq=12.0, true_freqs=[12.0, 24.0], show=False
... )