Hello! I am trying to build a SC-IAT by using psychopy, but I got some problems in randomizing the word items to present maintaining the proportion (i.e. in the first block with 7 positive_items, 7 name_items, 10 negative_items).
First, in the excel file I used only one column for word stimuli, where I wrote all together positive, negative and name items maintaining the proportion (so 7:10:7) and asked Psychopy to randomize the order and to show only one time the list in the first block.
That worked but it is not the randomization that I actually want. I would like to have a pull for each type of words in which there are a variable number of positive, negative and name words and ask the program to choose randomly only 7 positive and name_items, and 10 negative_ items and to show them in a randomized way.
I tried also in another different way, by using code. But no results and other problems
One code object in a start_Routine, where I uploaded the stimuli
##Import stimuli exemplars exemplars_filename = 'stimuli.xlsx' exemplars = data.importConditions(exemplars_filename) # Import stimuli exemplars ##Trial generation function def generate_trials(trial_type_column, multiplier): a = dict() # declare a dict to be populated for i in range(len(exemplars)): a[i] = [exemplars[i][trial_type_column]] * multiplier a = a.values() a = list(itertools.chain(*a)) # flatten the list of dicts into a list random.shuffle(a) return a
A code in the test_Routine
##set the block length and the rows to pull from based on the current block if blocks.thisN == 0: trial_rows = "0:3" # first row: name word, second: positive word, last: negative word n_block_repeats = 5 #5*3 = 15 trials modified_list_multiplier = list_multiplier
In this way I could not maintain the proportion, because it shown 5 items each type of items
I would like to set something like
blocks.thisN == 0: trial_rows = "0" # first row: name word n_block_repeats = 7 modified_list_multiplier = list_multiplier trial_rows = "1" # first row: positive word n_block_repeats = 7 modified_list_multiplier = list_multiplier trial_rows = "2" # first row: negative word n_block_repeats = 10 modified_list_multiplier = list_multiplier
But obviously I can’t.