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:
- sinfo
StreamInfo
The
StreamInfo
object describing the stream. Stays constant over the lifetime of the outlet.- chunk_size
int
β₯ 1
The desired chunk granularity in samples. By default, each push operation yields one chunk. A
StreamInlet
can override this setting.- max_buffered
float
β₯ 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βsmax_buffered
seconds.
- sinfo
Attributes
Channel format of a stream.
True if at least one
StreamInlet
is connected.Number of channels.
Name of the stream.
Sampling rate of the stream, according to the source (in Hz).
Type of the stream.
Methods
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:
- sinfo
StreamInfo
Description of the stream connected to the outlet.
- sinfo
- push_chunk(x, timestamp=None, pushThrough=True)[source]π
Push a chunk of samples into the
StreamOutlet
.- Parameters:
- x
list
oflist
|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.- timestamp
float
|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.- pushThrough
bool
If True, push the sample through to the receivers instead of buffering it with subsequent samples. Note that the
chunk_size
defined when creating aStreamOutlet
takes precedence over thepushThrough
flag.
- x
- push_sample(x, timestamp=0.0, pushThrough=True)[source]π
Push a sample into the
StreamOutlet
.- Parameters:
- x
list
|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.
- timestamp
float
The acquisition timestamp of the sample, in agreement with
mne_lsl.lsl.local_clock()
. The default,0
, uses the current time.- pushThrough
bool
If True, push the sample through to the receivers instead of buffering it with subsequent samples. Note that the
chunk_size
defined when creating aStreamOutlet
takes precedence over thepushThrough
flag.
- x
- wait_for_consumers(timeout)[source]π
Wait (block) until at least one
StreamInlet
connects.- Parameters:
- Returns:
- success
bool
True if the wait was successful, False if the
timeout
expired.
- success
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:
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:
- 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:
- 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:
- 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:
Examples using mne_lsl.lsl.StreamOutlet
π
Introduction to real-time LSL streams