OS: Windows 10 with Intel Graphics
PsychoPy version: 2022.2.x
Standard Standalone?: yes
What are you trying to achieve?:
I am working on some tests involving mouse responses. In the process of trying to maximize the precision of this timing, I have identified multiple strategies to acquire reaction time on mouse click.
Option 1 (built-in). In the Data tab of mouse component use the following settings:
-
save mouse stateis set toon click -
time relative tois set tomouse onset -
save onset/offset timesandsync timing with screen refreshkeep default values
Option 2 (coded). A code component contains the following code:
- In Begin Routine:
mouse.clickReset()
mouse_clicked = False
- In Each Frame:
if 1 in mouse.getPressed() and not mouse_clicked:
rt = mouse.mouseClock.getTime()
mouse_clicked = True
- The javascript version is auto-translated with no modifications
There are timing discrepancies between these two options.
When running the experiment in Standalone PsychoPy, Option 1 (built-in) is 3 to 10 ms slower than Option 2 (coded).
What did you try to make it work?:
- I tested whether this discrepancy was related to screen synchronization by toggling the
sync timing with screen refreshoption. Regardless of whether this option is/is not checked in the the mouse component, I still observe the 3-10ms discrepancy between the built-in and coded options. - I tested whether this discrepancy was consistent across Python and Javascript. In standalone Psychopy, Option 1 (built-in) is 3 to 10 ms slower than Option 2 (coded). In Javascript (run using the
run JS for local debugoption), Option 1 (built-in) is 1 to 6 ms slower than Option 2 (coded).
Do others also experience this difference between Option 1 and Option 2 timing?
I find this difference between built-in and coded mouse timing interesting, as I would expect manually coded RT recording to be slower than the built-in recording. I am wondering if it has something to do with mouse.time acquiring the timing information in a different manner than using mouse.mouseClock.getTime(). I reviewed the PsychoPy API, but was unable to find descriptions on how mouse.time differs from mouse.mouseClock.getTime(). I am interested to hear if anyone has insights into the differences between mouse.time and mouse.mouseClock.getTime() as well as the differences between JS and Python for timing (the discrepancy was much smaller in JS).
Thank you ,
shabkr