timeflux.nodes.lsl


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)[source]

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 and string 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: replay
      module: timeflux.nodes.hdf5
      class: Replay
      params:
        filename: data/data.hdf5
        keys:
          - /nexus/signal/nexus_signal_raw
        timespan: 1
    - id: outlet
      module: timeflux.nodes.lsl
      class: Send
      params:
        name: test
    edges:
      - source: replay:nexus_signal_nexus_signal_raw
        target: outlet
    rate: 1

  - id: Receiver
    nodes:
    - id: inlet
      module: timeflux.nodes.lsl
      class: Receive
      params:
        prop: name
        value: test
        unit: ns
    - id: display
      module: timeflux.nodes.debug
      class: Display
    edges:
      - source: inlet
        target: display
    rate: 1

Create instance and initialize the logger.

update(self)[source]
class timeflux.nodes.lsl.Receive(name=None, prop='name', value=None, timeout=1.0, unit='s', offset_correction=False, sync='local', channels=None, max_samples=1024)[source]

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 by default.

  • sync (string, None) – The method used to synchronize timestamps. Use local if you receive the stream from another application on the same computer. Use network if you receive from another computer. Use None 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

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
    - 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:
        name: test_2
        unit: ns
    - id: display
      module: timeflux.nodes.debug
      class: Display
    edges:
      - source: inlet
        target: display
    rate: 1

Create instance and initialize the logger.

update(self)[source]