# Inconsistent reaction times from log file and csv

**URL:** <https://discourse.psychopy.org/t/inconsistent-reaction-times-from-log-file-and-csv/9229>\
**Category:** Builder\
**Tags:** timing\
**Created:** [September 29, 2019, 10:21pm UTC](https://discourse.psychopy.org/t/inconsistent-reaction-times-from-log-file-and-csv/9229 "2019-09-29T22:21:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mingzhu](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@mingzhu](https://discourse.psychopy.org/u/mingzhu)\
**Post date:** [September 29, 2019, 10:21pm UTC](https://discourse.psychopy.org/t/inconsistent-reaction-times-from-log-file-and-csv/9229/1 "2019-09-29T22:21:31Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![mingzhu](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@mingzhu](https://discourse.psychopy.org/u/mingzhu)\
**Post date:** [October 1, 2019, 4:34pm UTC](https://discourse.psychopy.org/t/inconsistent-reaction-times-from-log-file-and-csv/9229/2 "2019-10-01T16:34:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [October 2, 2019, 9:30am UTC](https://discourse.psychopy.org/t/inconsistent-reaction-times-from-log-file-and-csv/9229/3 "2019-10-02T09:30:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mingzhu](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@mingzhu](https://discourse.psychopy.org/u/mingzhu)\
**Post date:** [October 2, 2019, 4:01pm UTC](https://discourse.psychopy.org/t/inconsistent-reaction-times-from-log-file-and-csv/9229/4 "2019-10-02T16:01:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [October 2, 2019, 4:17pm UTC](https://discourse.psychopy.org/t/inconsistent-reaction-times-from-log-file-and-csv/9229/5 "2019-10-02T16:17:27Z")

</div>

> [@mingzhu](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![mingzhu](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@mingzhu](https://discourse.psychopy.org/u/mingzhu)\
**Post date:** [October 3, 2019, 3:19am UTC](https://discourse.psychopy.org/t/inconsistent-reaction-times-from-log-file-and-csv/9229/6 "2019-10-03T03:19:10Z")

</div>

I see, thank you!

---

<div class="post-metadata">

**Author:** ![jasmin\_st](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jasmin\_st](https://discourse.psychopy.org/u/jasmin_st)\
**Post date:** [August 16, 2022, 9:22am UTC](https://discourse.psychopy.org/t/inconsistent-reaction-times-from-log-file-and-csv/9229/7 "2022-08-16T09:22:37Z")

</div>

Hello everyone!

Answering to this thread because I am facing the same problem: key\_resp.rt and the time difference calculated from the automatic log file do not correspond. However, in my case, the divergence is not only a fraction of a ms but up to 30-50 ms. Does anyone else also experience this? What might be reasons and how exactly are the timings in the automatic log calculated?

Thanks a lot for your help!
