mne_rt.LSLSender#
- class mne_rt.LSLSender(stream_name: str = 'ANT_NF', stream_type: str = 'NF', n_channels: int = 8, srate: float = 0.0, source_id: str = 'ant_nf_outlet')[source]#
Bases:
objectThread-safe LSL outlet that broadcasts NF feature values.
Creates a single-source LSL stream with
n_channelsfloat32 channels (one per active NF modality). Channel labels are set from the modality names on the firstpush()call.- Parameters:
- stream_name
str, default “ANT_NF” LSL stream name visible to subscribers.
- stream_type
str, default “NF” LSL content type (arbitrary string; “NF” is ANT convention).
- n_channels
int, default 8 Maximum number of channels in the outlet. If fewer modalities are active, unused channels are filled with
0.0. You can leave this at the default and the outlet will resize automatically on first push if needed.- srate
float, default 0.0 Nominal sample rate in Hz.
0.0marks the stream as irregular (i.e. one sample per NF window, not a fixed rate).- source_id
str, default “ant_nf_outlet” Unique source identifier embedded in the stream info.
- stream_name
- Raises:
ImportErrorIf neither
mne_lslnorpylslis installed.
Examples
Basic usage:
sender = LSLSender(stream_name="ANT_NF") sender.push(["sensor_power", "erd_ers"], [0.42, -1.2]) sender.close()
Context-manager usage:
with LSLSender() as sender: for value in nf_stream: sender.push(["sensor_power"], [value])
Added in version 1.0.0.
- __init__(stream_name: str = 'ANT_NF', stream_type: str = 'NF', n_channels: int = 8, srate: float = 0.0, source_id: str = 'ant_nf_outlet') None[source]#
Methods
__init__([stream_name, stream_type, ...])close()Destroy the LSL outlet and release resources.
push(modalities, values)Push one NF sample into the LSL outlet.
push_value(modality, value)Push a single-channel NF value.
Attributes
Modality names from the most recent
push()call.Current number of channels in the LSL outlet.
- push(modalities: Sequence[str], values: Sequence[float]) None[source]#
Push one NF sample into the LSL outlet.
- Parameters:
- Raises:
ValueErrorIf
modalitiesandvalueshave different lengths.