LSL Sender

class gpype.backend.sinks.lsl_sender.LSLSender[source]

Bases: INode

Lab Streaming Layer (LSL) sender for real-time data streaming.

Implements an LSL outlet that streams multi-channel data to the Lab Streaming Layer network. Automatically configures the LSL stream based on input port context including channel count, sampling rate, and frame size. Supports both single-sample and chunk-based streaming modes.

DEFAULT_STREAM_NAME = 'gpype_lsl'

Default LSL stream name for g.Pype data streams

class Configuration[source]

Bases: Configuration

Configuration class for LSLSender parameters.

class Keys[source]

Bases: Keys

Configuration keys for LSL sender settings.

STREAM_NAME = 'stream_name'

Stream name configuration key

__init__(stream_name=None, **kwargs)[source]

Initialize the LSL sender with specified stream name.

Parameters:
  • stream_name (Optional[str]) – Name for the LSL stream. If None, uses the default stream name. Used for stream identification on the LSL network.

  • **kwargs – Additional arguments passed to parent INode class.

stop()[source]

Stop the LSL sender and clean up resources.

Properly releases LSL resources by setting outlet and info objects to None, allowing them to be garbage collected.

setup(data, port_context_in)[source]

Setup the LSL stream based on input port context.

Creates LSL StreamInfo and StreamOutlet objects using metadata from the input port context. Stream is configured with appropriate parameters for EEG data transmission.

Parameters:
  • data (dict[str, ndarray]) – Dictionary of input data arrays from connected ports.

  • port_context_in (dict[str, dict]) – Context information from input ports with channel count, sampling rate, and frame size.

Return type:

dict[str, dict]

Returns:

Dictionary returned from parent setup method.

step(data)[source]

Process and stream data through LSL outlet.

Sends incoming data to the LSL network using either single-sample or chunk-based transmission depending on frame size. Automatically converts numpy arrays to lists for LSL compatibility.

Parameters:

data (dict[str, ndarray]) – Dictionary containing input data arrays. Uses the default input port to retrieve data for streaming.

Return type:

dict[str, ndarray]

Returns:

None as this is a sink node with no output data.