mne_denoise.viz.plot_signal_overlay#
- mne_denoise.viz.plot_signal_overlay(inst_before, inst_after, times, pick=None, start=None, stop=None, scale_after=True, before_label='Before', after_label='After', x_label='Time', y_label='Amplitude', title=None, show=True, fname=None)[source]#
Overlay one before/after trace to inspect reconstruction quality.
- Parameters:
inst_before (MNE object | ndarray) – Inputs to compare. Accepted array signal shapes are
(n_times,),(n_channels, n_times), and(n_epochs, n_channels, n_times).inst_after (MNE object | ndarray) – Inputs to compare. Accepted array signal shapes are
(n_times,),(n_channels, n_times), and(n_epochs, n_channels, n_times).times (array-like of shape (n_times,)) – Explicit time axis for both traces after length alignment.
pick (int | str | None) – Channel to display. Required when input has more than one channel. String picks require MNE channel names.
start (float | None) – Optional lower/upper bounds applied on the time axis.
stop (float | None) – Optional lower/upper bounds applied on the time axis.
scale_after (bool) – If True, scale the after-trace to the before-trace standard deviation.
before_label (str) – Legend label for the first input.
after_label (str) – Legend label for the second input.
x_label (str) – X-axis label.
y_label (str) – Y-axis label.
title (str | None) – Optional custom title.
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:
- Raises:
ValueError – If input shapes are invalid, multi-channel data is used without
pick, ortimeslength is inconsistent.
Notes
If traces have different lengths, both are trimmed to the common prefix before any time-window filtering.
Examples
>>> from mne_denoise.viz import plot_signal_overlay >>> fig = plot_signal_overlay( ... before_array, ... after_array, ... pick=0, ... times=np.arange(1000) / 250.0, ... show=False, ... )