Open scott-huberty opened 3 days ago
Naively I would expect our reader to proceed line by line looking for START
and parse until it hits a START
or END
block (formerly just END
but we can assume if there's a START
, it's like hitting an END
and another START
), in other words, it seems like it should be fairly easy to handle this case?
I don't think that would quite work because our reader can't currently parse the lines that are written between an END
block and the next START
block. So if there is no END
block, our reader will try to parse these lines and error out (as in the case of the aforementioned researcher).
Usually the lines that are written in these non-recording blocks contain system information and/or information about a Calibration sequence (EyeLink will always stop recording gaze/pupil samples during a calibration sequence.. So if a user kicks out of an experiment to re-calibrate, an END
block should occur followed by information about the Calibration).
Calibration blocks in ASCII files look like this:
>>>>>>> CALIBRATION (HV5,P-CR) FOR LEFT: <<<<<<<<<
MSG 7446696 !CAL Calibration points:
MSG 7446696 !CAL -46.3, -67.7 -0, 400
MSG 7446696 !CAL -48.8, -97.0 -0, -2854
MSG 7446696 !CAL -44.1, -38.3 -0, 3436
MSG 7446696 !CAL -111.0, -64.9 -5990, 400
MSG 7446696 !CAL 14.6, -61.2 5990, 400
MSG 7446696 !CAL eye check box: (L,R,T,B)
-124 27 -103 -32
MSG 7446696 !CAL href cal range: (L,R,T,B)
-8985 8985 -4427 5009
MSG 7446696 !CAL Cal coeff:(X=a+bx+cy+dxx+eyy,Y=f+gx+goaly+ixx+jyy)
-0 95.801 -7.7092 0.054973 0.022975
400.06 -3.604 107.47 -0.12785 -0.13718
In the case of our user, an END
block is missing right before they initiated a calibration. Knowing that calibrations occur outside of recording blocks, one idea is too adjust this if-condition to check if the line is the start of a calibration block. Something like:
if tokens[0] == "END" or tokens[1] == "CALIBRATION": # end of recording block
is_recording_block = False
Which should solve the problem for the researcher, at least.
Description of the problem
A researcher has reported that their file breaks
read_raw_eyelink
. I'm reporting the details below, so apologies in advance for the lengthy explanation:Problem
In the specification for their ASCII format, EyeLink states that recording periods (where gaze/pupil data are actually being recorded) should always be demarcated by “START” and “END” lines, as shown below:
For us, this is important because lines in the ASCII file that occur outside these
START…END
recording sections are unstructured and, IMO, are difficult to parse.In other words,
read_raw_eyelink
looks for theSTART
events, and parses lines until it hits anEND
event. Per Eyelink's specification, we always assume that any givenSTART
event will eventually be followed by anEND
event (before anotherSTART
event occurs).This assumption has held up until now. In the problematic file that the researcher shared, it looks like one of the recording blocks in the file is missing an “END” event, resulting in a format like:
So what happens is that for the block that is missing an
END
event,read_raw_eyelink
tries to parse lines would typically occur outside recording blocks (specifically, these lines contain information about an eyetracking calibration), and thus that it is not prepared for. This breaks the reader.I'm not sure how easy it will be to make our reader robust to this case. I might try some other EyeLink ASCII readers out there to see if they are able to read the file. In the mean time I'm opening this ticket so that we have a record of it.
Steps to reproduce
Link to data
https://drive.google.com/drive/folders/15SpQuoXZlmH6ZBLcOEoc4nzEA7ewoHuK
Expected results
a raw object
Actual results
Additional information
https://mne.discourse.group/t/mne-io-read-raw-eyelink-failure-adjust-times-sub-function-does-not-work-cant-merge/9012