psychopy.org | Reference | Downloads | Github

Preloading stimuli

Hi all,

I’m trying to code a visual experiment relying on frame numbers.
It is a SSVEP experiment and presenting 2 stimuli at the same time.
They are changing based on certain frequencies.
It seems that I am “missing” some frame.
My trial are 60 seconds at 60Hz so I’m expecting that the last frame of my trial would be 3600 but it is usually somewhere around 3550. From different tests, I have the impression that it is because of the size of the stimuli, even though they are quite small, they need to be load several times during the trial (4 stimuli during one trial)
I was wondering if there is a way to preload stimuli at the beginning of the trial and just called them when they are needed.
I’m using the Builder and PsychoPy v2020.1.3

Thanks!

I’m not sure, if that would help in your case, but did you look into the Static component?

How many different images are you using? Would it be an option for you to create an image component for every image and then hide all images, which are not relevant for that trial? That might be another way to approach your problem.

Does your Experiment Runner warn you of dropped frames?

Depending on which aspect you need I have three suggestions.

  1. Preload the names of the stimuli into arrays in a loop prior to the trials loop. I do this a lot for prospective memory tasks.

  2. Define all the objects and control their appearance using set Autodraw = true/false

  3. Don’t update something in a frame if it hasn’t changed

@wakecarter: I think @HeleneD is using the Builder interface. Your suggestions are more helpful for an experiment built with the Coder interface or relying heavily on code components.

Thanks @LukasPsy
I will look at Static component.
The Experiment runner is not warning me about dropping frames but I’m printing out the last frame of the trial, and it is not the good one (except if I keep the same stimuli for the entire trial).
I’ll also see about hiding not relevant mages. I have 4 images during trials, but if possible, I’d like to use more.

Thanks @wakecarter
As @LukasPsy mentionned, I’m using the Builder but I also have code components so I’ll see if I can do that like this.
I’m not updating in a frame when it doesn’t change from the previous one.

All my experiments are in Builder with code components.

Here’s a link to my PM template that I’m currently adapting to Pavlovia

1 Like

Good to know, I’ll try your suggestion.
And thanks for the link.