I wanted to check whether there is a difference between “t” and a self-generated clock (myClock) in the ‘beginn routine’ tab of a code component.
Therefore I generated 3 variables: t, myClock (generated in Begin Routine tab of a code component), and the difference between them t - myClock.getTime()
When I put these three variables in three text components (set every frame) then I get a difference score between t and myClock (always around 0.015…ms) which should not be the case because both should start at the beginning of a routine?
I am preparing a timing experiment and at the moment I don’t know what can be recommended in this case.
Thank you very much.
Which one is higher?
0.015s is one frame so I suspect that one clock is starting before frame 1 and the other is starting at the end of frame 1 (assuming you record both times in the End Routine).
I find that t in End Routine is usually about 15ms greater than the recorded reaction time of a keyboard component, so I tend to record reaction times in Each Frame code instead of End Routine when I have mouse/touchscreen responses.
This sounds like a good area for a demo.
Thank you for the reply!
t is higher.
In my case t is the variable that psychopy generates at the beginning of a routine (Clocks and trial counters — Workshops for PsychoPy 2021 2021)
I recorded t and myClock in Each Frame.
Based on your response it takes 1 frame for PsychoPy to generate myClock?
So t which should start at beginning of a routine and myClock which should also start at the beginning are slightly different. A mixture of t and myClock.getTime() in code of Each Frame would potentially be problematic.
You could try resetting myClock in End Routine of the previous routine.
It’s generally better to create clocks at the start of the experiment and then reset them when needed using myClock.reset()