Hi there,
I am working on a basic old new memory recognition task, and am having a hard time figuring out how to add columns to my output file to track participant responses. Rather than only tracking right and wrong responses, I want to add four columns to see if a participant got a “hit” (said the item was old when it was old), “miss” (said it was new when it was old), “correct rejection” (said it was new when it was new), and “false alarm” (said it was old when it was new). I also want to add a column called “no answer” for instances when the participant does not click anything at all.
In my Excel file that is fed into the routine, I have a column that marks whether the item is old or new, as well as one called “qp” (q for old, p for new) that is the same as the old new column, but just in the keys that I am using in my task for participants to respond. My current thought is that I could write code to compare the participants’ responses to the qp column, and mark it as a 1 in one of the four columns I described above. Here is the code I wrote to attempt to do this under “Begin Routine”:
if qp==key_resp.keys=='q':
thisExp.addData('Hit',1)
thisExp.addData('Miss',0)
thisExp.addData('False_Alarm',0)
thisExp.addData('Corr_Rej',0)
thisExp.addData('No_Answer',0)
elif qp==key_resp.keys=='p':
thisExp.addData('Hit',0)
thisExp.addData('Miss',0)
thisExp.addData('False_Alarm',0)
thisExp.addData('Corr_Rej',1)
thisExp.addData('No_Answer',0)
elif key_resp.keys=='q':
thisExp.addData('Hit',0)
thisExp.addData('Miss',0)
thisExp.addData('False_Alarm',1)
thisExp.addData('Corr_Rej',0)
thisExp.addData('No_Answer',0)
elif key_resp.keys=='p':
thisExp.addData('Hit',0)
thisExp.addData('Miss',1)
thisExp.addData('False_Alarm',0)
thisExp.addData('Corr_Rej',0)
thisExp.addData('No_Answer',0)
else:
thisExp.addData('Hit',0)
thisExp.addData('Miss',0)
thisExp.addData('False_Alarm',0)
thisExp.addData('Corr_Rej',0)
thisExp.addData('No_Answer',1)
The problem I am having is that no matter what kind of response I give when I go through the trials, it will always be marked as “No_Answer”. I suspect there is something I need to change about my else statement but I am not sure.
If I have made any really obvious mistakes, please excuse me as I am new to PsychoPy and just coding in general! I have been exclusively working in the builder view, so only suggestions related to that would be greatly appreciated.
Thanks in advance!