My PI found a solution to the mysterious time lag
The default of kb.getKeys()
is waitRelease = True
and setting it to False
eliminates the problem.
To me the documentation of this argument is not totally clear, but it seems that with waitRelease = True
the RT is the starting time of the key press. time1 and time2, measured with kb.clock.getTime()
is about the sum of the RT and the duration saved with kb.getKeys()
. The execution of the kb.clock.getTime()
seems to wait until the key is released.
With waitRelease = False
the RT of kb.getKeys()
seems to be the starting time of the key press.
Here Jon explains the meaning of waitRelease
and I think it is more comprehensible than the documentation.
Thank you all for the discussion and help!!