Problem with duration of stimuli display #761
-
Hi Josh and community, I have a question regarding the timing of stimulus displays. I wanted to confirm if the duration of stimuli display was the same as I had defined it in the But my problem is one of the trials exceeds its specified eg. I had defined trial_duration: 200 but the display duration seemed to be 223ms, 233ms, 226ms, and so on, upon checking several times. I suspect this problem is because I am displaying two Gabor patch images in this trial, by passing their corresponding base64 strings to an element for displaying as images. Please view the code below, I store the two base64 strings of Gabor patches in var stim_disp = {
type: 'html-keyboard-response',
stimulus:
'<svg xmlns="http://www.w3.org/2000/svg">' +
'<circle class="fixation-point"/>' +
'<circle class="reward-cue-left"/>'+
'<circle class="reward-cue-right"/>'+
'<image class="left-stim" href="'+ stim[0] + '" style="transform:translate('+ (-stim_radius) +'px,'+ (-stim_radius) +'px)"/>' +
'<image class="right-stim" href="'+ stim[1] + '" style="transform:translate('+ (-stim_radius) +'px,'+ (-stim_radius) +'px)"/>' +
'</svg>',
trial_duration: 200,
choices: jsPsych.NO_KEYS,
data : {test_part: 'stimulus_and_cue'},
on_finish: function(data){
data.disp_duration = data.time_elapsed - jsPsych.data.get().last(2).values()[0].time_elapsed;
}
}; I would like to know what I can do to resolve this? Thank you for your answers beforehand! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I would not use time_elapsed for this purpose. time_elapsed contains the time the browser takes to paint and setup the experiment for each trial. You should use data.rt for your timing needs. Since in your case, you don't get a keyboard response, I can assure you that the stimulus is actually visible for around 200ms. time_elapsed gives you a measure that includes the time taken by your graphic cards to paint the gabor patch to the screen (during which it is not visible). |
Beta Was this translation helpful? Give feedback.
-
I think that's because your browser caches the image (the actually display buffer) so that it doesn't have to convert the images to RGB values again. The data uri methods only caches the images (non-parsed data). At least this my theory.
…On June 16, 2020 7:10:37 PM UTC, Prajwal Gatti ***@***.***> wrote:
Instead of base64 strings, I loaded local PNG files of the stimulus and
it seems to not have the extended durations anymore!
The stimulus is a square image of about 400px length. I need to do some
digging to figure out why this performs better. But is it that using
base64 images is a good method for smaller sized images?
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#761 (reply in thread)
|
Beta Was this translation helpful? Give feedback.
I would not use time_elapsed for this purpose. time_elapsed contains the time the browser takes to paint and setup the experiment for each trial. You should use data.rt for your timing needs.
Since in your case, you don't get a keyboard response, I can assure you that the stimulus is actually visible for around 200ms. time_elapsed gives you a measure that includes the time taken by your graphic cards to paint the gabor patch to the screen (during which it is not visible).