Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

EyeTribe and coroutine

Good morning,

I wish to use EyeTribe with a Stroop task.

In order to fix the presentation time of the stimuli, I use a coroutine.

My goal is to record the reaction time for each stimuli. But I wish all stimuli are presented in equal time (I test attention and memory. For the memory task, it's necessary each stimuli are presented during the same time).

My problem is that Py Gaze do not work with a coroutine.

So here my questions :smile:

1) do you know a way to allow EyeTribe to run with a coroutine ?

2) Or, do you know another way than coroutine to record the reaction time with keypress and fix the duration time for each stimuli ?

Thank you very much for your answer !




  • Salut Céline,

    What kind of information do you want to have from the EyeTribe? Unlike most other eye trackers, the EyeTribe doesn't automatically log data. You really need to write your own script to get the eye movement data, and do something with it.

    So you'll have to be a bit more specific: From your question, it's only clear that you want to use the EyeTribe, but not what exactly you want to use it for.


  • Salut Sebastiaan,

    Thank you very much for your answer !

    I realize this is not so "plug and play" I hoped ;)

    I dare to ask you another question : do you have any idea where I can find a kind of template to write this script in OpenSesame ?

    Here the data I wish to record with EyeTribe : For each stimuli presented in each block, I want to record this information concerning all the fixations :

    • where (a fixation occures)
    • when (a fixation occures)
    • how much time (the fixation last)

    Thank you for your answer.



  • Hi Céline,

    In that case, it's probably best to simply log all gaze data, and then extract the information you want afterwards. The following is a generator function that you can specify in coroutines, that is, you simply enter the name of the function (collect_gaze_data). This function will then automatically retrieve samples, and write them to the log file.

    See also:

    This script should work, but there are two things that you probably want to improve, which I leave to you as an excercise:

    • Make sure that the logfile doesn't become a mess. (If you use this script in combination with a logger, you will get a messy logfile.)
    • Don't collect too many samples. It's possible that this script will retrieve samples at a much higher rate than the tracker provides, in which case you get a lot of duplicate samples in your logfile.


    def collect_gaze_data():
        # Write a start of trial message
        # Loop until coroutines is aborted
        while True:
            # Retrieve a sample and write it to the logfile
            x, y = eyetracker.sample()
            log.write('%s,%s' % (x, y))
            # Check if the coroutines signals a break
            keep_going = yield
            if not keep_going:
        # Write an end of trial message
Sign In or Register to comment.