Real-time Feature Modalities#
MNE-RT implements 20 real-time feature modalities spanning sensor-space and
source-space features, from simple band-power estimates to graph-theoretic
functional connectivity measures. Each modality can be used as a feedback
signal, a monitoring metric, or an input to an offline analysis pipeline.
Select a modality via the --modality flag of CLI or programmatically
via RTStream; each is identified by the config key listed below.
Sensor Power#
Config key: sensor_power
Mean spectral power across selected channels within a target frequency band. For each channel \(i\), the one-sided power spectral density \(S_i(f)\) is estimated via Welch’s method. The per-channel band power is averaged over the target band \([f_1, f_2]\) and then averaged across all \(N_\mathrm{ch}\) channels in the electrode set:
where \(\mathcal{F}\) is the set of discrete frequency bins in the band.
Band Ratio#
Config key: band_ratio
Ratio of mean band power in two frequency bands. Let \(P_1\) and \(P_2\) denote the mean band powers (computed as in Sensor Power) for bands \([f_{1a}, f_{1b}]\) and \([f_{2a}, f_{2b}]\), respectively:
A common example is the theta/beta ratio used as an index of attentional engagement.
ERD / ERS#
Config key: erd_ers
Event-related desynchronisation (ERD) and event-related synchronisation (ERS) quantify power changes relative to a resting-state baseline [1]. Let \(B\) be the mean band power computed from the baseline recording and \(P\) the mean band power in the current analysis window:
Negative values indicate desynchronisation (power decrease); positive values indicate synchronisation (power increase).
Laterality#
Config key: laterality
Inter-hemispheric log power asymmetry between right and left electrode sets. Let \(P_R\) and \(P_L\) be the mean band powers of the right- and left-hemisphere channels, respectively:
Positive values reflect greater right-hemisphere power; negative values reflect greater left-hemisphere power. The logarithmic transformation renders the index symmetric around zero.
Laterality ERD/ERS#
Config key: laterality_erd_ers
ERD/ERS-based laterality index — the difference of the ERD/ERS values computed separately for the right and left hemisphere electrode sets:
This measure combines baseline normalisation (from ERD/ERS) with hemispheric asymmetry (from laterality) and is particularly useful for motor-imagery neurofeedback and BCI applications.
Instantaneous Phase#
Config key: instantaneous_phase
The instantaneous phase and amplitude of the analytic signal in a target frequency band, estimated via the Hilbert transform [2].
The channel time series \(x(t)\) is first zero-phase bandpass-filtered
(4th-order Butterworth, via sosfiltfilt) to isolate the target band
\([f_1, f_2]\), then extended to the analytic signal
\(z(t) = x(t) + i\,\hat{x}(t)\), where \(\hat{x}(t)\) is the
Hilbert transform of the filtered signal:
The feature value is the instantaneous phase \(\phi \in (-\pi, \pi]\) at the last sample of the current analysis window, averaged across the selected channels. The amplitude envelope \(A\) is returned as a secondary output and can be used as a gating signal (e.g. stimulate only when amplitude is high).
Instantaneous phase is particularly useful for:
Phase-triggered stimulation — close the feedback loop at a target phase angle (e.g., trough of the alpha cycle)
Cross-frequency coupling analysis — use as the phase-providing input to the CFC modality
Phase synchrony feedback — reward or monitor convergence of phase between two electrode pairs
Slow Cortical Potentials#
Config key: scp
Slow cortical potentials (SCP) are ultra-low-frequency shifts in cortical excitability with time constants of 0.5 – 10 seconds [3]. The signal is extracted via low-pass filtering and channel averaging:
Apply an optional high-pass filter at
highpassHz (set to 0 for DC-coupled acquisition).Apply a low-pass filter at
lowpassHz (typically 1 Hz) using a 4th-order Butterworth filter viasosfilt.Collapse channels using the selected
reference("mean"or"median").Return the mean amplitude of the filtered signal across the window.
Positive SCP values reflect cortical deactivation (slow positive shift); negative SCP values reflect activation (slow negative shift).
Peak Alpha Frequency#
Config key: peak_alpha_freq
Real-time tracker of the individual peak alpha frequency (PAF), smoothed with an exponential moving average (EMA) across consecutive analysis windows.
For each window, the Welch PSD is computed and the frequency with maximum power within the search band \([f_1, f_2]\) is identified:
The instantaneous estimate is smoothed by an EMA with coefficient \(\alpha \in [0, 1)\):
At \(\alpha = 0\) the output is the raw instantaneous peak; at \(\alpha = 0.99\) the estimate changes very slowly, acting as a long-term personalised frequency anchor.
The EMA state is carried across windows via a shared mutable reference, so the tracker persists correctly over the full session.
Hjorth Parameters#
Config key: hjorth
Hjorth parameters are pure time-domain descriptors computed from the variance of a signal \(x(t)\) and its successive derivatives. [4]
Let \(x_i\) denote channel \(i\) after bandpass filtering. Define sample variances:
The three Hjorth parameters are:
Mobility approximates the dominant frequency of the signal (in units of rad/sample); Complexity quantifies how closely the signal resembles a pure sine wave — a pure oscillation has Complexity ≈ 1.
MNE-RT reports the mean of Mobility and Complexity averaged across all channels in the selected electrode set.
Spectral Centroid#
Config key: spectral_centroid
The spectral centroid estimates the centre of mass of the power spectrum within a frequency band, giving a single-number proxy for the dominant frequency of the signal at any given moment.
Given channel data \(x_i(t)\) and its one-sided power spectral density \(S_i(f)\) (estimated via Welch’s method), the spectral centroid for channel \(i\) is:
MNE-RT reports the mean centroid across channels in the selected electrode set as the feature value:
\(SC\) shifts upward when neural activity moves toward the upper edge of the band (e.g., during cognitive load in the alpha band) and downward when activity consolidates near the lower edge.
Entropy#
Config key: entropy
MNE-RT supports three entropy variants that capture different aspects of signal complexity.
Spectral entropy — normalised Shannon entropy of the power spectral density:
where \(\tilde{S}(f) = S(f) / \sum_{f'} S(f')\) is the normalised PSD (treated as a probability distribution over frequencies).
Approximate entropy (ApEn) — regularity statistic for a time series of length \(N\) with embedding dimension \(m\) and tolerance \(r\) [5]:
where \(\phi^{(m)}(r) = \frac{1}{N - m + 1} \sum_{i} \log C_i^{(m)}(r)\) and \(C_i^{(m)}(r)\) is the fraction of \(m\)-length template vectors within Chebyshev distance \(r\) of the \(i\)-th template.
Sample entropy (SampEn) — a bias-corrected alternative that excludes self-matches [6]:
where \(A^{(m)}\) counts matching \(m\)-length template pairs and \(B^{(m+1)}\) counts matching \((m+1)\)-length template pairs (self-matches excluded from both).
Argmax Frequency#
Config key: argmax_freq
The dominant frequency is the frequency bin with maximum power within the target band. Given the Welch PSD \(S(f)\) averaged across channels, the feature value is:
This feature tracks slow shifts in the dominant oscillatory peak, for example the individual alpha frequency (IAF) during rest or task conditions.
Individual Peak Power#
Config key: individual_peak_power
Power at the subject’s individual spectral peak, estimated using the FOOOF / specparam parametric spectral model [7]. The model decomposes the PSD into an aperiodic (1/f) component and a superimposed set of Gaussian peaks:
where \(L(f) = b - \log(k + f^{\chi})\) is the aperiodic component (offset \(b\), knee \(k\), exponent \(\chi\)) and \(G_k(f) = a_k \exp\!\left(-\tfrac{(f - \mu_k)^2}{2\sigma_k^2}\right)\) are Gaussian peaks with centre \(\mu_k\), height \(a_k\), and width \(\sigma_k\).
The individual alpha frequency (IAF) is identified as the peak centre \(\mu_k\) closest to the canonical alpha band, and the feature value is the aperiodic-corrected power \(a_k\) at that peak.
Cross-Frequency Coupling (Sensor)#
Config key: cfc_sensor
Cross-frequency coupling (CFC) quantifies interactions between the phase of a slow oscillation and the amplitude of a faster oscillation. MNE-RT uses Phase-Amplitude Coupling (PAC) via the Modulation Index (MI), which measures the Kullback–Leibler divergence between the observed amplitude distribution \(p(\theta)\) (mean amplitude as a function of phase bin \(\theta\)) and a uniform distribution [8]:
where \(N\) is the number of phase bins and \(\mathcal{U}\) is the uniform distribution. A value of \(\mathrm{MI} = 0\) indicates no coupling; larger values indicate stronger modulation of high-frequency amplitude by low-frequency phase.
MNE-RT can also produce a comodulogram — a two-dimensional map of MI values over a grid of phase-frequency / amplitude-frequency pairs — to identify which frequency combinations exhibit significant coupling.
Sensor Connectivity#
Config key: sensor_connectivity
Pairwise functional connectivity between sensor channels. MNE-RT directly calls the measures implemented in MNE-Connectivity.
See MNE-Connectivity for the detailed list of supported methods. The feature value is the connectivity between a specified pair of channels or the mean connectivity across a set of channel pairs.
Connectivity Ratio#
Config key: connectivity_ratio
Ratio of functional connectivity between two channel pairs:
where each connectivity value is computed using the same spectral measure as Sensor Connectivity (e.g. coherence, PLV, imaginary coherence). A common use is laterality of interhemispheric connectivity (e.g. \(\mathrm{coh}(C3, C4) / \mathrm{coh}(F3, F4)\)).
Sensor Graph#
Config key: sensor_graph
Graph-Laplacian learning from sensor-space signals estimates a sparse functional connectivity graph \(\mathcal{G} = (\mathcal{V}, \mathbf{W})\) [9] [10].
Given a signal matrix \(\mathbf{X} \in \mathbb{R}^{p \times n}\) (\(p\) sensor channels, \(n\) samples), MNE-RT solves the log-degree barrier optimisation problem:
where \(\mathbf{L} = \operatorname{Diag}(\mathbf{W}\mathbf{1}) - \mathbf{W}\) is the combinatorial graph Laplacian and the log-degree term prevents degenerate (all-zero) solutions.
\(\alpha\) — data-fidelity weight (larger → smoother, more connected graph)
\(\beta\) — log-degree regularisation (larger → more uniform node degrees)
The feature value is the edge weight \(W_{ij}\) between two specified sensor nodes (e.g. a left–right electrode pair), centred by subtracting a small offset so that values oscillate around zero. The optimisation is solved via the proximal splitting scheme of pyunlocbox.
Source Power#
Config key: source_power
Band power in source space, requiring a pre-computed inverse operator (MNE minimum-norm or beamformer). The inverse operator \(\mathbf{M}\) projects sensor data \(\mathbf{X} \in \mathbb{R}^{p \times n}\) to source estimates \(\hat{\mathbf{J}} = \mathbf{M}\mathbf{X} \in \mathbb{R}^{q \times n}\):
where \(S_s(f)\) is the Welch PSD of source \(s\) and
\(N_\mathrm{src}\) is the number of source vertices in the region of
interest.
Baseline recording (mne-rt baseline) is required to compute the inverse
operator before running this modality.
Source Connectivity#
Config key: source_connectivity
Functional connectivity computed on source-space time series rather than sensor signals, reducing the influence of field spread and volume conduction. After projecting sensor data to source estimates with the inverse operator, the same measures as Sensor Connectivity are applied.
Source connectivity is more anatomically interpretable than sensor connectivity and is recommended when an MRI and FreeSurfer reconstruction are available.
Source Graph#
Config key: source_graph
Graph-Laplacian learning applied to source-space signals. After projecting sensor data to source estimates with the inverse operator, the same optimisation as Sensor Graph is solved on the source time-series matrix \(\hat{\mathbf{J}} \in \mathbb{R}^{q \times n}\) [9] [10]:
The feature value is the learned edge weight \(W_{ij}\) between two specified brain atlas parcels or source vertices. Anatomical accuracy is improved relative to sensor-space graph learning because volume conduction is partially mitigated by the inverse solution.
See CLI for the full list of command-line options and flags used to configure these modalities.