psychopy.org | Reference | Downloads | Github

How does getKeys() obtain events?


#1

Hi guys,
I don’t understand the timestamp argument of the getKeys() function. Does it work on top of a parallel event system that logs and reports timestamps independently from the monitor’s refresh rate ? If not, what is the purpose of this option ?
Cheers,
Mathieu


#2

The timeStamped param in event.getKeys allows you to control the baseline timestamp for your key presses. If you do not pass a time stamp, or timeStamped is False, you only receive the key pressed. If time stamp is True, you receive the time of the keypress relative to the start of the experiment, as defined by core.monotonicClock, which is a clock object deliberately designed to return time relative to the onset of the experiment. If you pass a clock object (e.g., core.MonotonicClock) as the timestamp, the timestamp will be relative to the last reset of that clock object.


#3

And just to clarify, the time stamp (on whatever baseline you choose) is not of the time the key was actually pressed, but of the time that you call the getKeys() function.

The actual keypress time can be read, independently of the refresh rate, using the iohub library, but developers are currently working on making such an ability available as easily as the current getKeys() approach.


#4

Thanks guys for the clarification. Yes, it’d be awesome to have such an ability available as easily as the current getKeys() approach.