Showing the image stimulus, paired with other image randomly selected from previous routine

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2021.1.2
Standard Standalone? (y/n) : yes
What are you trying to achieve?:
I’d like to show the image stimuli (Image_A_1) which are paired with other images (Image_A). That other paired image (Image_A) in the condition file was selected randomly and shown from previous Routine.

What did you try to make it work?:
From the condition file of the loop, image stimuli (Image_A) are presented in a random order. Though I don’t know what to do next, I temporarily put the ‘Image_A_1’ Routine after that to show the paired image following the stimuli from ‘Image_A’.

What specifically went wrong when you tried that?:
I think I need some code components to select and show automatically the matched images from previous routine one by one.

Thank you for your time...!!
I really appreciate any comments and idea.

Hi There,

In your first routine add a code component and in the “Begin routine” tab use:

imageList = [im1, im2]

Where im1 and im2 correspond to the headers in your conditions file used to set image 1, image 2 and so on.

Then in your next routine add a code component, and in the begin routine tab type:

thisIm = imageList[-1]

Then use $thisIm to set the image parameter of your image.
note that to use shuffle you will need to add a third code component, this one to the begining of your routine, set code type to JS and in the Begin experiment tab type:

shuffle = util.shuffle;

Hope this helps,

1 Like

Thank you so much ! It worked perfectly. Great thanks!