| Reference | Downloads | Github

What decides PsychoPy's "Frame" rate?

I have been using the “Each Frame” option of the builder’s code component to run bootleg while loops.

I was under the impression that Each Frame referred to each frame being presented on my current screen and would thus be tied to my monitor’s refresh rate (i.e. 60HZ on my current screen). Some testing, however, shows that code under the section runs up to 180 times per second on my PC (fewer iterations when I make the code computationally heavy enough).

What exactly does “Each Frame” refer to?

It is exactly what you say: it is tied to the monitor refresh rate, which cannot be controlled by PsychoPy itself.

You need to check your system’s graphics cards settings, however. PsychoPy generally relies on the graphics card being set to allow pausing in sync with the vertical refresh cycle, or vertical blanking. This means that only complete screens are displayed (from a buffer), once per cycle, rather than being allowed to update as soon as new data is received. It might be that your system is doing the latter, effectively allowing (partial) drawing to the screen to happen at faster than 60 Hz, even though physically it is only refreshing at 60 Hz. That is, new data might be received half way through a refresh cycle and so the bottom half of the screen will be updated before the top half. As experimenters, we generally don’t want that to happen.

So take a look at your system’s graphics settings and come back to us with screen shots if you have any queries (the actual settings differ depending on your graphics card manufacturers and OS).

Thank you for the explanation.

Turning V-sync on in the graphic settings changes the behavior to how I expected it to work, running the code component at 60Hz. This serves as a good reminder to ensure that these settings are all correctly enabled on my lab’s stimulation devices.

1 Like