[open] Help with eye-tracking programming...
Hi all,
I am working on an eye-tracking project using the EyeTribe tracker and have started editing the "Pygaze Eyetracking Template" included with the Pygaze plugin for Opensesame. What I would like to do for this project is be able to record the gaze coordinates from the subject while they trace an object in the sketchpad (i.e. A triangle in this situation) and compare these coordinates to the actual coordinates of the lines making up the triangle. The purpose behind this is to be able to measure the saccades that the subject is experiencing while tracing this object and determine if they are suffering from a neurological issue. I have VERY little knowledge about programming and therefore am having several problems trying to code this experiment. The problems I am having currently are:
- Adding an "instruction" that asks the subject to "trace the object shown on the screen"
- Somehow determine the actual coordinates of the triangle I have drawn (all coordinates lying on the line)
- Make it so that you can press a key to end the experiment once the subject is finished tracing
These are the problems I have come across so far. If you have any other suggestions or advice that will make this experiment better, feel free to share! Thank you so much for your help!
Shelby
Comments
Hi Shelby,
First of all, 2 out of your 3 questions are not really related to pygaze or eyetracking in general. Therefore, I believe you can gain much more insight, if you checked out one of the general OpenSesame tutorials, like the step-by-step tutorial for example. In that one, both your first and your last question will be answered.
This question is slightly more tricky. Also the most efficient implementation depends on what you actually need. For example, if you need to access eye positions and line coordinates of the circle online, that is, during the experiment, you would have to present the stimuli and sample the coordinates from within an
inline_script
(e.g. like so). However, if you only need this kind of information for the analysis of your data, you don't have to bother with it now in the experiment. You'll be better off, taking care of it later.Does this clear things up?
Good luck,
Eduard
Thank you so much for your quick response!
I visited the tutorial that you suggested and it cleared some things up. I have been running my program and am confused as to why after the practice and experimental rounds the feedback screen keeps displaying: Accuracy: 0%. What is that supposed to be measuring? Secondly, at the beginning of each trial I select the subject number and the destination to save the data and at the end of the trial, I open up the data file and its empty. How do I get data? I am using the same template as before and haven't really changed much so I don't understand why its not collecting any data from the trial. The data I am looking for is the subject's gaze coordinates as they are tracing the object drawn in the sketchpad. Can you offer any advice for how to fix this problem? Thank you!
Shelby
Hi Shelby,
If you included a
feedback
item in yoursequence
, it will automatically keep track of reaction times and accuracy. For this purpose, OpenSesame has internal variables that keep track of given responses and the predefined correct ones, based on which accuracy is calculated. However, this requires that you define correct responses. If you don't do it, the accuracy value will be nonsense.Getting data includes two steps. First, you have to collect responses. There are many different ways, most of which are described here. Second, you have to log the responses. This is done with the
logger
item. In principal, all you need to do is dragging the logger at the position of yoursequence
, where you want to have it. and every time it is run, it will save all the data belonging to this trial, in a file, that is created during the initialization of the experiment. In general, you don't need to define or open any files to create or log the data.in your specific case, eye tracking changes things a little bit. In this sense, you need to use eye tracking items, like
init
,drift_correct
orlog
to record all the information. To learn more about this, see the pygaze documentation. Or this small tutorial.In short, you need an
inline_script
, in which you call the sampling function of the eye tracker repeatedly in aloop
, and write these eye positions to the log file (either the one that is created by the eye tracker, or the OpenSesame internal file.I hope this (and the links) helped. If not, just ask again. In this case, you could provide a few more information on the issues you encounter. Maybe a screenshot of your structure, an error message, a snapshot of the code that is unclear, or anything that is relevant to the issue.
Good luck,
Eduard
To further @eduard 's comment: the gaze data should be saved in a separate file, depending on which tracker you use this will either appear in the same directory as the other data file, or in the main OpenSesame directory (EyeLink oftentimes does this).
So you don't have to manually get and write each sample to your log. What you will want to do, is use the PyGaze
log
item to add information about your experiment to your gaze data file, e.g. when the screen changes (fixation, stimulus is displayed etc.) and what stimulus is being displayed (e.g. the filename of an image you are showing).Good luck!