mne_denoise.viz.plot_spectrogram_comparison#

mne_denoise.viz.plot_spectrogram_comparison(inst_before, inst_after, picks, times, sfreq=None, fmin=1, fmax=40, n_freqs=20, show=True, fname=None)[source]#

Compare before/after spectrograms averaged across selected channels.

Parameters:
inst_beforeMNE object | ndarray

Signal before denoising. It must be paired with the same input kind as inst_after. Array inputs must be 2D (n_channels, n_times) or 3D (n_epochs, n_channels, n_times).

inst_afterMNE object | ndarray

Signal after denoising with matching channel and time dimensions.

pickssequence of int

Explicit channel picks used for averaging.

timesarray-like of shape (n_times,)

Explicit time vector used on x-axis.

sfreqfloat | None

Sampling frequency for array inputs.

fminfloat, default=1

Lower frequency bound for the spectrogram.

fmaxfloat, default=40

Upper frequency bound for the spectrogram.

n_freqsint

Number of frequencies in the display grid.

showbool

If True, display the figure.

fnamepath-like | None

Optional output path used to save the figure.

Returns:
figmatplotlib.figure.Figure

Figure handle.

Raises:
ValueError

If picks/times are invalid, if input types are mixed, if array inputs are missing sfreq, or if shape constraints fail.