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:
_MockQMainWindowReal-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 viaFigureCanvasQTAgg.- Parameters:
- info
mne.Info Channel info containing electrode positions (montage must be set).
- sfreq
float Sampling frequency of the incoming data in Hz.
- bands
dict[str,tuple[float,float]] |None, defaultNone Frequency bands to display as
{label: (f_low, f_high)}. Defaults to δ/θ/α/β/γ standard bands.- cmap
str, 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.
- contours
int, default 6 Number of contour lines. Set to
0to disable.- display_smoothing
float, default 1.0 EMA factor applied to the per-channel band-power maps before rendering.
1.0disables smoothing (raw per-window estimate shown directly — good for artifact monitoring); lower values progressively smooth the spatial maps across consecutive windows.- verbosebool |
str|None, defaultNone Verbosity level. See
set_log_level().
- info
See also
mne_rt.viz.NFPlotScrolling NF signal display.
mne_rt.viz.BrainPlot3D brain activation display.
mne_rt.RTStream.record_mainMain 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:
- data
ndarrayofshape(n_channels,n_times) Raw EEG/MEG data for the current analysis window.
- data
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().