mne_rt.viz.TopomapPlot#

class mne_rt.viz.TopomapPlot(info: Info, sfreq: float, bands: dict[str, tuple[float, float]] | None = None, cmap: str = 'RdBu_r', sensors: bool = True, contours: int = 6, display_smoothing: float = 1.0, verbose=None)[source]#

Bases: _MockQMainWindow

Real-time scalp topomap showing per-band power distribution.

Displays one colour-mapped topomap per selected frequency band, updated in real-time by push(). Built on PyQt6 with a matplotlib figure embedded via FigureCanvasQTAgg.

Parameters:
infomne.Info

Channel info containing electrode positions (montage must be set).

sfreqfloat

Sampling frequency of the incoming data in Hz.

bandsdict[str, tuple[float, float]] | None, default None

Frequency bands to display as {label: (f_low, f_high)}. Defaults to δ/θ/α/β/γ standard bands.

cmapstr, default “RdBu_r”

Initial colourmap. Must be one of ["RdBu_r", "hot", "plasma", "viridis", "Reds", "RdYlBu_r"].

sensorsbool, default True

Whether to draw sensor markers on the topomap.

contoursint, default 6

Number of contour lines. Set to 0 to disable.

display_smoothingfloat, default 1.0

EMA factor applied to the per-channel band-power maps before rendering. 1.0 disables smoothing (raw per-window estimate shown directly — good for artifact monitoring); lower values progressively smooth the spatial maps across consecutive windows.

verbosebool | str | None, default None

Verbosity level. See set_log_level().

See also

mne_rt.viz.NFPlot

Scrolling NF signal display.

mne_rt.viz.BrainPlot

3D brain activation display.

mne_rt.RTStream.record_main

Main NF loop that drives all plots.

Notes

The control panel (right sidebar) provides:

  • Playback — pause/resume, screenshot.

  • Display — colormap selector, contours, sensor toggle, colorbar mode.

  • Bands — per-band visibility checkboxes. Toggling rebuilds the figure layout automatically.

Band power is estimated via FFT on each incoming window (Hanning window applied to reduce spectral leakage).

Examples

Minimal offline usage:

>>> from mne import create_info
>>> import numpy as np
>>> app = QApplication([])
>>> info = create_info(["Fp1", "Fz", "Cz", "Oz"], sfreq=256, ch_types="eeg")
>>> plot = TopomapPlot(info, sfreq=256)
>>> plot.show()
>>> data = np.random.randn(4, 256)   # 1 s window
>>> plot.push(data)
>>> app.exec()

Added in version 1.0.0.

__init__(info: Info, sfreq: float, bands: dict[str, tuple[float, float]] | None = None, cmap: str = 'RdBu_r', sensors: bool = True, contours: int = 6, display_smoothing: float = 1.0, verbose=None) None[source]#

Methods

__init__(info, sfreq[, bands, cmap, ...])

push(data)

Update all visible topomaps from a new raw data window.

push(data: ndarray) None[source]#

Update all visible topomaps from a new raw data window.

Called at ~5 fps by the Qt pump timer inside record_main().

Parameters:
datandarray of shape (n_channels, n_times)

Raw EEG/MEG data for the current analysis window.

Notes

The call is a no-op when paused (⏸ button pressed). Band power is estimated via FFT and the topomaps are redrawn via mne.viz.plot_topomap().