psychopy.org | Reference | Downloads | Github

Incorrect frame rate logs on Pavlovia

Description of the problem: I am running an online study on Pavlovia in which I need to present images for the very short duration of 16.6ms (rounded to 17ms). I also need the refresh rate of the monitor.

The problem is, I have been told that some of the refresh rates that were logged in the .csv output are not the same as the real refresh rate - all the logs say 60Hz but some monitors were in fact e.g. 144Hz. I see in the JS file that:

>  // store frame rate of monitor if we can measure it successfully
>   expInfo['frameRate'] = psychoJS.window.getActualFrameRate();
>   if (typeof expInfo['frameRate'] !== 'undefined')
>     frameDur = 1.0 / Math.round(expInfo['frameRate']);
>   else
>     frameDur = 1.0 / 60.0; // couldn't get a reliable measure so guess

which I presume means that in my data the refresh rate either really is 60Hz, or it could not be measured successfully so it was guessed.

I also looked at the .log files, and calculated logged duration of each image by subtracting the timestamp of ‘autoDraw = False’ from ‘autoDraw = True’ in each trial, and I get a very variable distribution of durations (from 0ms to about 25-30ms), which does not peak at 17ms (but at about 11-13ms). This happens regardless of whether I set the experiment settings to display the image for 1 frame (on confirmed 60Hz monitors) or 17ms. Interestingly, I also present a blank screen for 17ms, and in this case the distribution of the onset-offset differences peaks at 17ms, with much less spread. Other images presented for 2000ms also show peaks at the expected value, and little spread.

My questions would be:
-how could I make sure that the logged refresh rate is correct?
-if I want to clean the data by excluding trials with frame drops/gains, which would be the best approach given the available data and taking into account measurement error?

Any help would be much appreciated!

I don’t think the getActualFrameRate() does anything at all. This is the source code (https://psychopy.github.io/psychojs/core_Window.js.html) of that function. No idea if it is possible to get the refresh rate of screens online.

	/**
	 * Estimate the frame rate.
	 * 
	 * @name module:core.Window#getActualFrameRate
	 * @function
	 * @public
	 * @return {number} always returns 60.0 at the moment
	 * 
	 * @todo estimate the actual frame rate.
	 */
	getActualFrameRate()
	{
		// TODO
		return 60.0;
	}
1 Like

ah okay, I see, that makes sense… Thank you very much for pointing this out!

I see online some suggestions of using the JS function requestAnimationFrame, however I am not sure how/if it is possible to integrate it with PsychoJS…