How to access trial number of routine (or, how to create catch trials within routine)

Hello ah5005

is the code you posted above the code you used in your experiment?

onesArray[:25] == 0
onesArray[51:100] == 1

I think the code does not what you want it to do, at least as I understand it. In PsychoPy you would write something such as

onesArray = []
for i in range(100):
    if i < 25:
        onesArray.append(0)
    else:
        onesArray.append(1)

shuffle(onesArray)

to fill the array(list) in a Begin Experiment tab.

Then in the Begin Routine tab:

checkCatch = onesArray.pop()

if checkCatch == 1:
    contrastVal  = level
else: 
    contrastVal = 0

BTW, if you follow Becca’s advice and put the 0s and 1s in an Excel-file, loop over this file and set it to randomize, you’ll get a unique randomized order each time the loop is called.

Best wishes Jens

2 Likes