mne_lsl.lsl.StreamInfoπ
- class mne_lsl.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 a
StreamInlet
orStreamOutlet
.
- Parameters:
- name
str
Name of the stream. This field can not be empty.
- stype
str
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_channels
int
β₯ 1
Also called
channel_count
, represents the number of channels per sample. This number stays constant for the lifetime of the stream.- sfreq
float
β₯ 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 to0
.- dtype
str
|dtype
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. Can also be the equivalent numpy type, e.g.np.int8
.- source_id
str
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.
- name
Attributes
Retrieve the entire stream_info in XML format.
Timestamp at which the stream was created.
Extended description of the stream.
Channel format of a stream.
Hostname of the providing machine.
Number of channels.
Name of the stream.
Version of the LSL protocol.
Session ID for the given stream.
Sampling rate of the stream, according to the source (in Hz).
Unique identifier of the stream's source.
Type of the stream.
Unique ID of the
StreamOutlet
instance.Methods
Get the FIFF measurement
Info
in the description.Get the channel names in the description.
Get the channel types in the description.
Get the channel units in the description.
set_channel_info
(info)Set the channel info from a FIFF measurement
Info
.set_channel_names
(ch_names)Set the channel names in the description.
set_channel_types
(ch_types)Set the channel types in the description.
set_channel_units
(ch_units)Set the channel units in the description.
- get_channel_names()[source]π
Get the channel names in the description.
- Returns:
- ch_names
list
ofstr
orNone
|None
List of channel names, matching the number of total channels. If
None
, the channel names are not set.Warning
If a list of str and
None
are returned, some of the channel names are missing. This is not expected and could occur if the XML tree in thedesc
property is tempered with outside of the defined getter and setter.
- ch_names
- get_channel_types()[source]π
Get the channel types in the description.
- Returns:
- ch_types
list
ofstr
orNone
|None
List of channel types, matching the number of total channels. If
None
, the channel types are not set.Warning
If a list of str and
None
are returned, some of the channel types are missing. This is not expected and could occur if the XML tree in thedesc
property is tempered with outside of the defined getter and setter.
- ch_types
- get_channel_units()[source]π
Get the channel units in the description.
- Returns:
- ch_units
list
ofstr
orNone
|None
List of channel units, matching the number of total channels. If
None
, the channel units are not set.Warning
If a list of str and
None
are returned, some of the channel units are missing. This is not expected and could occur if the XML tree in thedesc
property is tempered with outside of the defined getter and setter.
- ch_units
- set_channel_names(ch_names)[source]π
Set the channel names in the description. Existing labels are overwritten.
- set_channel_types(ch_types)[source]π
Set the channel types in the description. Existing types are overwritten.
The types are given as human readable strings, e.g.
'eeg'
.
- set_channel_units(ch_units)[source]π
Set the channel units in the description. Existing units are overwritten.
The units are given as human readable strings, e.g.
'microvolts'
, or as multiplication factor, e.g.-6
for1e-6
thus converting e.g. Volts to microvolts.- Parameters:
Notes
Some channel types doch_units not have a unit. The
str
none
or theint
0 should be used to denote this channel unit, corresponding toFIFF_UNITM_NONE
in MNE-Python.
- 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 theStreamInfo
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.
- Type:
- 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
mne_lsl.lsl.local_clock()
on the providing machine.- Type:
- 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.
- Type:
dtype
|"string"
- 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 protocol_versionπ
Version of the LSL protocol.
The major version is
version // 100
. The minor version isversion % 100
.- Type:
- 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).
- 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 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.
- 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:
- 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.- Type: