MNE-RT — Real-time M/EEG Signal Processing
From amplifier to 3-D brain display in a single, researcher-friendly API
MNE-RT is an open-source Python library for real-time M/EEG signal processing, built on MNE-Python and MNE-LSL. It covers the full closed-loop pipeline — from amplifier to 3-D brain display — in a single API designed for neurofeedback, BCI, and clinical or basic-science monitoring.
| Feature | Details |
|---|---|
| 20 NF modalities | Band power, ERD/ERS, laterality, Hjorth, spectral centroid, CFC, connectivity, graph Laplacian — sensor and source space |
| 10 adaptive protocols | Z-score, threshold, percentile, staircase, operant, RL, sham, multi-band, and cross-session transfer |
| 5 artifact correction methods | ASR, adaptive LMS, GEDAI, ORICA, real-time Maxwell/SSS (MEG) |
| 9 live visualisation windows | Scrolling raw · NF signal · epoch overlays · scalp topo · 3-D brain · butterfly · ERP comparison · TFR heatmaps |
| Feature combiners | Weighted sum, geometric mean, z-scored norm, or any sklearn estimator |
| External feedback output | OSC (Max/MSP, SuperCollider) and LSL outlet (PsychoPy, OpenViBE, BCI2000) |
| BIDS-compatible saving | Session JSON + TSV with full metadata, artifact rate, and SNR |
| CLI | mne-rt info · mne-rt demo · mne-rt baseline · mne-rt run |
| Mock mode | Full pipeline without hardware via built-in LSL replay |
pip install mne-rt # core package
pip install "mne-rt[full]" # + 3-D viz, dev tools, docsOther installation methods
uv (fast Rust-based installer):
uv pip install mne-rt
uv pip install "mne-rt[full]"Development install from source:
git clone https://github.com/payamsash/mne-rt.git
cd mne-rt
pip install -e ".[dev]"Verify:
mne-rt info # prints MNE-RT and dependency versions
mne-rt demo # runs a 60-second mock neurofeedback sessionfrom mne_rt import RTStream
from mne_rt.protocols import ZScoreProtocol
# 1 — Create a session object
nf = RTStream(
subject_id="sub01",
session="01",
subjects_dir="/data/subjects",
montage="easycap-M1",
)
# 2 — Connect to a live LSL stream (or replay a file without hardware)
nf.connect_to_lsl(mock_lsl=True)
# 3 — Record a resting-state baseline (bad channels, ICA, noise cov)
nf.record_baseline(duration=120)
# 4 — Run a closed-loop NF session
nf.record_main(
duration=300,
modality=["sensor_power", "erd_ers"],
protocol=ZScoreProtocol(direction="up", zscore_threshold=0.5),
show_nf_signal=True,
show_topo=True,
)
# 5 — Save results (BIDS-compatible JSON + TSV)
nf.save()# Print version and all dependency versions
mne-rt info
# Quick demo — no amplifier needed
mne-rt demo --duration 60 --modality sensor_power erd_ers
# Record a resting-state baseline
mne-rt baseline --subject sub01 --subjects-dir /data --session 01
# Run a full session with artifact correction and live displays
mne-rt run --subject sub01 --subjects-dir /data --duration 600 \
--modality sensor_power erd_ers \
--artifact-correction asr \
--topo --brainFull documentation (API reference, tutorials, visualization gallery) is available at payamsash.github.io/mne-rt.
If you use MNE-RT in your research, please cite:
@inproceedings{shabestari2025advances,
title = {Advances on Real Time {M/EEG} Neural Feature Extraction},
author = {Shabestari, Payam S and Ribes, Delphine and D{\'e}fayes, Lara
and Cai, Danpeng and Groves, Emily and Behjat, Harry H
and Van de Ville, Dimitri and Kleinjung, Tobias
and Naas, Adrian and Henchoz, Nicolas and others},
booktitle = {2025 IEEE 38th International Symposium on Computer-Based
Medical Systems (CBMS)},
pages = {337--338},
year = {2025},
organization = {IEEE}
}Development was supported by the Swiss National Science Foundation (grant 208164 — Advancing Neurofeedback in Tinnitus).
MIT License — © 2025 Payam S. Shabestari