Loading Stimuli from a File Database in the Background on Pavlovia

Hello,

I have a PsychoPy experiment that I want to run on Pavlovia. This task is an image recognition task where participants must choose one image out of four based on an audio file that tells them which image to select.

The goal is to have a large database of images and sounds and randomly draw from it since each participant is supposed to complete the experiment multiple times. The problem is that on Pavlovia, all resources must be loaded before the experiment starts. I would like to see if it is possible to download only the necessary elements for the experiment, knowing that they are randomly selected from Excel files at multiple points during the experiment.

I found these two possible solutions online:

However, I was wondering if I could input the randomly drawn columns from my Excel files instead of manually specifying the files as described in the tutorials.

You could preload using the code in your second option.

psychoJS._serverManager.prepareResources

One option would be to decide on the stimuli at the start of the experiment and preload while instructions are being read.

1 Like

I’ve just added downloading resources on the fly to my daily tips.

Thanks for the tips I will try to do this code and I will try to combine it with psychoJS._serverManager.prepareResources. Do you think It’s a good solution ? :


myData = data.TrialHandler(
    nReps=1, 
    method= 'random'
    extraInfo=expInfo, 
    originPath=-1, 
    trialList=data.importConditions('conditions.xlsx'),  # Ajoutez ", selection=useRows" pour sélectionner des lignes
    seed=None, 
    name='myData'
)

# Limiter sequenceIndices à 5 éléments
sequenceIndices = []
for Idx in myData.sequenceIndices[:5]:  # Sélection des 5 premiers éléments
    sequenceIndices.append(Idx[0])