How does jsPsych measure stimulus presentation times?

75 views
Skip to first unread message

isaac....@gmail.com

unread,
Jul 15, 2018, 10:01:32 PM7/15/18
to jsPsych
Sorry if this has been asked and answered before, but I'm wondering how jsPsych measures the times at which stimuli are displayed. QRTEngine used requestAnimationFrame, but Safari and Edge apparently don't conform to the spec for this function, which seems like it could really throw things off. Thanks in advance.

Josh de Leeuw

unread,
Jul 16, 2018, 4:06:35 PM7/16/18
to isaac....@gmail.com, jsPsych
The display is controlled at the plugin-level, so the answer depends on which plugin you are using. Most plugins use a very simple setTimeout pattern right now. Something like:

display_element.innerHTML = "<img ...>"

setTimeout(function(){ display_element.innerHTML = ""; }, 1000)

to display a stimulus for 1000ms. 

We're working on a major overhaul to this, and as part of that overhaul we've been measuring the accuracy of setTimeout in this situation. The long-story-short is that this approach is pretty accurate, getting the display length right about 70% of the time if the display length is a multiple of the monitor refresh rate. In some cases the display_length may be off by a frame or two.

Josh

On Sun, Jul 15, 2018 at 10:01 PM <isaac....@gmail.com> wrote:
Sorry if this has been asked and answered before, but I'm wondering how jsPsych measures the times at which stimuli are displayed. QRTEngine used requestAnimationFrame, but Safari and Edge apparently don't conform to the spec for this function, which seems like it could really throw things off. Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "jsPsych" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jspsych+u...@googlegroups.com.
To post to this group, send email to jsp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jspsych/bced9828-5e58-48e2-a4ed-e3550eac7dd1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages