Skip to main content

MNE-RT Logo

MNE-RT — Real-time M/EEG Signal Processing
From amplifier to 3-D brain display in a single, researcher-friendly API

License: BSD-3-Clause CI PyPI Python Docs


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.

Ecosystem

Several MNE-affiliated packages address real-time M/EEG at different levels of abstraction. Here is how they relate:

mne-realtime was the original real-time extension for MNE-Python. It offered TCP/IP client classes for a handful of acquisition systems (FieldTrip buffer, RtClient, StimServer) and a basic RtEpochs object for online epoching and classification. The package is no longer maintained and should not be used for new projects.

mne-lsl is an actively maintained, low-to-mid-level streaming library. It provides modern Python bindings for the Lab Streaming Layer (LSL) C++ library (replacement for the older pylsl) — together with high-level objects: StreamInlet and StreamOutlet for reading and writing LSL streams, StreamPlayer for replaying recorded files without hardware, StreamRecorder for saving streams to disk, and EpochStream for real-time epoching with online filtering. MNE-RT uses MNE-LSL as its data-acquisition backbone.

MNE-RT (this package) is an actively maintained, high-level neurofeedback and BCI application framework built on top of MNE-Python and MNE-LSL. It adds the full closed-loop pipeline that neither of the above provides: neural feature extraction modalities spanning sensor and source space; adaptive feedback protocols; online artifact correction methods; and live visualisation windows. It also handles feature combining, external feedback output via OSC and LSL outlets, BIDS-compatible session saving, and a full CLI.

Highlights

Feature Details
22 NF modalities Band power, ERD/ERS, laterality, Hjorth, spectral centroid, microstates, 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

Installation

pip install "mne-rt[pyqt6]"        # with a Qt binding, for the live windows
pip install "mne-rt[full,pyqt6]"   # + 3-D viz, dev tools, docs

The live windows need a Qt binding: PyQt6 (mne-rt[pyqt6]) or PySide6 (mne-rt[pyside6]). pip install mne-rt alone installs none, which suits a session without windows, analysis and the CLI.

Other installation methods

conda / mamba (conda-forge):

mamba install -c conda-forge mne-rt pyqt6
# or, with plain conda:
conda install -c conda-forge mne-rt pyqt6

uv (fast Rust-based installer):

uv pip install "mne-rt[pyqt6]"
uv pip install "mne-rt[full,pyqt6]"

Development install from source:

git clone https://github.com/mne-rt-org/mne-rt.git
cd mne-rt
pip install -e ".[dev,pyqt6]"

Verify:

mne-rt info     # prints MNE-RT and dependency versions
mne-rt demo     # runs a 60-second mock neurofeedback session

Quick start

from 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()

CLI

# 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 --brain

Documentation

Full documentation (API reference, tutorials, visualization gallery) is available at mne-rt-org.github.io/mne-rt.

Getting help

Cite

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 Sonderegger, Andreas and Neff, Patrick},
  booktitle    = {2025 IEEE 38th International Symposium on Computer-Based
                  Medical Systems (CBMS)},
  publisher    = {IEEE},
  year         = {2025},
  pages        = {337--338},
  doi          = {10.1109/CBMS65348.2025.00074}
}

Acknowledgements

Development was supported by the Swiss National Science Foundation (grant 208164 — Advancing Neurofeedback in Tinnitus).

License

BSD 3-Clause License — © 2024–2026 Payam S. Shabestari

Note on the optional gedai dependency. mne-rt itself is BSD-3-Clause. The adaptive multiband GEDAI denoiser (mne_rt.tools.AdaptiveMultibandGEDAIDenoiser, RTStream.fit_gedai(multiband=...)) additionally needs the gedai package, which is distributed under the PolyForm Noncommercial License 1.0.0 and covers a patent-pending algorithm with no commercial patent grant. gedai is not installed by pip install mne-rt or by mne-rt[full]; install it explicitly with pip install "mne-rt[gedai]" if you need that feature. Commercial use of the adaptive multiband GEDAI feature is not covered by mne-rt's permissive license and may require a separate agreement with the gedai licensor. mne_rt.tools.GEDAIDenoiser does not use gedai.

Metadata

Release files for mne-rt 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mne-rt 1.3.1
File Size Uploaded Provenance Actions
mne_rt-1.3.1.tar.gz 475.9 kB With provenance Details for mne_rt-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mne-rt 1.3.1
File Interpreter ABI Platform Actions
mne_rt-1.3.1-py3-none-any.whl Python 3 none any Details for mne_rt-1.3.1-py3-none-any.whl

Total release size: 999.1 kB

Release files / mne_rt-1.3.1.tar.gz

Download URL mne_rt-1.3.1.tar.gz
Size 475.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cabadb7d656a07b7f1384301f258c5ce59c7b8fdc12fd2765701c540f4078325
BLAKE2b-256 checksum
How to use checksums
7368a90b86d0f529c2cf507f2c516e00a29a4e3d19e4181b9860219108bbe449
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / mne_rt-1.3.1-py3-none-any.whl

Download URL mne_rt-1.3.1-py3-none-any.whl
Size 523.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50ca1d09a319dd59a5d646a8d7142f2e92db9e2002371d14e39dd5152b1ab299
BLAKE2b-256 checksum
How to use checksums
734ce497b9cdaec53ad4eddd9c85ddb7de3076dd8747fd7aa6b45f26a07d0e9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for mne-rt 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mne_rt-1.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page