Dear community,
I stumbled over a funny behavior that I don’t quite make sense of. Perhaps someone could it explain it to me.
It seems like that after core.wait()
is called, the first few win.flip()
s are really short, much shorter than the refresh rate of my monitor would allow. The exact number of how often this happens varies (some times only two flips, sometimes 5-6), I couldn’t find a system in it yet.
Here is some example code that illustrates the problem. The only difference between the two loops is whether the core slept or not.
from psychopy import visual, core
win = visual.Window(color=(0,0,0),fullscr=1, units="pix")
exp_frames = round(0.15*60) # 0.15 seconds at 60Hz
for i in range(4):
core.wait(0.995)
print("core slept.".format(i=i))
for frame in range(exp_frames):
t1=core.getTime()
win.flip()
print("frametime: ", core.getTime()-t1)
for i in range(4):
print("core did not sleep.".format(i=i))
for frame in range(exp_frames):
t1=core.getTime()
win.flip()
print("frametime: ", core.getTime()-t1)
win.close()
core.quit()
As I can rather easily program around that issue, it is more of theoretical relevance. But still, I’d like to understand what is going on here.
Thanks,
Eduard