Please help me create an experiment to load images on participant basis. Either all at once or one at a time

I’m working on building an experiment using Psychopy 2023.1.1. I have 5400 images, but I want each participant to rate only 540 of them. I’ve created a minimal experiment here that should display images and allow participants to progress by pressing 1 to 5. However, I’m facing issues with getting this minimal form to work.

The experiment should randomly select image numbers and apply specific levels of distortion to them. I’ve tried creating CSV files for each participant with the required images, as well as writing JavaScript code to define the images for each participant. Neither approach is working for me at the moment. I’m open to downloading all images in advance for each participant or loading them one at a time. While it works fine in Python, I seem to be missing something when attempting to upload it.

I’ve referred to the documentation on the Resource Manager Component, but I’m still unsure how to resolve the issue. I’ve also looked at the online resources documentation, which mentions specifying files to download at the start and for each trial, but there isn’t much information on how to do it, or maybe I’m overlooking something.

I would greatly appreciate any input, as I’m stuck with this issue and need to deploy the experiment as soon as possible. Currently, the only solution I’ve found is requiring participants to download all 5 GB of images before they can start the experiment, which is clearly not ideal.

Thank you for taking the time to read this.

I found it easier to use code components than the resource manager or static component for conditional loading of stimuli.

Check out this demo, which loads the subset of images all at once at the start.

If you select group “a” in the initial dialog you’ll download and see 4 images of penguins. If you select group “b” you’ll download and see 4 images of lionfish.

View the code

This works by having two stimulus list files (group_a_stim.csv and group_b_stim.csv; NB: you should include these in “additional resources” in the online tab). In your case you’d have 10 separate lists.

The code in the init_resources routine in the Begin Experiment tab selects the right stimulus list depending on the group (which is set by setting the stim_file variable to the right list), then in the Begin Routine tab adds each item from the list to the array resource_list as you loop through the selected stimulus list. The End Routine tab of the code component in init_resources then starts downloading all items from that array.

The resource_checker_pb routine shows a progress bar for the specified resources, but you can remove this routine if you don’t want it.

Hope this helps.

Thank you very much for your response. I am still having issues implementing what you share. Can you make sure that your second link is accessible?

Try the link now. I had forgotten to set it to public.

1 Like

This helped me get much closer towards my target. Thank you so much.

I may have a few questions, such as if I can begin the experiment before all stimuli are loaded, but I will see if I can make sense of that myself. Thank you again for helping me.

You should be able to begin the experiment before all stimuli are loaded if you get rid of the resource_checker_pb and resource_download_complete routines.

Beware that this would mean there’s no check that resources are downloaded before you get to the trial they’re needed on.

Two things you could try:

  1. Insert (an) instruction(s) routine(s) between init_resources and resource_checker_pb so that the begin while they read instructions.
  2. Insert multiple init_resources routines, each downloading data for the next block while the current block is ongoing.