MNE-LSL

mne-lsl bridges Lab Streaming Layer (LSL) with MNE-Python. This page explains how to use mne-lsl with Explore devices to stream live ExG data into MNE for inspection and analysis.

Install

pip install mne-lsl mne

Quick start: connect to the Explore ExG stream

In our setup, the Explore device, via explorepy, Explore Desktop, or Explore Mobile App, is already publishing an ExG LSL stream.

You only need to attach and read:

from mne_lsl.stream import StreamLSL

stream = StreamLSL(
    bufsize=5,                # seconds of data to keep in memory
    name="Explore_XXXX_ExG",  # LSL stream name
    stype="ExG"
).connect()

# Pull 1 second of the newest data
data, ts = stream.get_data(winsize=1.0)  # data: (n_channels, n_samples), ts: (n_samples,)

# When done
stream.disconnect()

Common operations

# Channel selection and referencing
stream.pick("eeg").add_reference_channels("CPz").set_eeg_reference("average")

# Retrieve only selected channels for a fixed window
data, ts = stream.get_data(winsize=0.5, picks=("Fz", "Cz", "Oz"))

Further reading: