Windows 10
v2021.2.3
I would like to present two grating stimuli that vary in orientation and opacity each trial in a randomized loop. The one on the left is called patchLeft
The one on the right is call patchRight
. The participant will be asked about either the orientation or the opacity (ex: which patch leans further to the right?), and will have a chance to respond. The orientation and opacity used will be different for each participant, and will be entered prior to each experiment into the code like this:
contr_set = [0.6, 1]
ori_set = [45, -45]
In order to have the correct question and response correspond to the correct contrast or orientation I made a spreadsheet to use as the loop parameters. In the sheet I have 6 parameters: [contrLeft, contrRight, oriLeft, oriRight, whichQuestion, corrAns]
contrLeft, contrRight, oriLeft, oriRight are all values of either 1 or 0. So for patchLeft
I enter ori_set[oriLeft]
in the orientation box, and contr_set[contrLeft]
in the opacity box. The same is done for patchRight
except as ori_set[oriRight]
and contr_set[contrRight]
.
I believe what this should do is to choose the given value from the list (at either position 1 or 0) and set that value as the opacity or orientation.
Running the experiment, it works as it should but randomly (since it is a random loop) will throw the error:
TypeError: list indices must be integers or slices, not NoneType
This is always because of patchLeft.setOpacity(contr_set[contrLeft])
I do not think it is the spread sheet itself because when I went through it sequentially once, it only threw the error after going through every variation I had listed.
I was wondering if it is because contr_set[contrLeft] is a float, but then why would it not throw the code for any other times that float is invoked.
My best guess at this point is that I am not calling the item from the list correctly, or am misunderstanding what I am actually doing the way I have it currently setup.
Any help would be appreciated.