psychopy.org | Reference | Downloads | Github

Presentation time in frames not working

Hi,

I’m coding a new experiment and have a really strange bug that I haven’t seen before. I used to always control the presentation time of items on the screen by flipping the window a certain amount of times, depending of the refresh rate of the monitor. So if I want to present a fixation cross on the screen for 500 ms. with a 60Hz monitor:

fixCross.setAutoDraw(True) # Draw a fixation cross

for i in range(30):        # Flip 30 times for 500 ms
     mywin.flip()

fixCross.setAutoDraw(False) # Remove it

For some strange reason, this does not work properly anymore, it is not shown on screen for 0.5s but 0.1741s.

What is going on here?

To show that I really am using a 60Hz monitor:
Screenshot 2022-01-12 at 10.17.07

Hi rose,

Are you aware of any specific changes that were made prior to the behavior you currently observe (e.g., update of a module).

Can you try with a different backend by specifying the winType (the default is pyglet):

win = visual.Window(winType = "glfw")

Hi Christophe, I tried changing the window type but the error persists. I also discovered something else:
If I run the code above in a loop (10 times), and track the timings I get:

0.17349004745483398
0.05353593826293945
0.053383827209472656
0.05219388008117676
0.03808784484863281
0.0352020263671875
0.03441929817199707
0.034338951110839844
0.03474688529968262
0.03481483459472656

In other words: it it also not stable.

I have no idea if anything changed… maybe my macOS at some point.

Is there a particular reason why you a using .flip() instead of core.wait(.5) ?

Well yes, I have a reason for that, first of all because it is more precise, but in another part of my experiment it is actually also crucial (but I won’t go into detail).

I’ve always use this technique to flip the window, it has always worked, but now all of a sudden not anymore. It seems to me like it’s behaving as if I’m using a monitor with a higher refresh rate (but I’m not).

I would like to figure out how to get this working again.

Are you using Mac OS 12 Monterey? That release enabled variable refresh rate for relatively new Macs, but there seems to be some issues with the implementation of this feature.

What does the timing look like if you run your PsychoPy task in a window that isn’t full-screen (not usually good practice but it might help diagnose the issue if VRR is operating)?

I updated my MacBook from 12.0.1 to 12.1, and that seems to have solved the issue.