Get X-coordinates of a moving stimulus according to the timestamp
I am currently running an experiment of smooth pursuit in which participants have to track a stimulus moving along the horizontal axis (gaze position is recorded thanks to a Tobii X3-120 eyetracker).
I am relatively beginner in python but I succeeded in modifying one of the inline script that I found in the forum :
import math from openexp.canvas import canvas amp = 445.5 # Vibration amplitude (pixels) freq = .5 # Vibration frequency (Hz) T = 1000. / freq # Vibration duration is derived from frequency duration = 16000 # Duration of the smooth pursuit my_canvas = canvas(exp) t0 = self.time() while True: # Draw the smooth pursuit target t = self.time() - t0 dx = amp * math.sin(((t % T)/T) * 2 * math.pi) my_canvas.clear() my_canvas.fixdot(x=0 + dx) my_canvas.show() if t >= duration: break self.sleep(10)
The task works well and in my output, I get a .tsv file in which I can retrieve the timestamp and the X gaze position of the eye.
I just would like to know whether it is possible to add in the .tsv file (or in another output file) the x position of the target (and potentially the velocity of the eye and of the target) according to the timestamp ?
Thanks in advance for your help,
Do you mean in the same data table as the gaze coordinates? It might be possible, but for that you better ask the Tobii people whether the eye tracking logs can be enhanced with behavioral variables. I know that this is possible for the eyelink eyetracker, so it might be possible for tobii as well.
Apart from that, you could store on every iteration of your while loop the current time and position of the stimulus. For example:
The problem here is that your log file will become bit messy for that variable (essentially you are saving a list into a single cell of an excel sheet). So when you analyse the data, you need to spend a bit more effort to get the data. Nothing terribly complicated, but still something to keep in mind.
Thank you for your quick reply !
Yes indeed this is what I want, but you're right, the Tobii people should have this information. But I thank you for your advice and for the modified code!