Hi, I’m trying to get the timing of a series of stimuli in order to check the precision of my experiment. I’m wondering if this approach is reasonable:
from psychopy import core, visual
win = visual.Window(fullscr=True, color='black', allowGUI=False)
stim = visual.TextStim(win, text="Stimulus")
mask = visual.TextStim(win, text="Mask")
stim_clock = core.Clock()
stim_dur = 0
def get_time():
global stim_dur
stim_dur = stim_clock.getTime()
win.callOnFlip(stim_clock.reset)
for frame in range(3):
stim.draw()
win.flip()
win.callOnFlip(get_time)
for frame in range(5):
mask.draw()
win.flip()
In this way, I should be able to get the correct timing right? The results seem ok (I’ve done it 1000 times and then averaged the result). My main doubt is that I’ve seen a lot of coding examples like this:
# setup screen and stimuli
clock = core.Clock()
win.callOnFlip(stim_clock.reset)
for frame in range(3)
stim.draw()
win.flip()
win.flip() # this is not compatible with my approach
stim_dur = stim_clock.getTime()
But I need the second stimulus immediately after (no blanks), so my only idea was to use win.callOnFlip()
also for getting the time given that it always return None
.
What do you think?