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: MIT 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
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

Installation

pip install mne-rt                 # core package
pip install "mne-rt[full]"         # + 3-D viz, dev tools, docs
Other installation methods

conda / mamba (conda-forge):

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

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/mne-rt-org/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 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.

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 others},
  booktitle    = {2025 IEEE 38th International Symposium on Computer-Based
                  Medical Systems (CBMS)},
  pages        = {337--338},
  year         = {2025},
  organization = {IEEE}
}

Acknowledgements

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

License

MIT License — © 2025 Payam S. Shabestari

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mne_rt-1.1.0.tar.gz (221.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mne_rt-1.1.0-py3-none-any.whl (245.7 kB view details)

Uploaded Python 3

File details

Details for the file mne_rt-1.1.0.tar.gz.

File metadata

  • Download URL: mne_rt-1.1.0.tar.gz
  • Upload date:
  • Size: 221.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for mne_rt-1.1.0.tar.gz
Algorithm Hash digest
SHA256 84b6aebb84e648c8a56a3676e77c9137e7931826b85fad28172980f81e129521
MD5 d26dad4203bf6222e58c12e2d7d08e28
BLAKE2b-256 4f7b6e0afda949ad54864526ab71d4d82f3739613d26200f83942235fc120841

See more details on using hashes here.

Provenance

The following attestation bundles were made for mne_rt-1.1.0.tar.gz:

Publisher: release.yml on mne-rt-org/mne-rt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mne_rt-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: mne_rt-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 245.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for mne_rt-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18d8f482eeb500fe9880fc04525c1fd848465771ccb71d660ff3056041e8e14d
MD5 c3ba78916985811c7531810b2eecd3c3
BLAKE2b-256 cf442fce8abff743d0594fe685af7e29cdb252c6b865d66c74fc57f47ddb005c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mne_rt-1.1.0-py3-none-any.whl:

Publisher: release.yml on mne-rt-org/mne-rt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page