psychopy.org | Reference | Downloads | Github

How to add attention checks to a excel file in which the order of presenting stimuli is counterbalanced?

Hi everyone. I have an excel file with two columns of ‘standard’ and ‘deviant’ and I need to present standard stimuli two times and deviant once and participants must say which one is the deviant one. then I have a piece of code which counterbanace the order in which the first stimulus is different from the other two or second one is different of the third one is different. This is my code:

LIST2=[standard,standard,devient]

count1=0
count2=0
count3=0

maxRes = 10
seqs = 30
def findDev(l):
    return l.index(devient)

def check(maxRes,l):
    global count1,count2,count3
    shuffle(l)
    d = findDev(l)
    if(d == 0):
        if(count1 < maxRes):
            count1 += 1
            return l
        else:
            return check(maxRes,l)
    elif(d == 1):
        if(count2 < maxRes):
            count2 += 1
            return l
        else:
            return check(maxRes,l)
    else:
        if(count3 < maxRes):
            count3 += 1
            return l
        else:
            return check(maxRes,l)

for i in range(0,seqs):
    LISTreg=check(maxRes,LIST2)


soundVar = 0

And then in the sound routine I use this:

$LISTreg[soundVar]

Now what I should do is adding two attention check conditions to the excel file in some places but I don’t what them to interfere with this counterbalanced conditions. I have no idea of how I can do this.
I appreciate any help.