Online study stops to show stimuli with a lot of rects

URL of experiment: PopoutStudy [PsychoPy]

Description of the problem: Hello, I have an online experiment that needs to show a lot (768) of visual.rect in each trial. The whole experiment works fine on my laptop. However, starting from some point of the experiment, it fails to load the visuals and just show a blank page on some other machines. For example, machines with macos, but it also happens on some windows machines (typically the less powerful ones). Annoyingly, I didn’t get any error messages, nor from psychopy or browser inspector. I suppose memory/buffer/garbage collection plays a role in this? Is there a way that I can manually do garbage collection in psychopy?

PS, input 1 for surveyID and 0 for participant when you open the experiment, leave the rest empty. You may need to try a few trials until it happens, with a less power machine.

How often are you creating new rectangles?

I create rects in beginRoutine at the outside of the loop of trials. My experiment has multiple ‘blocks’ and each block has 8 trials. The rects are created at the beginning of a block. In beginRoutine of each trial routine, I change rects’ pos, color, etc. And then setAutoDraw true, and then setAutoDraw false at the endRoutine.

I didn’t create rects in beginExperiment since some ‘block’ varies in the number of rects

If it only happens once, that should be fine.

I just tried it and there was a delay between the space bar and the numbers appearing. Is that intentional. If it’s caused by the randomisation of the numbers, that could be done earlier.

It didn’t go blank after the practice plus 5 or so trials.

Thank you! The delay is not intentional. I want it to appear immediately. The numbers are not generated from randomization. It’s read from csv files. The numbers and the position of rects are all from csv files. Is there a way to help the delay?

Is there a start of a loop at that point? Please could you show what this bit looks like in the flow.

And when it happens, all the following trials won’t show stimuli anymore (it still shows numbers after ‘space’ is pressed). So the study will stuck because of this


This is my flow in psychopy. Rects are created in the beginRoutine of ‘blockInstr’. ‘trials’ loops 8 trials, trials_3 if for wrong answers, trials_2 loops all blocks

And rects are setAutoDraw(true) in beginRoutine of ‘gen_stimu’; numbers are setAutoDraw(true) in beginRoutine of ‘verification’

Does that mean they get recreated every iteration of trials_2? You said they were only created once.

The delay must be in End Routine of gen_stimu or Begin Routine of verification. Any suggestions for code that might take a second or more to run?

I just find It’s not caused by rects! I deactivate the ‘verification’ and ‘feedback’ routine and it works perfectly this time, no blank page, no delay. So the issue is actually related to text rendering because I set all the numbers autoDraw in ‘verification’

Here is how I render the numbers in ‘blockinstr’ routine, verification_numtext is a list

verification_numtext.push(new visual.TextStim({win: psychoJS.window,
text: num,
pos: thePos,
height:0.03*Display_Ratio,
color: [1, 1, 1]}));

And I have this in the beginRoutine in ‘verification’ routine

for (var num_text of verification_numtext){
num_text.setAutoDraw(true);
}

Does that mean they get recreated every iteration of trials_2

Yes, they do, since each block have different number of rects. Some block actually will show circles

But I guess I can create 768 rects and 768 circles outside of tirals_2, in beginExperiment, then change their properties, right?

1 Like