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, reference=None, reference_label='Reference', highlight_mask=None, highlight_label='Artifact', highlight_spans=None, show=True, fname=None)[source]#
Overlay one before/after trace to inspect reconstruction quality.
- Parameters:
- inst_beforeMNE object | ndarray
Signal before denoising. Accepted array shapes are
(n_times,),(n_channels, n_times), and(n_epochs, n_channels, n_times).- inst_afterMNE object | ndarray
Signal after denoising with matching time and channel dimensions.
- timesarray-like of shape (n_times,)
Explicit time axis for both traces after length alignment.
- pickint | str | None
Channel to display. Required when input has more than one channel. String picks require MNE channel names.
- startfloat | None, default=None
Optional lower bound on the time axis.
- stopfloat | None, default=None
Optional upper bound on the time axis.
- scale_afterbool
If True, scale the after-trace to the before-trace standard deviation.
- before_labelstr
Legend label for the first input.
- after_labelstr
Legend label for the second input.
- x_labelstr
X-axis label.
- y_labelstr
Y-axis label.
- titlestr | None
Optional custom title.
- referencearray-like of shape (n_times,) | None
Optional ground-truth/reference trace overlaid on the same axis (e.g. the clean signal in a simulation). Aligned to the same length and time window as the before/after traces.
- reference_labelstr
Legend label for the reference trace.
- highlight_maskarray-like of bool of shape (n_times,) | None
Optional boolean mask; samples where True are shaded with
fill_betweento mark artifact regions.- highlight_labelstr
Legend label for the
highlight_maskshading.- highlight_spanssequence[mapping] | None
Optional list of spans to shade with
axvspan. Each item is a mapping withonsetandduration(in the same units astimes) and optionalcolor,alpha, andlabelkeys. Only the first span of each distinct label receives a legend entry. Useful for annotation-based repair/rejection spans.- 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 input shapes are invalid, multi-channel data is used without
pick, ortimeslength is inconsistent.