Delay script while running eye tracker?
I'm writing an experiment in which participants are rewarded if their gaze is within an specified area end the end of random-length intervals between 4 and 7 seconds.
while(True): delay = 3*random.random() + 4 time.sleep(delay) sample = eyetracker.sample() inRangeBool = inRange(sample,sample) #returns True if the gaze is in the area of interest if inRangeBool: my_sampler.play() #plays a pleasant sound associated with the reward
I'm using the dummy mouse eyetracker. When the script gets to the time.sleep command, the mouse freezes and doesn't move until the sleep function ends, which suggests that the function puts the eyetracker to sleep as well. The sound still plays (or doesn't) at the end of the interval. How can I tell the script to wait for the specified amount of time without freezing the eyetracker?