Randomizing fixation images together with video

OS (e.g. Win10): macOS Monterey (12.4)
PsychoPy version (e.g. 1.84.x): 2022.1.4
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:

I am fairly new to PsychPy. I am running an experiment where I am showing participants videos of genuine versus polite smiles of different people (i.e. there are two videos of each person, one showing a polite smile, and one showing a genuine smile). Prior to the presentation of each video, I need to present a fixation point that is either a circle, a square, or a normal fixation cross.

I am trying to randomize the fixation types presented as well as the videos, such that the fixation type is linked to the identity of the person in the video (i.e. for person 1’s two videos, the video is preceded by a square, whereas for person 2’s two videos, the video is preceded by a circle, etc.). Each participant then should be presented with differently paired fixation types and videos.

What did you try to make it work?:

I tried to create a spreadsheet for the video files, and surrounded the video routine with a loop that randomizes the video stimuli presentation. I then put a loop around the fixation stimuli and the video stimuli, with a spreadsheet attached that had the fixation stimulus files in it. This loop was also randomized.

What specifically went wrong when you tried that?:

Instead of randomly presenting each video with a different fixation cross, it first presents all the videos with the circle, then the square, and then the cross. I think I need to use a code component to do the linked randomization, but I am not sure how to do so.

I am therefore not even sure how to get the fixation types to randomize for each video, let alone for each person in the video.

Thanks in advance for the help!

You want a single loop with a conditions file that contains information on the fixation stimuli and their associated videos in one line (so those values are grouped together on a given trial). e.g. create three fixation stimuli, for the circle, a square, or a normal fixation cross. Then make your condition file look like this, to control the visibility of each fixation stimulus on a given trial:

circle_vis    square_vis    fix_vis    video
1.0           0.0           0.0        person_01.mp4
0.0           1.0           0.0        person_02.mp4

This would allow for only the circle stimulus to be visible with person 1’s video, and the square visible with person 2, and so on.

On your polygon stimuli, switch to the “Appearance” tab, and insert the relevant variable in the “Opacity” field, set to update as “set every repeat”. i.e. put circle_vis in the opacity field for the circle stimulus, and so on.

Thank you so much for your response! This is really helpful. The only thing I am not sure how to do now is how to randomize which fixation stimulus is linked to which video for each participant. For example, for participant 1, I need for the circle to show up with person_01.mp4, but for participant 2, the circle needs to show up with person_02.mp4. I think I can achieve this through making more spreadsheets, however this seems like an endless process as there are so many different combinations (I have 84 videos). Please let me know if this doesn’t make sense.