bsl.lsl.StreamInfo

class bsl.lsl.StreamInfo(name, stype, n_channels, sfreq, dtype, source_id)[source]

Base Stream information object, storing the declaration of a stream.

A StreamInfo contains the following information:

  • Core information (name, number of channels, sampling frequency, channel format, …)

  • Optional metadata about the stream content (channel labels, measurement units, …)

  • Hosting information (uID, hostname, …) if bound to an StreamInlet or StreamOutlet

Parameters:
namestr

Name of the stream. This field can not be empty.

stypestr

Content type of the stream, e.g. "EEG" or "Gaze". If a stream contains mixed content, this value should be empty and the description of each channel should include its type.

n_channelsint 1

Also called channel_count, represents the number of channels per sample. This number stays constant for the lifetime of the stream.

sfreqfloat 0

Also called nominal_srate, represents the sampling rate (in Hz) as advertised by the data source. If the sampling rate is irregular (e.g. for a trigger stream), the sampling rate is set to 0.

dtypestr

Format of each channel. If your channels have different formats, consider supplying multiple streams or use the largest type that can hold them all. One of ('string', 'float32', 'float64', 'int8', 'int16', 'int32'). 'int64' is partially supported.

source_idstr

A unique identifier of the device or source of the data. If not empty, this information improves the system robustness since it allows recipients to recover from failure by finding a stream with the same source_id on the network.

Attributes

as_xml

Retrieve the entire stream_info in XML format.

created_at

Timestamp at which the stream was created.

desc

Extended description of the stream.

dtype

Channel format of a stream.

hostname

Hostname of the providing machine.

n_channels

Number of channels.

name

Name of the stream.

protocol_version

Version of the LSL protocol.

session_id

Session ID for the given stream.

sfreq

Sampling rate of the stream, according to the source (in Hz).

source_id

Unique identifier of the stream's source.

stype

Type of the stream.

uid

Unique ID of the StreamOutlet instance.

property as_xml

Retrieve the entire stream_info in XML format.

This yields an XML document (in string form) whose top-level element is <info>. The info element contains one element for each field of the StreamInfo class, including:

  • the core elements name, type (eq. stype), channel_count (eq. n_channels), nominal_srate (eq. sfreq), channel_format (eq. dtype), source_id

  • the misc elements version, created_at, uid, session_id, v4address, v4data_port, v4service_port, v6address, v6data_port, v6service_port

  • the extended description element desc with user-defined sub-elements.

property created_at

Timestamp at which the stream was created.

This is the time stamps at which the stream was first created, as determined by local_clock on the providing machine.

property desc

Extended description of the stream.

It is highly recommended that at least the channel labels are described here. See code examples on the LSL wiki. Other information, such as amplifier settings, measurement units if deviating from defaults, setup information, subject information, etc.. can be specified here, as well. Meta-data recommendations follow the XDF file format project.

Important: if you use a stream content type for which meta-data recommendations exist, please try to lay out your meta-data in agreement with these recommendations for compatibility with other applications.

property dtype

Channel format of a stream.

All channels in a stream have the same format.

property hostname

Hostname of the providing machine.

property n_channels

Number of channels.

A stream must have at least one channel. The number of channels remains constant for all samples.

property name

Name of the stream.

The name of the stream is defined by the application creating the LSL outlet. Streams with identical names can coexist, at the cost of ambiguity for the recording application and/or the experimenter.

property protocol_version

Version of the LSL protocol.

The major version is version // 100. The minor version is version % 100.

property session_id

Session ID for the given stream.

The session ID is an optional human-assigned identifier of the recording session. While it is rarely used, it can be used to prevent concurrent recording activities on the same sub-network (e.g., in multiple experiment areas) from seeing each other’s streams (can be assigned in a configuration file read by liblsl, see also Network Connectivity in the LSL wiki).

property sfreq

Sampling rate of the stream, according to the source (in Hz).

If a stream is irregularly sampled, the sampling rate is set to 0.

property source_id

Unique identifier of the stream’s source.

The unique source (or device) identifier is an optional piece of information that, if available, allows endpoints (such as the recording program) to re-acquire a stream automatically once if it came back online.

property stype

Type of the stream.

The content type is a short string, such as "EEG", "Gaze", … which describes the content carried by the channel. If a stream contains mixed content, this value should be an empty string and the type should be stored in the description of individual channels.

property uid

Unique ID of the StreamOutlet instance.

This ID is guaranteed to be different across multiple instantiations of the same StreamOutlet, e.g. after a re-start.