I’m trying to workout how to loop through three different lists of sound stimuli for each of my loops. I create them at the beginning of the experiment in code. I tried following the advice from this link
Blocks of trials and counterbalancing — PsychoPy v2022.2.4 as it has worked for me before.
I created an excel sheet with Trial_Label as my 1 parameter, with three conditions, oddballPractice, oddballPractice_Two and, oddballPractice_Three.
oddballPractice = [{'trialType': 'standard', 'trialOnset': 1},
{'trialType': 'standard', 'trialOnset': 3.12},
{'trialType': 'standard', 'trialOnset': 5.61},
{'trialType': 'oddball', 'trialOnset': 8.78},
]
oddballPractice_Two = [{'trialType': 'standard', 'trialOnset': 1},
{'trialType': 'standard', 'trialOnset': 3.63},
{'trialType': 'standard', 'trialOnset': 4.91},
{'trialType': 'standard', 'trialOnset': 8.38},
]
oddballPractice_Three = [{'trialType': 'standard', 'trialOnset': 1},
{'trialType': 'standard', 'trialOnset': 3.63},
{'trialType': 'oddball', 'trialOnset': 4.21},
{'trialType': 'oddball', 'trialOnset': 6.38},
{'trialType': 'oddball', 'trialOnset': 8.68},
]
I had hoped that by changing the variable name to Trial_Label it would solve the issue
thisOnset = Trial_Label[oddballTrialN]['trialOnset']
thisTrialType = Trial_Label[oddballTrialN]['trialType']
However it’s giving me an error saying it must be interger, not string, I don’t think it’s selecting the list, just the variable name.
Has anyone run into a similar issue, or know how I can get my code to update the list name each loop as the below works perfectly, but I would like it to move through the other lists each loop.
thisOnset = oddballPractice[oddballTrialN]['trialOnset']