| Reference | Downloads | Github

How to create a clock that is relative to the beginning of the experiment?

Win10, PsychoPy version 2020.2.5, standalone.

What are you trying to achieve?:
I’ve build a visuomotor rotation experiment but now I’m struggling with some of the timers. I’m using the start time of some of my components and I need to align this start time with an event (movement onset).

What did you try to make it work?:
I used core.Clock as my clock for the movement onset. But apparently this clock starts counting at the time it has been created and not at the beginning of the experiment (like the component clocks do). I tried resetting my clock to the global time (by using the win.FutureFlipTime(clock=None), which is what the component clocks are set to) but this didn’t work. I also tried creating my clock at the beginning of the experiment, which decreased the difference between the component clocks and my own clock but it didn’t align the two times. I also tried using core.motonicClock but it works differently than the other clocks and I don’t understand how to extract the time from it…

So I got a step further. I now used the win.FutureFlipTime(clock=None) to reset my own clock to the global time that the components in my routine are using (I’m doing this in a code component in the “begin routine tab”). This, however, gives me decreasingly negative times. The timing actually looks right but I don’t understand why it’s negative. If I print the times of win.FutureFlipTime(clock=None) and of tThisFlipGlobal (which should be the same variable according to the Coder), tThisFlipGlobal gives me positive values and win.FutureFlipTime(clock=None) gives me the exact same ones with a minus in front of it. Can anyone help me or explain to me what’s happening here?

Hi there,

this thread might be helpful. Saving stimuli time from the beginning of the experiment - #8 by Becca

This is great, thank you! I already figured out parts of it but your reply to the thread explained it all in detail.