-
Notifications
You must be signed in to change notification settings - Fork 171
How to apply time synchronization properly #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, So I had an idea — though I'm not sure if it makes sense. In this way, both data streams would be aligned to the same clock (i.e., my PC's clock). The reason I believe the synchronization isn't working is because I tested the same task using NeuroNexus (Nuronlink) + MATLAB, and the N1 latency was about 172 ms. But when I use my custom device with LSL in Unity, the N1 shows up at around 200 ms. However, if I send events using UDP, the N1 latency is correct. |
Data are timestamped at the outlet in the LSL always uses its Quick aside: LabRecorder does not do this conversion and instead stores the clock offsets separately, so they can be used during file loading for a more accurate clock correction.
How are you measuring N1 latency? Events from LSL4Unity? What is your neural data source? |
I'm sorry, I use Neuroscan to record EEG and MATLAB to send events to Neuroscan, not Nuronlink. Normally, our N1 will be located at around 170 ms for most subjects, even in oddball or n-back tasks, based on our experience. To validate my process, I compare it with my EEG based on the LSL system. And it shows N1 appears after 200ms or longer, we consider it might be because my multiple devices' synchronization causes something to be wrong. I simply use the ERP profile to check the time N1 shows up between 2 conditions, and it did show our device based on LSL has longer latency. I am not sure what neural data source refers to. I use a handmade EEG headset from our lab, which will send EEG over LAN to the host PC. And Unity sends events to the host PC I use LSL from the LSL4Unity folder. just like the |
There are 2 sources of delay that are unknown:
If delay 1 is long and unaccounted for, this would actually push your N1 earlier so let's ignore that for now. For delay 2, this depends on if you're doing audio or video stimuli. For audio, Unity has terrible latency and variability (I don't know how Unity rhythm games work; they must use their own audio library). For video, it depends on if you're using single-, double-, or triple-buffering. The best thing you can do to characterize your latency is put a photosensor in your HMD (under a towel or something to keep it dark otherwise) and connect it to your signal acquisition system -- preferably through an aux input but you might be able to connect it directly to an electrode. |
Thank you, Cboulay. Sorry for the late reply. I use video stimuli for my task. I think what you describe is screen or video Synchronization from Timing Synchronization in EEG Experiments. I’ll definitely give that a try. If I see any improvement, I’ll let you know. Thanks again for the helpful suggestion! |
I am currently setting up an LSL (Lab Streaming Layer) connection between my Meta Quest Pro and my host PC. However, I am still facing issues with time synchronization in the inlet stream.
I have tried using
processing_flags=pylsl.proc_ALL
, but the problem persists. My implementation is based on theReceiveAndPlot.py
example.I have read the LSL time synchronization documentation, which mentions that a main clock is required to synchronize timestamps. I think I already applied my host PC clock.
I also tried using
time_correction
from theGetTimeCorrection.py
example, but I don't fully understand this part:Returns the current time correction estimate. This is the number that needs to be added to a time stamp that was remotely generated via local_clock() to map it into the local clock domain of this machine.
Should I simply use
local_clock() + timeout
?Here is my build-up:
My current code below
The text was updated successfully, but these errors were encountered: