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).
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).
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.
I am experiencing a similar issue that is delaying the timing of my experiment. I am wondering how to resolve this. For reference, I have attached a screenshot of the issue. I am using a 32GB Device and AMD Radeon Pro 5500M 4 GB Graphics. Thank you!
I am experiencing a similar issue that is delaying the timing of my experiment. I am wondering how to resolve this. For reference, I have attached a screenshot of the issue. I am using a 32GB Device and AMD Radeon Pro 5500M 4 GB Graphics. Thank you!
I just realized you’re on a Macbook. I believe that vsync is not a changeable setting on those, so your issue is probably caused by something different then what I encountered.