Adding variables to the data output not working for incorrect/ no response

Hi everyone,

I’m creating an experiment for my research project and have the task prepared but I’m struggled to make sure the desired output is stored in the final part. If anyone knows how to help, then I would really appreciate it!

For the first type of trial, two (of four) stimuli are circled (the situation in which a stimulus is circled is given by ‘circle1_matches’ or ‘circle2_matches’). When participants see these two stimuli they have to press the opposite key to before (i.e. the incorrect key) in order to get a double reward. If they press the same key as before (i.e. the correct key) then they still get a single reward.

I have some code below which seems to work for the correct and incorrect responses, but when participants don’t press anything it is being recorded in one of the incorrect columns (if it is a circled stimulus then it is recorded as double reward, and if not then it is recorded as no reward). I have probably missed some mistake in the code:

#large loop based on response
#correct
if upvaluation_response.corr:
    
    #upvalued single reward
    if circle1_matches or circle2_matches:
        thisExp.addData('upvaluation_singlereward',1)
        thisExp.addData('upval_singlerewardRT', t)
        part6_points += 1
    
    #non-upvalued correct
    else: 
        thisExp.addData('upvaluation_standard',1)
        thisExp.addData('upval_standardRT', t)
        part6_points += 1

#incorrect
elif upvaluation_response.corr == 0 and upvaluation_response.keys != None:
    
    #upvalued double reward
    if circle1_matches or circle2_matches:
        thisExp.addData('upvaluation_doublereward',1)
        thisExp.addData('upval_singlerewardRT', t)
        part6_points += 2
    
    #non-upvalued incorrect
    else:
        thisExp.addData('upvaluation_noreward',1)
        thisExp.addData('upval_norewardRT', t)
        part6_points += 0

#too slow
elif upvaluation_response.corr == 0 and upvaluation_response.keys == None:
    
    #upvalued too slow
    if circle1_matches or circle2_matches:
        thisExp.addData('upvaluation_tooslow',1)
        part6_points += 0
    
    #non-upvalued too slow
    else:
        thisExp.addData('upvaluation_tooslow',1)
        part6_points += 0

For the second type of trial, two (out of four) stimuli are crossed out (this time its ‘cross1_matches’ and ‘cross2_matches’). When participants see these two stimuli, they shouldn’t press any button otherwise they get a punishment of -1 point. I specifically need to make sure that these trials are recorded as distinct from situations in which the stimuli are not crossed out and participants don’t press any button (i.e., they are too slow).

Here is the code for this part - it is having the same problem as the first part so I assume the fix will be the same:

#large loop based on response
#correct
if devaluation_response.corr:
    
    #devalued punishment
    if cross1_matches or cross2_matches:
        thisExp.addData('devaluation_punishment',1)
        thisExp.addData('deval_punishmentRT', t)
        part6_points = part6_points - 1
    
    #non-devalued correct
    else:
        thisExp.addData('devaluation_standard',1)
        thisExp.addData('deval_standardRT', t)
        part6_points += 1

#incorrect
elif devaluation_response.corr == 0 and devaluation_response.keys != None:
    
    #devalued punishment
    if cross1_matches or cross2_matches:
        thisExp.addData('devaluation_punishment',1)
        thisExp.addData('deval_punishmentRT', t)
        part6_points = part6_points - 1
    
    #non-devalued incorrect
    else:
        thisExp.addData('devaluation_noreward',1)
        thisExp.addData('deval_norewardRT', t)
        part6_points += 0

#too slow
elif devaluation_response.keys == None:
    
    #devalued avoid punishment
    if cross1_matches or cross2_matches:
        thisExp.addData('devaluation_avoidpunishment',1)
        thisExp.addData('deval_avoidpunishmentRT', t)
        part6_points += 0
    
    #all other cases
    else:
        thisExp.addData('devaluation_tooslow',1)
        part6_points += 0

I’ve tried quite a few variations on this so any help would be really appreciated, thanks!!
Sofie