psychopy.org | Reference | Downloads | Github

[TIMING ISSUE] 8 Hz Stimulus for 10 s

OS (e.g. Win10): Windows 10, Dell XPS 15
PsychoPy version (e.g. 1.84.x): 1.84 and tested on 1.82
Standard Standalone? (y/n) If not then what?: yes
What are you trying to achieve?: Displaying an 8 Hz flashing image for 10 seconds

What did you try to make it work?: Built analagous procedure in coder and it still didn’t come out to the correct timing. The build in builder is very simple and described below.

Created two image objects:

  • The first started at 0.0 and went on for 0.0625 s
  • The second started at 0.0625 and went on for 0.0625 s.
    ==
    The block above was looped 80 times.

Theoretically, it should last for 10 seconds.

What specifically went wrong when you tried that?:
Nothing crashes - the code runs fine and repeats the proper number of times.
When timed with an externally, on average the stimulus only lasted for 9.3 seconds.

  • Recording with OBS Studio and doing a frame by frame analysis it seems like the second image is being cut SHORT at times.
  • At 10 Hz AND at 0.1 Hz, the image is timed perfectly when analyzed frame by frame and when timed externally.

I’m going to guess that your screen is running at 60 Hz?

You need to take hardware into account. At a 60 Hz refresh rate (i.e. with 16.6666 ms screen refresh periods), an exact 10 Hz oscillation is possible (3 refreshes on, 3 refreshes off, repeat). An exact 8 Hz alternation is not possible (it would require 3.75 refreshes on and off).

In Builder, set your stimulus durations to be in terms of frames (i.e. screen refreshes) rather than seconds. This will prevent you attempting to set invalid frequencies.

This makes sense - Thank you for the prompt response.