Howdy, Stranger!

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

Supported by

Gaze-contingent script pausing

Hi all,

I am quite new to Pylink and Pygaze, so apologies if this question might come across as a bit naive.

I have set up a simple experiment which presents a sequence of images paired with a sound. I would like the trials to pause as soon as the participant (a baby) looks away from the screen.

I haven't been able to find any re-usable code with this purpose: I only have the vague intuition that it should be done with some native Pylink classes like tracker.getNewestSample() or Event.getRightEye().getGaze(). I am not sure at which point of the code this should be done, in other words how to make sure that at all times the program checks that the gaze is within the screen.

Thanks so much in advance for the help!!!

Comments

  • Hi,


    The commands you mentioned might work (but I don't know for sure). What does work is exp.pygaze_eyetracker.sample().

    If you call it you'll get back the current gaze coordinates. Those you can use to decide whether they are still in the limits of the screen or somewhere outside. Something like this will do:

    if gaze_x < left_edge_x or gaze_x > right_edge_x or gaze_y < top_edge_y or gaze_y > bottom_edge_y:
         # do stuff
    

    Only thing to keep in mind though is, to not to make this robust against individual samples being lost (for example during blinks). A quick heuristic could be for example to check the current position twice, separated from each other by 50 ms or so. If they gaze position is outside the screen for both, it is quite likely that participants are not looking at the screen.

    Hope this makes sense.


    Good luck,

    Eduard

Sign In or Register to comment.