Lab streaming layer nodes
The lab streaming layer provides a set of functions to make instrument data accessible in real time within a lab network. From there, streams can be picked up by recording programs, viewing programs or custom experiment applications that access data streams in real time.
lsl
- class timeflux.nodes.lsl.Send(name, type='Signal', format='double64', rate=0.0, source=None)
Bases:
timeflux.core.node.Node
Send to a LSL stream.
- Variables
i (Port) – Default data input, expects DataFrame.
- Parameters
name (string) – The name of the stream.
type (string) – The content type of the stream, .
format (string) – The format type for each channel. Currently, only
double64
andstring
are supported.rate (float) – The nominal sampling rate. Set to
0.0
to indicate a variable sampling rate.source (string, None) – The unique identifier for the stream. If
None
, it will be auto-generated.
Example
graphs: - id: Sender nodes: - id: random module: timeflux.nodes.random class: Random - id: outlet module: timeflux.nodes.lsl class: Send params: name: test edges: - source: random target: outlet rate: 1 - id: Receiver nodes: - id: inlet module: timeflux.nodes.lsl class: Receive params: prop: name value: test unit: ns sync: null - id: display module: timeflux.nodes.debug class: Display edges: - source: inlet target: display rate: 1
Instantiate the node.
- update()
Update the input and output ports.
- class timeflux.nodes.lsl.Receive(prop='name', value=None, timeout=1.0, unit='s', sync='local', channels=None, max_samples=1024)
Bases:
timeflux.core.node.Node
Receive from a LSL stream.
- Variables
o (Port) – Default output, provides DataFrame and meta.
- Parameters
prop (string) – The property to look for during stream resolution (e.g.,
name
,type
,source_id
).value (string) – The value that the property should have (e.g.,
EEG
for the type property).timeout (float) – The resolution timeout, in seconds.
unit (string) – Unit of the timestamps (e.g.,
s
,ms
,us
,ns
). The LSL library uses seconds by default. Timeflux uses nanoseconds. Default:s
.sync (string, None) – The method used to synchronize timestamps. Use
local
if you receive the stream from another application on the same computer. Usenetwork
if you receive from another computer. UseNone
if you receive from a Timeflux instance on the same computer.channels (list, None) – Override the channel names. If
None
, the names defined in the LSL stream will be used.max_samples (int) – The maximum number of samples to return per call.
Example
# Make sure you have a valid LSL configuration! # Check the test directory for an example lsl_api.cfg # See: https://labstreaminglayer.readthedocs.io/info/lslapicfg.html graphs: - id: Sender nodes: - id: random_1 module: timeflux.nodes.random class: Random - id: outlet_1 module: timeflux.nodes.lsl class: Send params: name: test_1 type: random - id: random_2 module: timeflux.nodes.random class: Random - id: outlet_2 module: timeflux.nodes.lsl class: Send params: name: test_2 edges: - source: random_1 target: outlet_1 - source: random_2 target: outlet_2 rate: 1 - id: Receiver1 nodes: - id: inlet module: timeflux.nodes.lsl class: Receive params: prop: type value: random unit: ns sync: None - id: display module: timeflux.nodes.debug class: Display edges: - source: inlet target: display rate: 1 - id: Receiver2 nodes: - id: inlet module: timeflux.nodes.lsl class: Receive params: prop: name value: test_2 unit: ns sync: None - id: display module: timeflux.nodes.debug class: Display edges: - source: inlet target: display rate: 1
Instantiate the node.
- update()
Update the input and output ports.