mne_rt.viz.EpochPlot#

class mne_rt.viz.EpochPlot(ch_names: list[str], sfreq: float, tmin: float = -0.1, tmax: float = 0.5, n_shown: int = 20, time_window: float = 10.0, scale_uv: float = 100.0, event_id: dict[str, int] | None = None, info=None, verbose=None)[source]#

Bases: _MockQMainWindow

Real-time scrolling M/EEG viewer with epoch / trigger overlays.

Displays all channels stacked vertically (identical layout to RawPlot) with coloured event markers overlaid on the signal. For each trigger event a solid vertical line marks t = 0, a semi-transparent shaded band spans the epoch window [tmin, tmax], and dashed boundary lines sit at the epoch edges.

Parameters:
ch_nameslist of str

Channel names. One row per channel.

sfreqfloat

Sampling frequency in Hz.

tminfloat, default -0.1

Epoch start in seconds relative to each trigger.

tmaxfloat, default 0.5

Epoch end in seconds relative to each trigger.

n_shownint, default 20

Number of channels visible simultaneously.

time_windowfloat, default 10.0

Visible time range in seconds at startup.

scale_uvfloat, default 100.0

Amplitude scale in µV (half of per-channel row height).

event_iddict[str, int] | None, default None

Maps condition names to integer trigger codes. Each code gets a distinct colour; unmapped codes use the first colour.

infomne.Info | None, default None

If provided, used for channel-type detection and right-click sensor position.

verbosebool | str | None, default None

See also

mne_rt.viz.RawPlot

Continuous raw viewer without epoch overlays.

mne_rt.RTEpochs

Event-triggered epoch accumulator.

Notes

Feed data with push() (shape (n_ch, n_times)) and trigger events with push_trigger(). Both calls are safe to make from an acquisition thread.

Left-click a shaded epoch span to mark it bad (rendered in red); click again to unmark it. Marked epochs are tracked by bad_epoch_ids for use downstream (e.g. excluding them when building an mne.Epochs object from the corresponding trigger stream). The “Clear bad-epoch marks” sidebar button resets all marks without discarding the triggers themselves.

Added in version 1.1.0.

__init__(ch_names: list[str], sfreq: float, tmin: float = -0.1, tmax: float = 0.5, n_shown: int = 20, time_window: float = 10.0, scale_uv: float = 100.0, event_id: dict[str, int] | None = None, info=None, verbose=None) None[source]#

Methods

__init__(ch_names, sfreq[, tmin, tmax, ...])

closeEvent(event)

is_epoch_bad(epoch_id)

Whether epoch_id has been marked bad.

push(data)

Enqueue a raw data chunk for display.

push_trigger([code])

Enqueue a trigger event at the current stream position.

Attributes

bad_epoch_ids

Sorted list of epoch ids marked bad by clicking their span.

property bad_epoch_ids: list[int]#

Sorted list of epoch ids marked bad by clicking their span.

is_epoch_bad(epoch_id: int) bool[source]#

Whether epoch_id has been marked bad.

Parameters:
epoch_idint

Epoch id, as assigned in push order starting at 0 (the id of the n-th call to push_trigger() is n, ignoring any epochs since dropped from the trigger history).

push(data: ndarray) None[source]#

Enqueue a raw data chunk for display.

Thread-safe: may be called from any thread. The data is written into the circular buffer and rendered by the main-thread timer at ~30 Hz.

Parameters:
datandarray, shape (n_channels, n_samples)

New raw data chunk. No-op when paused.

push_trigger(code: int = 1) None[source]#

Enqueue a trigger event at the current stream position.

Thread-safe: may be called from any thread. The trigger is placed after all data chunks already in the queue, so the sample index is computed correctly in the main thread.

Parameters:
codeint, default 1

Integer event code matched against event_id.

closeEvent(event) None[source]#