mne_lsl.lsl.StreamOutletπŸ”—

class mne_lsl.lsl.StreamOutlet(sinfo, chunk_size=1, max_buffered=360)[source]πŸ”—

An outlet to share data and metadata on the network.

Parameters:
sinfoStreamInfo

The StreamInfo object describing the stream. Stays constant over the lifetime of the outlet.

chunk_sizeint β‰₯ 1

The desired chunk granularity in samples. By default, each push operation yields one chunk. A StreamInlet can override this setting.

max_bufferedfloat β‰₯ 0

The maximum amount of data to buffer in the Outlet. The number of samples buffered is max_buffered * 100 if the sampling rate is irregular, else it’s max_buffered seconds.

Attributes

dtype

Channel format of a stream.

has_consumers

True if at least one StreamInlet is connected.

n_channels

Number of channels.

name

Name of the stream.

sfreq

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

stype

Type of the stream.

Methods

get_sinfo()

StreamInfo corresponding to this Outlet.

push_chunk(x[, timestamp, pushThrough])

Push a chunk of samples into the StreamOutlet.

push_sample(x[, timestamp, pushThrough])

Push a sample into the StreamOutlet.

wait_for_consumers(timeout)

Wait (block) until at least one StreamInlet connects.

get_sinfo()[source]πŸ”—

StreamInfo corresponding to this Outlet.

Returns:
sinfoStreamInfo

Description of the stream connected to the outlet.

push_chunk(x, timestamp=None, pushThrough=True)[source]πŸ”—

Push a chunk of samples into the StreamOutlet.

Parameters:
xlist of list | array of shape (n_samples, n_channels)

Samples to push, with one element for each channel at every time point. If strings are transmitted, a list of sublist containing (n_channels,) is required. If numericals are transmitted, a numpy array of shape (n_samples, n_channels) is required.

timestampfloat | array of shape (n_samples,) | None

Acquisition timestamp in agreement with mne_lsl.lsl.local_clock(). If a float, the acquisition timestamp of the last sample. None (default) uses the current time. If an array, the acquisition timestamp of each sample.

pushThroughbool

If True, push the sample through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size defined when creating a StreamOutlet takes precedence over the pushThrough flag.

push_sample(x, timestamp=0.0, pushThrough=True)[source]πŸ”—

Push a sample into the StreamOutlet.

Parameters:
xlist | array of shape (n_channels,)

Sample to push, with one element for each channel. If strings are transmitted, a list is required. If numericals are transmitted, a numpy array is required.

timestampfloat

The acquisition timestamp of the sample, in agreement with mne_lsl.lsl.local_clock(). The default, 0, uses the current time.

pushThroughbool

If True, push the sample through to the receivers instead of buffering it with subsequent samples. Note that the chunk_size defined when creating a StreamOutlet takes precedence over the pushThrough flag.

wait_for_consumers(timeout)[source]πŸ”—

Wait (block) until at least one StreamInlet connects.

Parameters:
timeoutfloat | None

Timeout duration in seconds.

Returns:
successbool

True if the wait was successful, False if the timeout expired.

Notes

This function does not filter the search for mne_lsl.lsl.StreamInlet. Any application inlet will be recognized.

property dtypeπŸ”—

Channel format of a stream.

All channels in a stream have the same format.

Type:

dtype | "string"

property has_consumersπŸ”—

True if at least one StreamInlet is connected.

While it does not hurt, there is technically no reason to push samples if there is no one connected.

Type:

bool

Notes

This function does not filter the search for mne_lsl.lsl.StreamInlet. Any application inlet will be recognized.

property n_channelsπŸ”—

Number of channels.

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

Type:

int

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.

Type:

str

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.

Type:

float

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.

Type:

str

Examples using mne_lsl.lsl.StreamOutletπŸ”—

Introduction to real-time LSL streams

Introduction to real-time LSL streams

Low-level LSL API

Low-level LSL API