URL of experiment: GitLab; Pavlovia; RSVPexample.psyexp (abridged version of PsychoPy experiment)
Description of the problem: I have an attentional blink experiment with a RSVP stream of images and the presentation timing lags every so often. The presentation method I’m using came from an old thread with a similar issue (which I can’t seem to find again) and I believe @jon was the one who came up with the solution. The method has two images (odd and even) and each loop alternates the opacity of each image so that only one is shown at a time. Then while one is being shown, the other is invisibly loaded so that the program doesn’t have to load and show a new image in a single component each loop, which prevents lagging. Here are the code snippets from my variation:
Begin Routine:
next_image_loaded = 0;
//do different things on even and odd numbered trials:
if (stimNum % 2 === 0) {
RSVPimage_odd.opacity = 0; //hide this one
RSVPimage_even.opacity = 1; //show this one
} else {
RSVPimage_odd.opacity = 1;
RSVPimage_even.opacity = 0;
}
Each Frame:
if ((next_image_loaded === 0) && (frameN > 1) && ((stimNum + 1) < nStim)) { //stimNum = the loop number; nStim = total number of loops
//find out the next image:
var nextTrial = (stimNum+1);
var nextImage = RSVPstream[nextTrial];
//do different things on even and odd numbered trials:
if (stimNum % 2 === 0) {
RSVPimage_odd.setImage(nextImage);
} else {
RSVPimage_even.setImage(nextImage);
}
next_image_loaded = 1;
}
I’ve already made multiple versions of the same type of experiment with this method that all worked fine (as far as I know), but this one isn’t as smooth for some reason. I’m not worried about slight variations in timing, but every four or so trials only shows a few images. All images are supposed to be shown for 70ms. I printed t
at the start and end of each loop to get approximate timing for each image (I know that’s not the best method, but I just wanted an estimate) and here are the outputs for some of the first 10 trials:
Trial 1:
[0,0.07560000002384015]
[0,0.06199999999999761]
[0,0.05989999997615314]
[0,0.06099999999999284]
[0,0.0613999999761603]
[0,0.05970000004768394]
[0,0.061799999952313556]
[0,0.06039999997616974]
[0,0.0613999999761603]
[0,0.0601000000238372]
[0,0.06079999995230878]
[0,0.060899999976157915]
[0,0.06189999997616269]
[0,0.06189999997616269]
[0,0.059800000071518866]
[0,0.06039999997616974]
Trial 2:
[0,0.04749999999999943]
[0,0.060899999976157915]
[0,0.061499999999995225]
[0,0.061499999999995225]
[0,0.0613999999761603]
[0,0.061199999928476245]
[0,0.05979999995231822]
[0,0.06070000004768872]
[0,0.06039999997616974]
[0,0.06169999992847863]
[0,0.059900000095368]
[0,0.06170000004767928]
[0,0.060000000000002274]
[0,0.05989999997615314]
[0,0.06139999997614609]
[0,0.0601000000238372]
Trial 4:
[0,0.04860000002383913]
[0,0.06070000004768872]
[0,0.06049999999999045]
[0,0.28139999997615917]
[0,0.03010000002383606]
[0,0]
[0,0]
[0,0.00010000002383492301]
[0,0.00010000002384913387]
[0,0]
[0,0]
[0,0.00010000002384913387]
[0,0]
[0,0]
[0,0]
[0,0]
Trial 5:
[0,0.0519999999999925]
[0,0.0613999999761603]
[0,0.06199999999999761]
[0,0.062100000023846746]
[0,0.06050000000000466]
[0,0.061199999928476245]
[0,0.06189999997616269]
[0,0.06039999997615553]
[0,0.060599999904624724]
[0,0.06289999997615325]
[0,0.06020000004768633]
[0,0.0613999999761603]
[0,0.06070000004768872]
[0,0.06190000009536334]
[0,0.06189999997616269]
[0,0.06189999997616269]
Trial 8:
[0,0.055699999928478405]
[0,0.061799999952313556]
[0,0.22320000004768303]
[0,0.028800000071527165]
[0,0.00010000002384913387]
[0,0]
[0,0.00010000002383492301]
[0,0]
[0,0]
[0,0]
[0,0]
[0,0]
[0,0]
[0,0.00010000002384913387]
[0,0]
[0,0.00010000002383492301]
Trial 9:
[0,0.05560000002384413]
[0,0.061200000047676895]
[0,0.06070000004768872]
[0,0.06100000000000705]
[0,0.06169999992846442]
[0,0.060899999976157915]
[0,0.06100000000000705]
[0,0.060899999976157915]
[0,0.06049999999999045]
[0,0.05989999997615314]
[0,0.060000000000002274]
[0,0.06200000000001182]
[0,0.061799999952313556]
[0,0.060899999976157915]
[0,0.060600000023839584]
[0,0.06130000007152603]
So you can see on trial 4 and 8 that most images aren’t shown at all and image 3 is shown for much longer than it should be. Also none of them are showing for 70ms, but that’s not a huge deal. Is there a reason this could be happening? The last code that worked was using version 2020.2 and this one is using 2021.1.4, so is it maybe something to do with the version? The method was from 2016/2017 (I really wish I bookmarked the thread) so maybe there’s a better way to go about this now? Thanks!