mne_rt.viz.ButterflyPlot#

class mne_rt.viz.ButterflyPlot(ch_names: list[str], sfreq: float, tmin: float, tmax: float, event_id: dict[str, int], info=None, montage: str = 'standard_1020', baseline: tuple | None = (None, 0), window_size: tuple[int, int] = (1440, 900), verbose: bool | str | None = None)[source]#

Bases: _MockQMainWindow

Real-time butterfly plot: all EEG/MEG channels overlaid per condition.

Each condition gets its own pyqtgraph.PlotItem stacked vertically in a pyqtgraph.GraphicsLayoutWidget. Channels are drawn as thin lines coloured by scalp region (blue → cyan → green → amber → red from frontal to occipital).

Parameters:
ch_nameslist of str

Electrode names in data order.

sfreqfloat

Sampling frequency in Hz.

tminfloat

Epoch start (s).

tmaxfloat

Epoch end (s).

event_iddict[str, int]

Condition label → marker integer.

infomne.Info or None

When provided, used for exact scalp positioning via mne.channels.find_layout().

montagestr, default "standard_1020"

Fallback montage when info is absent or has no dig points.

baselinetuple or None, default (None, 0)

Baseline correction interval.

window_sizetuple of int, default (1440, 900)

Initial window size in pixels.

verbosebool, str, or None
.. versionadded:: 1.0.0

See also

mne_rt.RTEpochs

Drives this plot via update().

__init__(ch_names: list[str], sfreq: float, tmin: float, tmax: float, event_id: dict[str, int], info=None, montage: str = 'standard_1020', baseline: tuple | None = (None, 0), window_size: tuple[int, int] = (1440, 900), verbose: bool | str | None = None) None[source]#

Methods

__init__(ch_names, sfreq, tmin, tmax, event_id)

update(data, conditions)

Redraw all butterfly plots with updated condition averages.

update(data: ndarray, conditions: list[str]) None[source]#

Redraw all butterfly plots with updated condition averages.

Thread-safe — may be called from the acquisition thread.

Parameters:
datandarray, shape (n_epochs, n_channels, n_times)

All accepted epochs so far.

conditionslist of str

Condition label for each epoch; length == data.shape[0].