OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): v2021.2.3
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
I want to make sure 25% of my trials are catch trials, within a routine.
What did you try to make it work?:
I’ve created a 100x1 array, with 75 slots filled with 1’s, and 25 slots with 0’s.
I shuffle this array.
Now, I want to access the index of each array, such that if array(N) is 1, I call for a regular trial, if array(N) is 0, I call for a catch trial.
More technically, in the “Begin Experiment” tab, I have written:
onesArray = [ ]
onesArray[:25] == 0
onesArray[51:100] == 1
In the “Begin Routine” tab, I have written:
for trialNum in range(100)
checkCatch = onesArray[trialNum]
if checkCatch == 1:
contrastVal = level #the level variable comes from staircasing.
contrastVal = 0
What went wrong when you tried that?:
I think the problem is: I don’t know how to correctly call for the index of each trial.
Most often, I get this error:
TypeError: ‘list’ object is not callable
I have tried calling for the array in a multitude of ways, including trial number of the current routine, creating a for loop of some specific range, etc. None seem to work.
Thank you so much!