mne_realtime.LSLClient#
- class mne_realtime.LSLClient(info=None, host='localhost', port=None, wait_max=10.0, tmin=None, tmax=inf, buffer_size=1000, verbose=None)[source]#
LSL Realtime Client.
Warning
This object is deprecated in favor of
mne_lsl.stream.StreamLSL
.- Parameters:
- infoinstance of
mne.Info
|None
The measurement info read in from a file. If None, it is generated from the LSL stream. This method may result in less info than expected. Also, the channel type of the LSL stream must be one the MNE supported channel types: ‘ecg’, ‘bio’, ‘stim’, ‘eog’, ‘misc’, ‘seeg’, ‘ecog’, ‘mag’, ‘eeg’, ‘ref_meg’, ‘grad’, ‘emg’, ‘hbr’ or ‘hbo’. If the channel type is EEG, the standard_1005 montage is used for electrode location.
- host
str
The LSL identifier of the server. This is the source_id designated when the LSL stream was created. Make sure the source_id is unique on the LSL subnet. For more information on LSL, please check the docstrings on StreamInfo and StreamInlet in the pylsl.
- port
int
|None
Port to use for the connection.
- wait_max
float
Maximum time (in seconds) to wait for real-time buffer to start
- tmin
float
|None
Time instant to start receiving buffers. If None, start from the latest samples available.
- tmax
float
Time instant to stop receiving buffers.
- buffer_size
int
Size of each buffer in terms of number of samples.
- verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
for more).
- infoinstance of
- get_data_as_epoch(n_samples=1024, picks=None, timeout=None)[source]#
Return n_samples from LSL in FIFO order.
- Parameters:
- n_samples
int
Number of samples to fetch.
- picks
str
| array_like |slice
|None
Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g.,
['meg', 'eeg']
) will pick channels of those types, channel name strings (e.g.,['MEG0111', 'MEG2623']
will pick the given channels. Can also be the string values'all'
to pick all channels, or'data'
to pick data channels. None (default) will pick all channels. Note that channels ininfo['bads']
will be included if their names or indices are explicitly provided.- timeout
float
|None
Maximum amount of time to wait for data from LSL if None: waits for 5x n_samples / sfreq
- n_samples
- Returns:
- epochinstance of
EpochsArray
|None
The samples fetched as an Epochs object. None if no data was returned from pylsl.
- epochinstance of
See also
- register_receive_callback(callback)#
Register a raw buffer receive callback.
- Parameters:
- callback
callable()
The callback. The raw buffer is passed as the first parameter to callback.
- callback
- start()#
Start the client.
- start_receive_thread(nchan)#
Start the receive thread.
If the measurement has not been started, it will also be started.
- Parameters:
- nchan
int
The number of channels in the data.
- nchan
- stop()#
Stop the client.
- stop_receive_thread(stop_measurement=False)#
Stop the receive thread.
- Parameters:
- stop_measurementbool
Also stop the measurement.
- unregister_receive_callback(callback)#
Unregister a raw buffer receive callback.
- Parameters:
- callback
callable()
The callback to unregister.
- callback
Examples using mne_realtime.LSLClient
#
Plot real-time epoch data with LSL client