facebookresearch / labgraph

LabGraph is a Python framework for rapidly prototyping experimental systems for real-time streaming applications. It is particularly well-suited to real-time neuroscience, physiology and psychology experiments.
MIT License
162 stars 47 forks source link

LSL support #7

Closed patrickmineault closed 2 years ago

patrickmineault commented 3 years ago

🚀 Feature

Support LabStreamingLayer sources

Motivation

Labgraph is meant to be used for processing streaming biosignals in realtime. However, it doesn't currently have drivers for biosignal hardware (ExG, fNIRS, etc.), which means that users have to implement their own nodes to stream external data. This forms a barrier to experiment with LG.

Pitch

LabStreamingLayer is a widely-used transport layer to stream biosignal data. It is supported by over 50 biosignal devices. An LSL sub node could be implemented in much the same way that the ZMQ sub node is implemented.

Alternatives

ZeroMQ-based streaming is a partial solution to streaming biosignal data into LG, however it still requires writing adapters to grab data, as most biosignal hardware does not directly stream to ZeroMQ.

Additional context

I can implement a minimalistic LSL sub node with tests, however I'd like to know if that fits with current roadmap expectations.

jfResearchEng commented 3 years ago

Hi patrickmineault,

Great idea! It aligns with current roadmap. Reference ZMQNode.

Some additional reference (for our community): the following Device Nodes would be useful for LabGraph to support different biosignal hardware. I'll prepare a doc discussing the future roadmap on LabGraph with our community as well.

  1. ZMQ
  2. Lab Streaming Layer pylsl, available on PyPI
  3. Network Sockets:
    • Python socket module, part of the language standard library
    • Boost.Asio networking
  4. Serial Port
    • pyserial, available on PyPI
    • Boost.Asio serial ports
  5. Message-based I/O cobs-python, available on PyPI
jfResearchEng commented 3 years ago

LSL support would be very useful for LabGraph framework. It could be added as an extension to LabGraph Core, and an example on using Psychopy can be found here.