Hi Catrina,
Every time MWorks receives new sample or event data from the EyeLink, it assigns the associated sample/event time (on the EyeLink clock) to the variable indicated by eye_time. If there are gaps in the values assigned to eye_time, it means there are gaps in the timing of the samples/events MWorks receives from the EyeLink. (If you want to see exactly where and how the assignment happens, take a look at this code.)
Given this, I’m a little confused by your plots. The units of EyeLink clock times (i.e. the values assigned to eye_time) are milliseconds, but your plots show typical intervals of 1000. Since you probably aren’t sampling eye position only once per 1000ms, I have to assume that the deltas in your plots are between the MWorks times associated with each assignment to eye_time. MWorks times are in microseconds, so a typical delta of 1000us would indicate a sampling rate of 1000Hz, which makes sense.
Another noteworthy feature of your plots is that each 2000us interval is always immediately followed by a 50us interval. If you are indeed comparing MWorks time stamps, then all this indicates is that MWorks periodically receives a sample “late” and ends up processing it at the same time as the next sample. For example, if you’ve set data_interval to 1ms, and the EyeLink is acquiring samples at 1000Hz, then MWorks may occasionally ask for a sample just before it’s available. It then waits 1ms before asking again, at which point both the just-missed sample and the subsequent sample are available. MWorks then processes these samples back to back, resulting in a very short interval (on the MWorks clock) between them. I see that the description of data_interval (which I did not write) says that it should be “faster than [the] tracker’s sampling rate”, perhaps to avoid just this sort of doubling-up of samples.
The fact that you’re comparing MWorks time stamps can also explain the “ramp up” you see at the start of the trial. When you start I/O on the EyeLink device, MWorks first tells the EyeLink to start recording and then spawns a new thread that periodically polls the EyeLink for new data. All the samples that the EyeLink records before the data-polling thread becomes active are received and processed together, so the MWorks time interval between them is very small.
A corollary to all this is that if, instead of comparing the MWorks time stamps of adjacent eye_time events, you were to compare the values of those events (which, again, are times on the EyeLink clock), you would see a consistent delta. If you didn’t, it would indicate that some samples were being lost.
All that said…
The result is that it’s very difficult to align/average pupil diameter across trials, as each diameter measure occurs at a different time point relative to stimulus onset.
I don’t know how you’re measuring stimulus onset time, but it’s very unlikely that it’s accurate to within less than a couple of milliseconds. As such, if you’re trying to determine the pupil diameter at stimulus onset, it would make sense to average several milliseconds worth of samples around the stimulus onset time. You might even want to average over the first full frame (or more) of the stimulus. Given this, I don’t see how an occasional delta of 1ms in the time stamp for an eye_time value matters to your analysis.
Cheers,
Chris Stawarz