OS (e.g. Win10): Win11 Pro
PsychoPy version (e.g. 1.84.x): 2021.2.3
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
I have an image component whose onset and offset times are automatically recorded by PsychoPy. I also need to send a trigger about this onset and offset to another device, and I’ve been doing this using:
time_fn = core.MonotonicClock()
The onset/offset saved automatically and the one I create using this fuction have a difference, that messes with my triggers.
I need to know the time function with which PsychoPy calculates its timing, to use it in my code.
Each frame, the following is called:
t = trialClock.getTime()
t is used for the start/stop times of stimuli, the difference you’re seeing is most likely because your clock is defined at the start of the experiment rather than the start of the routine. If you use
trialClock rather than
time_fn then it should line up.
Hey @TParsons, although the
trialClock is working, it doesn’t seem to be the clock from which the onset/offset times of the image components come from.
The onset/offset times (ex. image.started and image.stopped) are not dependent on the “trial” they are on, rather they seem to come from a clock that starts at the beginning of the experiment and goes on to the end.
I also tried
core.Clock() as the function I define at the beginning of the experiment, instead of
core.monotonicClock(). Its difference is less, but still it’s not the same as the default timings.
Can you please tell me what the main clock function for each experiment is?
The timing for
Key_Resp.rt also comes from that default clock,
so I really need to know its function and how I can access its timing.