Howdy, Stranger!

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

Supported by

Logging Fixation Start and End

Hello,

I am using the Gazepoint GP3 Eyetracker. I want to log all fixation starts and fixation ends of a trial. So far I have tried an inline Python script:

eyetracker.log("Fixation start:" + str(eyetracker.wait_for_fixation_start()) + "Trial number: ")

eyetracker.log("Fixation end:" + str(eyetracker.wait_for_fixation_end()) + "Trial number: " )

This works, but it only logs one fixation event. I want all fixation events of the trial. I already tried embedding this in a while True loop but then it either did not print anything or the experiment crashed.

Comments

  • Hi @doingMyBest,

    This function that you used, will wait for one fixation, and once it detected it, proceed with the experiment. If you have multiple fixations in a trial, you need to call the function repeatedly until the trial is over. Here some pseudocode:

    while trial_ongoing:
        eyetracker.log("Fixation start:" + str(eyetracker.wait_for_fixation_start()) + "Trial number: ")
        eyetracker.log("Fixation end:" + str(eyetracker.wait_for_fixation_end()) + "Trial number: " )
        if trial_break_condition == True:
             break
    

    Of course you need some more code in the loop to make the logic work.

    Hope this helps,

    Eduard

    Buy Me A Coffee

  • edited August 2024

    Hi @eduard ,

    thanks for your advice. What I tried to do now is defining a variable in my experimental loop which is set to True at the beginning of each trial and to False at the end of each trial. I tried to loop while this variable is True (while the trial ongoing) and the break condition is met when the variable is false (the trial is over) This is my code:

    while var.trial_start == True:

    eyetracker.log("Fixation start:" + str(eyetracker.wait_for_fixation_start()))

    eyetracker.log("Fixation end:" + str(eyetracker.wait_for_fixation_end()))

    if var.trial_start == False:

    break

    However, Python crashes every time I run this. Do you have any idea why this could be happening? I also tested this before I inserted this code block and the variable trial_start is correctly set. I also tried out the codeblock before embedding it in the while loop and it worked fine, but just logging one fixation.

  • Hi,

    Is there no error message? Could you try to eliminate your code bit by bit until Python doesn't crash anymore?

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.