Howdy, Stranger!

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

Supported by

gaze/fixation-dependent start of trial

Hi!

I am trying to adjust my open sesame experiment (working with an eyelink eye tracker) so each trial starts only after the subject has fixated the central fixation dot for 200 ms (100 samples):

  • If there is a 200ms fixation on the central dot I want to start the trial, with a delay of 50 ms.
  • If he/she does not I want the experiment to pause at the fixation display, with the possibility to recalibrate pressing "q".

With the pygaze_drift_correct tool does part of the job but I'm unable to control the timing of the fixation or how strict I want to be to accept a certain eye position as sufficiently close to the fixation point.

I hence tried the following inline script (at the start of the sequence element, before the tracker starts recording). It does not give compilation errors but it does not do what I want either. Even when the subject is fixating it stays stuck on the fixation till I press "q" two times in a row (first time to get into the calibration menu, second time to exit the calibration menu) and only then continues with the rest of the trial. What am I doing incorrectly? If anyone has example code for a fixation-contingent sequence they could share that would be helpful too.

Thank you very much,

Louisa


####

checked = fix_triggered_drift_correction(pos=None, min_samples=100, max_dev=80, reset_threshold=30)

if checked == True :

self.sleep(50)

else:

print "recalibrate?" #for testing purposes

###

Comments

  • Hi Louisa,

    I don't know this function and what it does. But if it is sampling gaze position, you have to record, I think (though not sure). I did something similar in the past, and my code was in between start and stop recording (pygaze plugins). So, I suppose your experiment gets stuck in that function, because it doesn't get any gaze information, but that is just a hunch. If you wish, I can also share the code that I used to ensure fixation prior to a trial.

    Eduard

  • edited November 10

    Thanks Eduard!

    Just moving my inline script doesn't work (the function fix_triggered_drift_correction is a pygaze function and gives an error when it is put after the start recording pygaze plugin).

    For now I have things working with a pygaze_drift_correct plugin before every trial, but it is more strict than I would like it to be. If you have code that allows one to specify how strict one wants to be to accept a certain eye position as sufficiently close to the fixation point, sharing it would be very helpful.

    Louisa

  • Hi Louisa,


    here the code I used, basically measuring the distance of the fixation to a reference location over some time.

    # check whether a fixation is on black ring in the beginning of the trial. Rather liberal
    # automatically continue unless no fixation occurred
    # dist() is a user-defined function measuring the euclidian distance between two dots 
    tw = clock.time()
    while dist((var.curfix_x+var.width*0.5,var.curfix_y+var.height*0.5),exp.pygaze_eyetracker.sample())>var.ROI:
       if clock.time()-tw >5000:
          var.accFix = 0
          warning_cv.show()
          clock.sleep(1000)
          break
    


Sign In or Register to comment.