psychopy - Combining condition files -
i working on experiment , have parts of built using coder , builder, stuck on spot. experiment presents 2 different lists of words people (list , list b) , each word in it's respective list randomly paired number @ beginning of experiment. psychopy shows both word , number participants , important after randomly paired word-number pairs yoked remainder of experiment. have used coder randomize pairing , construct conditions file 2 word lists on fly. builder uses these constructed conditions files present stimuli (words , numbers).
this part i'm stuck. after 2 word lists , paired numbers presented, need present subset of both lists , b third list of word-number pairs not presented. so, example, person might see during experiment:
first presentation: list a: frank - 1, susan - 3
list b: shoe - 2, dingy - 1
second presentation: frank - 1, shoe - 2, hotel - 4
the beginning of experiment coder used create word , number lists write 2 list's condition files. code below:
import random import csv studylista=["shoe","bear","balls","dingy"] pointslista=[1,2,3,4] listarand=random.sample(studylista,len(studylista)) listapointsrand=random.sample(pointslista,len(pointslista)) open('wordsandpointslista.csv','wb') w: writer=csv.writer(w) writer.writerow(['studylista','pointslista']) in range(len(listarand)): writer.writerow([listarand[i],listapointsrand[i]]) studylistb=["frank","robert","daniel","susan"] pointslistb=[1,2,3,4] listbrand=random.sample(studylistb,len(studylistb)) listbpointsrand=random.sample(pointslistb,len(pointslistb)) open('wordsandpointslistb.csv','wb') w: writer=csv.writer(w) writer.writerow(['studylistb','pointslistb']) in range(len(listbrand)): writer.writerow([listbrand[i],listbpointsrand[i]])
i need random subset of 2 presented lists along additional list has not been presented seen participant. previous word-number pairings seen lists need preserved. cannot seem discover how this.
i have 2 word-number lists presented in separate routines loops around each one. trying figure out how create third routine show of seen word-number pairs along new word-number pairs. thanks.
in code above, don't create 2 separate two-column csv files, combine them single four-column file. file can used in multiple loops. if understand design correctly, used first in loop present 'a' word/number pairs, , again in second loop present 'b' word/number pairs. lastly, use in final loop present subset of 'a' & 'b' pairs. subsetting applied via "selected rows" field in loop dialog. randomisation optional in first 2 loops, have shuffled rows, necessary in third loop avoid presenting rows in same order in first 2 loops.
then there question of how handle third set of word/number pairs. easiest thing create them @ same time & b sets , stick them in same csv file. in case, need same number of words , numbers, of wouldn't presented due running through subset in final loop. alternative have second code component prior third loop reads in existing file, shuffles rows, subsets it, , adds new columns. i.e. doing lot of things builder loop otherwise you, allowing not 'waste' words, if important you.
lastly, simplified code above. builder imports numpy.radom.shuffle
function, simpler doing sampling , on, , don't need import standard random
library.
Comments
Post a Comment