TheAxonLab / hcph-sops

SOPs of the HCPh project
https://www.axonlab.org/hcph-sops/
Creative Commons Attribution 4.0 International
0 stars 6 forks source link

`_eyetrack.json` wrongly define `StartTime` and `StopTime` #354

Open oesteban opened 10 months ago

oesteban commented 10 months ago

For the first session we have:

{
    "StartTime": 5549944.0,
    "StopTime": 7350028.0
}

And the data:

In [1]: import pandas as pd

In [2]: pd.read_csv("/data/datasets/hcph/sub-001/ses-001/dwi/sub-001_ses-001_acq-highres_dir-LR_eyetrack.tsv.gz", sep="\t", index_col=None)
Out[2]: 
         5549944.0         289.5         566.0  5881.0  0.0  0.0.1  0.0.2
0        5549945.0  2.892000e+02  5.664000e+02  5877.0  0.0    0.0    0.0
1        5549946.0  2.889000e+02  5.669000e+02  5872.0  0.0    0.0    0.0
2        5549947.0  2.886000e+02  5.675000e+02  5867.0  0.0    0.0    0.0
3        5549948.0  2.885000e+02  5.673000e+02  5866.0  0.0    0.0    0.0
4        5549949.0  2.883000e+02  5.668000e+02  5865.0  0.0    0.0    0.0
...            ...           ...           ...     ...  ...    ...    ...
1800079  7350024.0  1.000000e+08  1.000000e+08     0.0  0.0    1.0    1.0
1800080  7350025.0  1.000000e+08  1.000000e+08     0.0  0.0    1.0    1.0
1800081  7350026.0  1.000000e+08  1.000000e+08     0.0  0.0    1.0    1.0
1800082  7350027.0  1.000000e+08  1.000000e+08     0.0  0.0    1.0    0.0
1800083  7350028.0  1.000000e+08  1.000000e+08     0.0  0.0    0.0    0.0

[1800084 rows x 7 columns]

This is suspicious as the recording starts before the task kicks in (more so in the case of the DWI where the first trigger happens with calibration). For these files to be useful, StartTime and StopTime cannot be trivially set to the first and last timestamps of the array.

esavary commented 10 months ago

Can you clarify what you're expecting in StartTime? Currently, it marks when the eye-tracker recording begins. The value of the timestamp for DWI seems fine to me—I checked it from the EDF file messages. The task started at 5549930 ( These values are relative to when the eyetracker was started) , and eye-tracking kicked in at 5549944. You can double-check in the bidsphysio Docker image output, specifically in 'sub-001_ses-001_acq-highres_dir-LR_eventlist_raw.tsv.' The timestamp 5549944 matches the message '!MODE RECORD CR 1000 2 0 R,' which I believe signals the start of recording.

oesteban commented 10 months ago

Currently, it marks when the eye-tracker recording begins.

Which is moot, because by this definition it's going to be the first and last rows in the timestamp column (the first). The problem is that the BIDS specification (or the BEP in this case) is very clear that StartTime and StopTime indicate the timestamp when the run started and ended. This is clearly NOT when the ET starts recording and stops recording, but rather when the first trigger kicks in and when the last volume of the dwi/fmri is acquired.

Without appropriate StartTime and StopTime we cannot synchronize the MRI experiment with the eyetracking recording.

esavary commented 10 months ago

Ok, the concept of 'run' in the context of the eye-tracker was a bit unclear for me. Regarding StartTime, we can use the timestamp linked to the onset of the psychopy task. However, pinpointing the exact timestamp of the last volume in the eye-tracking (ET) data will be challenging. We can, however, retrieve the end of the psychopy task, even though it might not be perfectly synchronized with the final volume in the ET data.

oesteban commented 10 months ago

If StopTime cannot be identified, then we should not set it in the json. For StartTime yes, we do want to set it to the timestamp of the start task message.