![]() With open('newConditionsList' + str(j) + '. In the code I correct the missing “s” and change de ‘w’ for ‘w’.Ĭonditions = for k in randomIndices] # select just 5 of them The newConditionsList1 isn’t created ! I don’t know why. This (hopefully) generates two new csv files (newConditionsList1.csv and newConditionsList2.csv), which you can then use for your two loops. With open('newConditionList' + j + '.csv',‘w’) as file: # create a new CSV file have a sequence which goes ABCBCACABetc.). In an experiment lasting 10 minutes one might have 40 15-second blocks, and the only way to produce the (psuedo-random) sequence you want is with 40 separate elements in the flow panel that all executed one-by-one (with no loops). NewConditions = # define an initially empty listĬonditions = conditions] # select just 5 of them If your input file has many rows what is the better loop type Random. There’s no easy way of doing this in the builder. # generate two files with non-overlapping subsets, 40 trials each RowsLoop2 = list(set(range(10)) - set(RowsLoop1)) Not sure if it works, since I don’t have the files to test it. So, do I understand you correctly that participants only go through the first and the second loop once with both having 40 trials? So you basically want to take your 8 csv files, sample 5 rows out of each one for the first loop, and then sample the 5 others for the second loop? # Experiment ended with exit code 1 #Īh sorry, I thought the categories would be presented one after the other because you were talking about 8 different csv files and you have one outer loop. TrialList=data.importConditions(‘newConditionList1.csv’, selection=RowsLoop1),įile “/Applications/PsychoPy 2.app/Contents/Resources/lib/python3.8/psychopy/data/utils.py”, line 463, in importConditions I tried to change L "range(80), 40) and range(80)įile “/Users/Catherine/Desktop/SC-AAT_build/test_lastrun.py”, line 380, in Output = csv.DictWriter(file, fieldnames=header) # arrange to write our dictionaries to it With open(‘newConditionList1.csv’,‘w’) as file: # create a new CSV file Header = newConditions.keys() # get the header labels as a list # will end up as 20 randomly selected but balanced-for-consistency trials Shuffle(conditions) # randomise their orderĬonditions = conditions # select just ten of them Until now, we have a randomised block design, where the order of blocks is set to random. NewConditions = # define an initially empty listįor fileName in :Ĭonditions = data.importConditions(fileName) # create a list of dictionaries This is what underlies the random and sequential loop types in Builder, they work using the method of constants. Counterbalancing is simply an extension of blocking. Here, I have 8 categories, separated in 8 csv files. But with this code, we can see only 5 words instead of 40 like before…
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |