bsl.lsl.StreamOutlet¶
- class bsl.lsl.StreamOutlet(sinfo, chunk_size=1, max_buffered=360)[source]¶
An outlet to share data and metadata on the network.
- Parameters:
- sinfo
StreamInfo The
StreamInfoobject 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. An Inlet 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 * 100if the sampling rate is irregular, else it’smax_bufferedseconds.
- sinfo
Attributes
Channel format of a stream.
Check whether
StreamInletare currently connected.Number of channels.
Name of the stream.
Sampling rate of the stream, according to the source (in Hz).
Type of the stream.
Methods
StreamInfocorresponding 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
StreamInletconnects.- get_sinfo()[source]¶
StreamInfocorresponding to this Outlet.- Returns:
- sinfo
StreamInfo Description of the stream connected to the outlet.
- sinfo
- push_chunk(x, timestamp=0.0, pushThrough=True)[source]¶
Push a chunk of samples into the
StreamOutlet.- Parameters:
- x
listoflist|arrayof 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 The acquisition timestamp of the sample, in agreement with
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_sizedefined when creating aStreamOutlettakes precedence over thepushThroughflag.
- x
- push_sample(x, timestamp=0.0, pushThrough=True)[source]¶
Push a sample into the
StreamOutlet.- Parameters:
- x
list|arrayof 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
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_sizedefined when creating aStreamOutlettakes precedence over thepushThroughflag.
- x
- wait_for_consumers(timeout)[source]¶
Wait (block) until at least one
StreamInletconnects.- Parameters:
- timeout
float Timeout duration in seconds.
- timeout
- Returns:
- success
bool True if the wait was successful, False if the
timeoutexpired.
- success
Notes
This function does not filter the search for
bsl.lsl.StreamInlet. Any application inlet will be recognized.
- property dtype¶
Channel format of a stream.
All channels in a stream have the same format.
- property has_consumers¶
Check whether
StreamInletare currently connected.While it does not hurt, there is technically no reason to push samples if there is no one connected.
- Returns:
- consumers
bool True if at least one consumer is connected.
- consumers
Notes
This function does not filter the search for
bsl.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.
- 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 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 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.