labstreaminglayer / App-LabRecorder

An application for streaming one or more LSL streams to disk in XDF file format.
MIT License
122 stars 45 forks source link

LabRecorder assigns 1 to latency and duration for every sample #46

Open harelasaf opened 3 years ago

harelasaf commented 3 years ago

Labrecorder is synchronizing 2 streams: Matlab marker stream and OpenBCI EEG stream into this file When opening the file in EEGLAB XDF importer - latency and duration for each event is saved as "1". Perhaps an issue with outletStream.push_sample clock sync?

cboulay commented 3 years ago

Hi @harelasaf , in anticipation of what is likely to be the first follow-up question, can you please post the section of your Matlab script that creates the marker stream outlet and the section that pushes samples?

agricolab commented 3 years ago

Hey @harelasaf , your xdf file appears to actually contain three streams, apparently the MarkerStream was created twice, or an older Outlet with the same name was not properly killed and lived on as a zombie process.

XDFStream(name=MarkerStream, type=Markers, hostname=CogniAsaf, created_at=9268.7976244, chan_count=1, ),
XDFStream(name=MarkerStream, type=Markers, hostname=CogniAsaf, created_at=10633.4657311, chan_count=1, )
XDFStream(name=obci_eeg1, type=EEG, hostname=CogniAsaf, created_at=10773.5276496, chan_count=4, )

The first was empty, but the second Markerstream (created at 10633) contained 13 events:

111.0000000000000 at 10819.815980095114
1111.000000000000 at 10823.860194678258
2.000000000000000 at 10823.860306078257
17.00000000000000 at 10823.860397278255
1111.000000000000 at 10832.863870940726
1.000000000000000 at 10832.864163740727
7.000000000000000 at 10832.864400440725
1111.000000000000 at 10841.871113703182
2.000000000000000 at 10841.871325903181
17.00000000000000 at 10841.87151330318
1111.000000000000 at 10850.865821565689
2.000000000000000 at 10850.865992565688
17.00000000000000 at 10850.866077265688

also, the eeg data looked normal when i plotted it.

Could it be that the bug you reported was caused by the EEGlab importer being confused by two streams with the same properties?

harelasaf commented 3 years ago

Hi, Yes, this could be an issue, although I have not experienced difficulties like this in other computers (which also had multiple sessions of Matlab running the marker stream outlets). So you would advise closing all the streams before opening a new one and recording through Lab Recorder? Is there a Matlab function that does this?

Thanks,

On Sun, Oct 25, 2020 at 8:02 PM Robert Guggenberger < notifications@github.com> wrote:

Hey @harelasaf https://github.com/harelasaf , your xdf file appears to actually contain three streams, apparently the MarkerStream was created twice, or an older Outlet with the same name was not properly killed and lived on as a zombie process.

XDFStream(name=MarkerStream, type=Markers, hostname=CogniAsaf, created_at=9268.7976244, chan_count=1, ), XDFStream(name=MarkerStream, type=Markers, hostname=CogniAsaf, created_at=10633.4657311, chan_count=1, ) XDFStream(name=obci_eeg1, type=EEG, hostname=CogniAsaf, created_at=10773.5276496, chan_count=4, )

The first was empty, but the second Markerstream (created at 10633) contained 13 events:

111.0000000000000 at 10819.815980095114 1111.000000000000 at 10823.860194678258 2.000000000000000 at 10823.860306078257 17.00000000000000 at 10823.860397278255 1111.000000000000 at 10832.863870940726 1.000000000000000 at 10832.864163740727 7.000000000000000 at 10832.864400440725 1111.000000000000 at 10841.871113703182 2.000000000000000 at 10841.871325903181 17.00000000000000 at 10841.87151330318 1111.000000000000 at 10850.865821565689 2.000000000000000 at 10850.865992565688 17.00000000000000 at 10850.866077265688

also, the eeg data looked normal when i plotted it.

Could it be that the bug you reported was caused by the EEGlab importer being confused by two streams with the same properties?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/labstreaminglayer/App-LabRecorder/issues/46#issuecomment-716186996, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5S5GTPBJTY2Q24N2NMVFLSMRR3TANCNFSM4S6M44XA .

-- Asaf Harel Brainstorm IL http://www.brainstormil.com - NeuroTech Academic Community Computational Psychiatry Lab http://computational-psychiatry.com/ Dept. of Brain and Cognitive Science http://in.bgu.ac.il/bcs/Pages/default.aspxs http://in.bgu.ac.il/bcs/Pages/default.aspx Ben-Gurion University of the Negev http://in.bgu.ac.il/en/Pages/default.aspx

agricolab commented 3 years ago

LSL does not support remote killing of a zombie outlet. Depending on how the app for the outlet is set up, there might be additional protocols supporting this. Impossible to say in general.

You can kill all processes with a specific name from your OS terminal (e.g. taskkill on windows or kill on linux), and you can also script this via Matlab. This only works though if the outlet runs on the same machine as the inlet.

In general, i would consider it best practice that each outlet has a unique name. Even if they are virtually identical, they are recorded in the xdf with different ids. Yet, as there is no fixed order in which the streams are being recorded, there is no control over which one is being read from the xdf first. Depending on the reader, e.g. if there is an overwrite, there might be subtle and hard to reproduce bugs if names are identical. This is my guess, but I do not know enough about the eeglab importer to say more. I inspected the file with python, and it looked fine. What you can do is give the regular matlab loader a try and see whether that works and the file is valid to your expectations. That could help pinpoint the bug to the eeglab importer.