import csv, os, codecs
#load in image list
with codecs.open(‘https://gitlab.pavlovia.org/lcdlab/spatial-memory/blob/master/trialsblock1.csv’, ‘r’, encoding=‘utf-8-sig’) as f:
reader = csv.reader(f)
allPics = list(reader)
random.shuffle(allPics)
print(allPics)
with codecs.open(‘https://gitlab.pavlovia.org/lcdlab/spatial-memory/blob/master/trialtypes.csv’, ‘r’, encoding=‘utf-8-sig’) as f:
reader = csv.reader(f)
trialTypes = list(reader)
#how many pics do we actually want?
numItems = 105
numEncoding = 25
numRetrieval = 60
#arrays of stim names
pics = []
#read images from sheet
for rowx in range(numItems):
row = allPics[rowx]
#print(row[0])
# save each pic to pic array
pics.append(row[0])
#randomize order of pics
random.shuffle(pics)
#arrays for final stimuli
trialPics = []
#create final stimuli list
for i in range(0, numItems, 3):
# make triplet
trialPics.append(pics[i:i+3])
#these triplets will be shown during encoding
encodingPics = trialPics[0:numEncoding]
#this will be the new triplets added at retrieval
newRetrievalPics = trialPics[numEncoding:numEncoding+numRetrieval]
newPics = []
for triplet in newRetrievalPics:
for pic in triplet:
newPics.append(pic)
#for randomizing trial orders
trialOrders = []
for rowx in range(numEncoding):
row = trialTypes[rowx]
trialOrders.append(row[0])
random.shuffle(trialOrders)
samePics = []
diffPics = []