PsychoPy version 1.82.01
Current Setup. I have an experiment in which a subject is presented a set of overturned cards and one card is subsequently flipped over with each button press they make. Thus, for each button press a new card is flipped over while all other cards from the previous trials remain the same (e.g., all other overturned cards remained overturned, all other ‘flipped over’ cards remain so).
To go about this, I have a routine titled ‘Deck’ with an image, deckImage, and keyboard response in addition to a loop called deckLoop around the routine. deckImage calls a parameter from an excel file called D1 in which there are 16 images (conditions). Each of the images are presented sequential order to accomplish the task described above (i.e., image 1 has all cards overturned, image 2 has Card X ‘flipped over’ and the rest remain overturned, image 3 has Card Y and Card X ‘flipped’ while the rest remain overturned, and so forth).
Problem. I want to use multiple decks throughout the course of experiment, but I don’t want to create a new routine for each one. What I’ve tried to do is create a second parameter in my excel file called D2 with a different set of images (different order of cards being flipped), and tried to hack the coder to randomly pick between the two. The ultimate goal is to add several more decks. So essentially, I want the image to randomly pick between one of X number of parameters, go through all the conditions in the parameter, then loop around and randomly pick again, and so on until the desired number of loops are completed.
My (Failed) Attempt at Fixing This. I’ve tried to hack this by creating a list with all the parameters and conditions (e.g., conditionList = [D1, D2, D3], first initialized as an empty list), and then randomly selecting from that list (using random.choice(conditionList); I imported random at the beginning of the experiment) and setting the result to be equal to another variable (let’s say ‘thisDeck’, also initialized at the beginning of the experiment). I then go into coder view and replace ‘deckImage.setImage(D1)’ with 'deckImage.setImage(thisDeck).
As it turns out, it sorta works. The program goes down the list of images, but doesn’t ‘stay’ in one parameter. That is, for the second trial, it might select image 2 from D1 but then select image 3 from D3 on the next trial.
Any ideas on how to get around this? I’m convinced it’s a straightforward fix, but I’m relatively new to coding in general so I’m a bit stuck. I apologize for any lack of clarity and am happy to further elaborate.
Thanks in advance for the help!