Experiment running in builder but stops after 1 trial in pavlovia

URL of experiment: Pavlovia (experiment page to pilot it)

Description of the problem: My experiment runs fine locally, but on pavlovia, it freezes after 1 trial and stays on the gray screen. This task has 640 trials and each trial displays a gif (that was changed to mp4s based on this thread. There is no error and I’m not sure what’s going on…I know there are a lot of stimuli but it seems like it could be a screen flipping issue if it won’t get past the first trial?

Have you looked for errors in the browser developer console?

I just tried looking for errors and this is what the console looks like at the beginning screen as well as the frozen screen- the only new error in the second screenshot is a warning about trialhandler- could that be it?

Since there doesn’t seem to be an actual error the key is to work out why the display is blank. What should be on the screen at this point? What responses should be valid? It might be that the issue is that, for example, the text is being set after it is displayed.

It froze after the audio feedback, where it is then supposed to go to the next trial (fixation cross). The loop is: fixation cross, stimulus gif and key response, confidence key response, audio feedback (or silence), and break_2 only comes every 160 trials.

I do have a couple custom code components, so maybe something is a little off with those even if everything runs locally? Every code component is at the top of the routine it’s in and they are all set to auto–>JS. I got these code snippets off of a couple other threads on here.

At fixation, the code component is:
Begin experiment: trialCount=0
Begin Routine: trialCount = trialCount+1

Feedback code component:
Begin experiment: vol=0
Begin Routine: if ((L_R.corr === 1)) {
vol = 0;
} else {
vol = 0.5;
}

Break 2 code component:
Begin experiment: breakTrials = [160, 320, 480]
Each frame: (see screenshot)

Try changing the name of your loop to trials, rather than including punctuation.

I think I might be misunderstanding something- the name of my loop IS trials, with no punctuation (see first screenshot). Unless you’re referring to something else?

Ah. That might be a difference with the way loops are displayed. I use the classic version.

Sometimes I find that Begin Experiment code components need to be in routines outside the loops. I always have a start routine as the first routine in the flow

Here is my full experiment (apologies that this is so hard to read- but it’s just the consent form over multiple routines and then instructions)

So you would recommend putting the 3 Begin Experiment code components (trialCount=0, vol=0, breakTrials = [160, 320, 480]) on the very first routine (cons)?

Anywhere out of the loop should be fine.

Do you have any code in your instruct routine? The experiment hangs between instruct and the fixation so it must be something about the end of one, the beginning of the other or the loop. You could add an extra routine that gives an on screen message starting at 1 second and lasting 1 second . Put it in three times — before and after instruct and before fixation in the loop. Then count how many times you see it.

Please could you show your loop definition?

I’ll try your idea of putting in three different screens to test, but I don’t think anything is wrong with the instruct routine (there is no code component). Here is a screenshot of the loop properties: it randomly selects a row and the movie stimulus shown is in ‘file’ (I hope this is what you meant about loop definition)

I tried moving those Begin Experiment code components to the inst routine (outside of loop) and it quit out after the instructions before fixation started with this error: File “/Users/juliaschorn/PDM/movcode_Breakpilotdots_lastrun.py”, line 930, in
trialCount = trialCount+1
TypeError: can only concatenate tuple (not “int”) to tuple

That looks like you’re adding 1 to trialCount before it’s started.

However, I think I have your issue, the movie stimulus.

What format is the movie in? How big is it? There will often be a delay while the stimulus loads.

Try it again with the movie disabled to see if the rest of it works.

There are a few comments about movies/videos in my crib sheet and lots of threads about them here.

If it was a problem with the stimulus loading, wouldn’t the fixation cross for trial 2 show up before going blank? The movies were in gif format but were converted to H.264 mp4s when I got the same error as this person did in this thread.
Each mp4 file is ~69 KB

Regarding trialCount, this code worked before when “trialCount=0” was in the Begin Experiment code component for fixation…but now when moved to instr (outside of the loop) it’s getting this error- should I move it back?

Does it play the movie first time through and then fail on the second loop? If so it might be a video reset issue. Is it the same video?

Yes, move trialCount=0 to back inside the loop (though it shouldn’t need to be there unless you are manually adding var to it)

Weirdly I moved it back in the loop and still getting that error…maybe I should move the other code components back as well. Also, I’m not manually adding variables to it (I don’t think).

Each file is a different video. The experiment successfully got through one trial (fixation, stimulus with participant response, then confidence rating with participant response, then sound feedback). After the sound feedback though, it should have gone back to the fixation screen but it just froze on the gray screen. So I’m not sure if it’s a video reset issue.

Somewhere it thinks trialCount is a tuple. I’d do a search through your js file for instances of trialCount. Maybe it’s somewhere you didn’t expect.

So the error might be with the sound feedback hanging. What would the experiment look like if the sound feedback routine never ended? What’s in that routine. Sound files can be an issue if they get given durations.

This is the sound component (and code component). Before, vol=0 was here with Begin Experiment.
L_R.corr is from the key response during the movie stimulus (it’s either 1 or 0).

I found your helpful thread and miraculously implemented it haha it worked! The sound feedback was causing problems because I gave it a duration, so I am now using an mp3 file.

I then saw some other threads on how to do breaks for online experiments and I got it to work!

Auto–> JS
if trialCount==160 or trialCount==320 or trialCount==480 :
continueRoutine = True
else:
continueRoutine = False

with trialCount=0 at Begin Experiment and trialCount=trialCount+1 at Begin Routine

This is inside the loop, but I haven’t run into any problems yet.Thank you so much for your help on this thread and many others!

1 Like