psychopy.org | Reference | Downloads | Github

Inconsistent reaction times from log file and csv

Dear community,

I ran an experiment from the builder (with default settings), and it gave me a log file and a csv file. I tried to compare reaction times from both files (for log file, computing the time of keypress minus the time that the keyboard is initiated, for csv file, just picked the key_resp.rt), and found the two numbers were different, the rt based on log file (keypress - initiation time of keyboard) was always longer than key_resp.rt from the csv file. Do you have any idea why there is a lag, and if the key_resp.rt is more accurate?

Thanks in advance!

In the experiment the task is to press ‘g’ whenever there is a text on the screen. The onset time of the keyboard component is set as the same as the text onset.

In the log file, I found the time for the two component:

9.3396 EXP text: autoDraw = True
9.9398 DATA Keypress: g

In the csv file, related to this keypress, it says:

key_resp.rt
0.600397

I assume the rt from the log file should be the same as the one in csv file, however, there is a around 0.2ms difference between the two, which is hardly explained by rounding error. In some other trials, the difference can reach several ms.

Please forgive me about my basic questions. Has anyone compared the two rts from the two files? For the calculation of key_resp.rt, does it use the keypress time from the log file as the end time? If not, how can I record the data that are used to calculate the rt in the csv files?

Any comment is appreciated.

I’m not exactly sure what caused the difference. Was this using the old event.getKeys() or the new Keyboard object?

But 0.2ms is not a thing to worry about. 200 microseconds constant lag will be dwarfed by your participant variability and the latency of your keyboard.

Thanks for your reply, jon!
These responses are recorded based on a keyboard component from the Psychopy 3.2.3 builder, and they are key_resp.getKeys.
I find that the log file and csv file provide the same text onset time. I wonder if the ‘Keypress’ time from log file is the one to calculate the rt in the csv file? If so, the rt difference between the two files might be due to the small inconsistency that the keyboard is initiated (or the text onset time, because they are defined to be the same) in the local time vs. global time, right?
Another question is how to define the time in the logfile to have more digits after the decimal?

No, really, you don’t need more decimal places. The precision of the measurements is roughly a millisecond (actually not as good as that if you’re using a keyboard). Adding more decimal places won’t make it more precise. It will just add some random numbers (microseconds) at the end. Your measurements do not need microsecond precision, or if they do, you’ll need some different hardware.

I see, thank you!