Two types of image stimuli, 9 of each, want experiment to randomly select four of each kind for every trial

What I would do in this circumstance is ditch the Excel file and start with two arrays, e.g.

exponential=[['graph1.png','e'],['graph2.png','e'],['graph3.png','e'],['graph4.png','e'],['graph5.png','e'],['graph6.png','e'],['graph7.png','e'],['graph8.png','e'],['graph9.png','e']]

reciprocal=[['graph10.png','r'],['graph11.png','r'],['graph12.png','r'],['graph13.png','r'],['graph14.png','r'],['graph15.png','r'],['graph16.png','r'],['graph17.png','r'],['graph18.png','r']]

shuffle(exponential)
shuffle(reciprocal)
graphs=[]
for Idx in range(4):
     graphs.append(exponential[Idx])
     graphs.append(reciprocal[Idx])
shuffle(graphs)

Then have a trials loop with no conditions file and nReps=8 where your image file is graphs[trials.thisN][0] and your answer is graphs[trials.thisN][1]

However, you will also need to save the data by adding the following to your main trial or feedback routine.
thisExp.addData(‘Graph’,graphs[trials.thisN][0])
thisExp.addData(‘Answer’,graphs[trials.thisN][1])

For more conditions (like a word list) I use a pretrials loop to append the data into the array instead of adding the information into the code component itself.

Best wishes,

Wakefield

1 Like