aeye-lab / pymovements

A python package for processing eye movement data
https://pymovements.readthedocs.io
MIT License
57 stars 11 forks source link

add support for binocular eyelink parsing #686

Open dkrako opened 4 months ago

dkrako commented 4 months ago

Description of the problem

The lines of binocular and monocular eyelink recordings vary, as they have more data fields for each eye tracker sample.

Description of a solution

Currently only the regex for monocular samples is defined as EYE_TRACKING_SAMPLE in utils.parsing. This should be renamed into EYE_TRACKING_SAMPLE_MONOCULAR and a new EYE_TRACKING_SAMPLE_BINOCULAR for binocular data should be created.

There is a regex implemented in #674 which checks sampling rate and which eye is tracked: r'SAMPLES\s+GAZE\s+(?P<tracked_eye>LEFT|RIGHT)\s+RATE\s+(?P<sampling_rate>[-]?\d*[.]\d*)\s+TRACKING\s+....

In case of a binocular recording, the file will contain two lines for each tracked eye.

The metadatafield tracked_eye will currently only have LEFT or RIGHT, but in the binocular case it should be set to BOTH internally.

You should check early on which of the two regular expressions for the eye tracking samples should be used for the remaining file.

The parsing will have to be changed a bit then, by parsing header information first and only after having read the SAMPLES\s+GAZE\s+... line(s) the eye tracking sample would be checked too (EYE_TRACKING_SAMPLE_MONOCULAR or EYE_TRACKING_SAMPLE_BINOCULAR).

A simpler alternative is to always check for both samples, but I guess this would be much slower for one of the two cases (e.g. in case EYE_TRACKING_SAMPLE_MONOCULAR is matched first, binocular files would parse slower as the line has to be matched a second time with EYE_TRACKING_SAMPLE_BINOCULAR).

Minimum acceptance criteria