sccn / labstreaminglayer

LabStreamingLayer super repository comprising submodules for LSL and associated apps.
Other
544 stars 161 forks source link

time stamp jump bug #102

Open angelavujic opened 2 years ago

angelavujic commented 2 years ago

In something around ~2-3% of my LSL recordings (using PyLSL and LabRecorder) there are times in the EEG stream where the time stamp will have around +/- 200,000 added to it from one sample to the next. If this can be fixed with a change on my end I'd appreciate a solution - It can be manually fixed when analyzing offline data but it does cause an extra hassle when running at least 40+ sessions (have used 3 different eeg devices and 2 different computers, a windows and mac, and encountered this issue)

cboulay commented 2 years ago

What kind of EEG devices are you using and what LSL apps?

Since you're using pylsl I will assume you're using pyxdf to load the xdf file. Try disabling one or all of these features to see if it fixes the jumps:

https://github.com/xdf-modules/pyxdf/blob/main/pyxdf/pyxdf.py#L74-L76

If yes, please report back here. Ultimately you don't want to disable them, but maybe you can also play with the other arguments to that function, and we can try to isolate the problem. Also, at that point I'd ask that you close this issue and open a new one in the pyxdf repo. You'll get some extra assistance there with people other than me who have more expertise on pyxdf.

dmedine commented 2 years ago

Hi, Angela. +/-200,000 seconds is not so nice. I would be interested to see the source code you are using to send the EEG data just to make sure that there is nothing in there that could be causing this problem. Is it publicly available?

My guess, however, is that there is some network hiccup occurring when the clock offset measurement is made. This can cause issues when the clock synchronization and de-jittering mappings are computed by the xdf load program. As Chad suggests, you can turn these features off when you load the data and that might provide some more context.

angelavujic commented 2 years ago

Hi all, thanks for your prompt responses!

@cboulay I've primarily used the ANT neuro eego mylab 64 and the Neuroelectrics Enobio 32 with both LabRecorder and pylsl. Most data was collected with a Windows desktop or tablet running Windows 10 but I also have had data streamed from a Windows computer to a Macbook 2017 (OS Catalina 10.15.7) which saved the data via LabRecorder.

@cboulay @dmedine I've encountered this issue both while using LabRecorder to save data to xdfs and while using pylsl to save data to CSVs as well. I'm willing to try and recreate the issue but it may be difficult as it doesn't come up that frequently - over the course of ~150 sessions I've maybe seen this 5 - 7 times so far, but the count could be higher. Can't open source the Python code in its entirety but could share snippets if helpful

agricolab commented 2 years ago

ANT neuro offers streaming access either via SDK (for manual conversion to LSL) or builtin LSL support with their GUI application. Similar with Neuroelectrics. Which option did you use?

angelavujic commented 2 years ago

I've used the ANT Neuro GUI and Neuroelectrics GUI for the outlets. The inlet was in pylsl in one case and labrecorder for another.

dmedine commented 2 years ago

I still suspect it has to do with a network hiccup phenomenon. Can you share one of the faulty xdf files?