ezmsg.lsl.outlet#

Functions

generate_source_id(name, stream_type, channel_count, nominal_srate, channel_format)[source]#

Generate a stable source_id hash from stream metadata.

Parameters:
  • name (str | None)

  • stream_type (str | None)

  • channel_count (int)

  • nominal_srate (float)

  • channel_format (str)

Return type:

str

populate_desc_from_axisarray(info, message, *, out_size)[source]#

Populate the desc of info from message’s metadata.

Stamps two kinds of metadata onto the StreamInfo description: all stream-level message.attrs as top-level desc XML elements, and per-channel labels / structured-array fields from a "ch" CoordinateAxis.

Parameters:
Return type:

None

Classes

class LSLOutletProcessorState[source]#

Bases: object

__init__()[source]#
Return type:

None

outlet: StreamOutlet | None = None#
clock_sync: ClockSync | None = None#
class LSLOutletSettings(stream_name: str | None = None, stream_type: str | None = None, use_message_timestamp: bool = True, assume_lsl_clock: bool = False)[source]#

Bases: Settings

Parameters:
  • stream_name (str | None)

  • stream_type (str | None)

  • use_message_timestamp (bool)

  • assume_lsl_clock (bool)

stream_name: str | None = None#
stream_type: str | None = None#
use_message_timestamp: bool = True#

Whether to push the data with the incoming timestamps (True, default) or to ignore the incoming timestamps and push the data with the current pylsl.local_clock (False). When True, the incoming data must have a “time” dimension.

assume_lsl_clock: bool = False#

When use_message_timestamp is True, this indicates whether the incoming timestamps were already in the lsl clock (see LslInletSettings). If False, the incoming timestamps are assumed to be in the system time.time clock and are converted to the lsl clock. Note: Ignored when use_message_timestamp is False.

__init__(stream_name=None, stream_type=None, use_message_timestamp=True, assume_lsl_clock=False)#
Parameters:
  • stream_name (str | None)

  • stream_type (str | None)

  • use_message_timestamp (bool)

  • assume_lsl_clock (bool)

Return type:

None

class LSLOutletUnit(*args, settings=None, **kwargs)[source]#

Bases: BaseConsumerUnit[LSLOutletSettings, AxisArray, OutletProcessor]

Represents a node in a graph that subscribes to messages and forwards them by writing to an LSL outlet.

Parameters:
  • stream_name – The name of the created LSL outlet.

  • stream_type – The type of the created LSL outlet.

  • settings (Settings | None)

SETTINGS#

alias of LSLOutletSettings

create_processor()[source]#

Create the consumer instance from settings.

Return type:

None

async shutdown()[source]#

Runs when the Unit terminates.

This is called from within the same process this unit will live in. This lifecycle hook can be overridden. It can be run as async functions by simply adding the async keyword when overriding.

This method is where you should clean up resources and perform any necessary shutdown procedures.

Return type:

None

class OutletProcessor(*args, **kwargs)[source]#

Bases: BaseStatefulConsumer[LSLOutletSettings, AxisArray, LSLOutletProcessorState]

shutdown()[source]#
Return type:

None

generate_source_id(name, stream_type, channel_count, nominal_srate, channel_format)[source]#

Generate a stable source_id hash from stream metadata.

Parameters:
  • name (str | None)

  • stream_type (str | None)

  • channel_count (int)

  • nominal_srate (float)

  • channel_format (str)

Return type:

str

populate_desc_from_axisarray(info, message, *, out_size)[source]#

Populate the desc of info from message’s metadata.

Stamps two kinds of metadata onto the StreamInfo description: all stream-level message.attrs as top-level desc XML elements, and per-channel labels / structured-array fields from a "ch" CoordinateAxis.

Parameters:
Return type:

None

class LSLOutletSettings(stream_name: str | None = None, stream_type: str | None = None, use_message_timestamp: bool = True, assume_lsl_clock: bool = False)[source]#

Bases: Settings

Parameters:
  • stream_name (str | None)

  • stream_type (str | None)

  • use_message_timestamp (bool)

  • assume_lsl_clock (bool)

stream_name: str | None = None#
stream_type: str | None = None#
use_message_timestamp: bool = True#

Whether to push the data with the incoming timestamps (True, default) or to ignore the incoming timestamps and push the data with the current pylsl.local_clock (False). When True, the incoming data must have a “time” dimension.

assume_lsl_clock: bool = False#

When use_message_timestamp is True, this indicates whether the incoming timestamps were already in the lsl clock (see LslInletSettings). If False, the incoming timestamps are assumed to be in the system time.time clock and are converted to the lsl clock. Note: Ignored when use_message_timestamp is False.

__init__(stream_name=None, stream_type=None, use_message_timestamp=True, assume_lsl_clock=False)#
Parameters:
  • stream_name (str | None)

  • stream_type (str | None)

  • use_message_timestamp (bool)

  • assume_lsl_clock (bool)

Return type:

None

class LSLOutletProcessorState[source]#

Bases: object

__init__()[source]#
Return type:

None

outlet: StreamOutlet | None = None#
clock_sync: ClockSync | None = None#
class OutletProcessor(*args, **kwargs)[source]#

Bases: BaseStatefulConsumer[LSLOutletSettings, AxisArray, LSLOutletProcessorState]

shutdown()[source]#
Return type:

None

class LSLOutletUnit(*args, settings=None, **kwargs)[source]#

Bases: BaseConsumerUnit[LSLOutletSettings, AxisArray, OutletProcessor]

Represents a node in a graph that subscribes to messages and forwards them by writing to an LSL outlet.

Parameters:
  • stream_name – The name of the created LSL outlet.

  • stream_type – The type of the created LSL outlet.

  • settings (Settings | None)

SETTINGS#

alias of LSLOutletSettings

create_processor()[source]#

Create the consumer instance from settings.

Return type:

None

async shutdown()[source]#

Runs when the Unit terminates.

This is called from within the same process this unit will live in. This lifecycle hook can be overridden. It can be run as async functions by simply adding the async keyword when overriding.

This method is where you should clean up resources and perform any necessary shutdown procedures.

Return type:

None