alexandrebarachant / muse-lsl

Python script to stream EEG data from the muse 2016 headset
BSD 3-Clause "New" or "Revised" License
616 stars 182 forks source link

Unix epoch vs local_clock LSL timestamps #130

Open psycho-neuro-buddy opened 4 years ago

psycho-neuro-buddy commented 4 years ago

The current (v.2.0.0) version of muse-lsl appears to use Unix epoch timestamps instead of the LSL-standard local_clock (time since machine start) timestamps. This may not be an issue when using muse-lsl to record its own eeg stream plus other local markers, but this will BREAK the more general LSL ecosystem when using LabRecorder to record lsl streams from a number of sources (eg, EEG from muse-lsl, plus markers from PsychoPy, plus anything else).

BlueMuse dealt with this problem a year or so ago, and now offers a choice of time formats. Right now, muse-lsl appears only to use Unix epoch time, and sends those time stamps in its LSL stream for EEG. In contrast, PsychoPy (using pylsl) uses the standard local_clock. On a single local machine, you could assume the time formats are aligned and just convert between them to align this data, but this BREAKS the automatic stream alignment when using LSL across multiple machines on a network.

Is it possible to either change to local_clock (time elapsed since machine start) to be more compatible with the broader LSL ecosystem, or to allow a flag/option to choose this timestamp format? It would let muse-lsl play much nicer with the larger ecosystem of LSL-enabled data collection.

Edit: This is on MacOS (Mojave 10.14.6) with PsychoPy 2020.2.3 (PsychoPy is behaving as expected with LSL here, it is muse-lsl that would ideally be able to also send send local_clock timestamps...)

buyuk-dev commented 3 years ago

You can pass your own time function to the Muse() constructor, will that help?