Hi community,
I have just collected data from a flanker task. Responses were given on the keyboard. Below is the critical part of my code (stimulus display and RT recording):
> timer_RT =core.Clock()
> Routine = True
> event.clearEvents(eventType='keyboard')
> win.flip() # display stimulus
> timer_RT.reset()#reset clock
> while Routine:
> key_press = event.getKeys(keyList=["f", "j"])
> if len(key_press) > 0:
> if (key_press[0]=="f") or (key_press[0]=="j"):
> RT = timer_RT.getTime()
> Routine = False
> win.flip()#response given, remove stimulus
Note that I am continuously polling the keyboard to increase RT precision, similar to what the event.waitKeys() function does. Some time ago, Michael advised me to incorporate a time.sleep (0.001) to let CPU breath, but our OS is windows 10 , and the minimum possible time.sleep is ~13ms (and this latency is not constant, see manual of the time library). So I removed it, check the CPU workload, which was only 57%.
My data look clean, but RTs appear a little slow. The keyboard is already a polling device, and I am wondering if my code is really correct. This stuff is driving me crazy. Could you (i) shed light on this issue and (ii) indicate the amount of distortion (if any) in my data?
Many thanks!