Hi all,
I am coding an fMRI experiment and need to measure trigger time (emulated as key press) as accurately as possible. I have compared recoding the time from psychtoolbox GetSecs() and clock.GetTime() with the .rt values from kb.waitKeys. There is a discrepancy of around 60-70 ms between both methods and I am trying to figure out which value is the more precise one. Would anyone now?
Thanks and best,
Jasmin
trigger_kb = keyboard.Keyboard()
ptb_start = ptb.GetSecs()
trigger_kb.clock.reset()
keys = trigger_kb.waitKeys(keyList=[‘t’], waitRelease=False)
key_ptb_time = ptb.GetSecs()
key_rt_clock = trigger_kb.clock.getTime()
key_rt_kb = keys[0].rt
diff = key_ptb_time - ptb_start - key_rt_kb
print(f"key.rt: {key_rt_kb:.6f} s")
print(f"clock.getTime: {key_rt_clock:.6f} s")
print(f"PTB timestamp: {key_ptb_time - ptb_start:.6f} s")
print(f"Difference: {diff:.6f} s")