I’m programming a version of the affect misattribution procedure (Payne et al., 2004), and I’m stuck with one aspect. I have two sets of stimuli - primes and targets. There are 12 primes and 162 targets. Each trial displays a prime followed by a target, and there are 324 trials total - this means that each prime is displayed 27 times and each target is displayed 2 times. The primes and targets should be randomly paired for each trial (in the sense that any single participant won’t necessarily see the same pair), but each prime needs to be displayed 27 times, and each target needs to be displayed twice.
I currently have a function that will pull from one list contain both the target file names and the primes file names. Consequently, the images are not being randomly paired - they’re paired as they are in the csv file used to create the list. Relevant snippets of code below.
pracCSV = "praclist.csv" pracList = pd.read_csv(pracDir + pracCSV) #create stimuli that are constant for entire experiment pracprimeImage = visual.ImageStim(win, image = pracDir + '1220.JPG', pos = (0, 0), size = (primeImageSizeX, primeImageSizeY)) practargetImage = visual.ImageStim(win, image = pracDir + 'pic81.bmp', pos = (0, 0), size = (targetImageSizeX, targetImageSizeY)) def runBlock(taskName='amp', blockType='', reps = 2, saveData=True, practiceTrials=6): trialsInBlock = pracList #for prac trials trialsInBlock = pd.concat([trialsInBlock] * reps, ignore_index = True) #repeat each trial/row in dataframe reps number of times trialsDf = trialsInBlock.reindex(np.random.permutation(trialsInBlock.index)) #random shuffle trials trialsDf = trialsDf.reset_index(drop = True) #reset row index for i, thisTrial in trialsDf.iterrows(): #draw stim pracprimeImage.setImage(pracDir + thisTrial['pracprimeImage']) practargetImage.setImage(pracDir + thisTrial['practargetImage'])
Do I need to import two csvs, one with prime file names and one with target filenames? I feel like that’s the answer but I’m not sure how to proceed with creating a trial list from there (i.e., getting it all into my trialsDf object). Any help would be greatly appreciated!