Hi, thank you for answering!
I forgot to mention: I am really new at programming and Psychopy. So i’m having a really hard time understanding what you suggested me to do…
Your suggestion is based on two parts:
-
Preload the images into three separate shuffled lists;
-
Use .pop() to take an image from the appropriate list on each trial.
But i don’t know how to preload, and i didn’t find anything about how to use .pop. I’m really lost…
The only thing i tried was a chatgpt suggestion:
import pandas as pd
import random
excel_data = pd.read_excel(“Roteiro_Exp1_v4CAMINHOCOMPLETOONLY.xlsx”) # Replace with the actual Excel file name # Read the Excel file
neutral_images = excel_data[“Caminho_completo_neutro”].tolist() # Extract the columns as lists
negative_images = excel_data[“Caminho_completo_negativo”].tolist()
positive_images = excel_data[“Caminho_completo_positivo”].tolist()
random.shuffle(neutral_images) # Shuffle each list independently
random.shuffle(negative_images)
random.shuffle(positive_images)
shuffled_images = # Combine shuffled lists maintaining the order of types
shuffled_images.extend(neutral_images)
shuffled_images.extend(negative_images)
shuffled_images.extend(positive_images)
But this error appears when i run the experiment:
Alert 4210:JavaScript Syntax Error in ‘Begin JS Experiment’ tab. See ‘Line 1: Unexpected token’ in the ‘Begin JS Experiment’ tab.
For further info see 4210: Probable syntax error detected in your JavaScript code — PsychoPy v2023.2.0
Here’s my excel file with the three columns of conditions and the list of the images:
Roteiro_Exp1_v4CAMINHOCOMPLETOONLY.xlsx (11.3 KB)
And here’s the prinstscreen of my experiment:

Thanks for any help!