psychopy.org | Reference | Downloads | Github

Data not logging Correctly

Hi,

I have created this Code:

if(Rating1.corr ==1):
feedback_text = “Correct!”
item_status = ‘CR’

elif(Rating1.corr ==0):
feedback_text = ‘Incorrect!’
item_status = ‘Miss’

if(Rating2.corr == 0):
feedback_text2 = ‘Correct!’
item_status = ‘CR’

elif(Rating2.corr ==1):
feedback_text2 = ‘Incorrect!’
item_status = ‘Miss’

if(Rating3.corr == 1):
feedback_text = ‘Correct!’
item_status = ‘CR’

elif(Rating3.corr ==0):
feedback_text == ‘Incorrect!’
item_status = ‘Miss’

if(Rating4.corr == 1):
feedback_text = ‘Correct!’
item_status1 = ‘Hit’

elif(Rating4.corr ==0):
feedback_text == ‘Incorrect!’
item_status1 = ‘FA’

if(Rating5.corr == 1):
feedback_text = ‘Correct!’
item_status1 = ‘Hit’

elif(Rating5.corr ==0):
feedback_text == ‘Incorrect!’
item_status1 = ‘FA’

if(Rating6.corr == 1):
feedback_text = ‘Correct!’
item_status1 = ‘Hit’

elif(Rating6.corr ==0):
feedback_text == ‘Incorrect!’
item_status1 = ‘FA’

As you can see, there are certain conditions in which I want the data file to show item_status1. The data logs accurately for all but 4, and 5. That is even though the data sheet records that rating4.corr = 1, it still says FA instead of Hit, same for rating4corr, but all the other scenarios seem to work. I have double-checked everything several times and I just can’t understand why it logs incorrectly for 4 and 5?

You are using six conditional statements to set two versions of each variable. I would only expect two of the six to work correctly.

Is elif .corr = 0 functionally the same as else ?

Yes it is. Also, the 6 statements correspond to 6 different keyboard responses on the routine. There are 3 corresponding columns in the spreadsheet that demonstrate what the correct answer is. Psychopy is even able to score the responses correctly and display correct feedback, but for some reason, it is unable to use that scoring and correctly identify hits and False alarms, only for rating4 and rating5.