Hello, I want to randomize the images without repeating them.
My condition file is as follows:
Each loop randomly selects any line in the condition file.
I want the other four variables to be matched by line, and only the picture variable is not matched by line, that is, the “emopic” is randomly assigned individually.
My code component is as follows:
import random
import pandas as pd
import csv
f = pd.read_excel(‘trials_condition.xlsx’)
Emopic = list(emopic) # convert the tuple to a list to make it editable
header = Emopic.pop(0) # remove the header item
shuffle(Emopic) # randomise the actual values
Emopic.insert(0, header) # restore the header at the top
thisExp.addData(‘Emopic’, Emopic)
But the data saved in the csv file is like this, not the images’ name.
[‘e’, ‘i’, ‘0’, ‘m’, ‘j’, ‘/’, ‘e’, ‘5’, ‘_’, ‘.’, ‘m’, ‘0’, ‘0’, ‘p’, ‘o’, ‘8’, ‘0’, ‘g’, ‘g’, ‘a’]
How can I modify it?
Looking forward to your reply. Thank you.