LSL Sender

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

Bases: Sink

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

Streams multi-channel data to the Lab Streaming Layer network, configuring the LSL stream from its input port’s context.

Where the input names its channels, or gives any of them a role other than signal, each channel’s type, label and physical unit are written to the stream’s channel description (desc/channels/channel, the XDF convention). A channel that was never named gets no label; a unit is empty rather than omitted where the channel’s own unit is not recorded.

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, edge_id=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.

  • edge_id (Optional[str]) – Which edge runs this node, matched against the edge process’s –edge-id. None, the default, is every edge; ignored when the pipeline is not distributed.

  • **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.

attach_timeline(timeline)[source]

Bind this sink to the pipeline’s master timeline.

Parameters:

timeline – Timeline manager owned by the pipeline.

Return type:

None

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.