Welcome! Log In Create A New Profile

Advanced

eye_.XYData

Posted by Pawel 
eye_.XYData
February 02, 2024 04:50PM
Hi all,

I am trying to programmatically access Analog Data, specifically eye data of the current trial while the trial is still ongoing. Is this possible and if yes, how?

I understand that eye TrialRecord.LastTrialAnalogData is filled only after the trial completes, so too late for me.

I have been looking at eye_.XYData, but the docs say "An n-by-2 XY position matrix in screen pixels" while I would need degrees. I understand that this could be solved with the EyeCal object, correct?

Another issue is that when I experimented with it, I expected XYData to contain a long two-column array with eye position sampled every ms. But I got only 1 x 2 vector, as if the field stored only the most recent pair of coordinates. Is that true and then what the n in n-by-2 stands for, and how to get the entire trace?

Or is it only the side effect of me trying it in the simulation mode for now, and with an actual eyetracker I would get a long 2 column array?

And finally, if this will be a long 2-column array, what time point in the trial does the first row of that array represent?
Re: eye_.XYData
February 02, 2024 05:19PM
You got only a 1-by-2 vector, because you ran the task in the simulation mode. You will get a long 2-column matrix with an actual eye tracker.

To get the data that is being collected in the current trial, use get_analog_data(). The function returns a given number of samples acquired most recently.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#get_analog_data

The function does not tell you when each sample was acquired, but, since the sample rate is 1 kHz, you can derive the time of each sample from the current time.
t = trialtime;
data = get_analog_data('eye', 300);  % return 300 samples from time t
Re: eye_.XYData
February 02, 2024 07:57PM
Thank you, Jaewon! It seems that this is exactly what I needed.

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.