psychopy.org | Reference | Downloads | Github

Coding Participant Responses in Output

Hi there,

I have a routine where participants are given 2 items from a list of 3 items that they generated and are asked to fill in (by typing) the 3rd item that is not presented on screen.

I want three extra columns in my output data file labelled: correct, incorrect, and missed.
Right now, I have a column named ‘Target’ and one named ‘Response’.

Currently, this is the code I have:

thisExp.addData('Response', inputText)
inputText=""
Response = inputText.lower()

thisExp.addData('Correct', int(Response == Target))
thisExp.addData('Incorrect', int(Response != Target))
thisExp.addData('Missed', int(Response == 'pass'))

The problem is that no matter what a participant types in, it is always marked under the ‘incorrect’ column.
image

Additionally, when asked to print the Response and Target columns, only the items in the Target column are being printed which makes me think that maybe there is an error somewhere in the coding of the Response column.

print(Target)
print(Response)

image

Thanks in advance for your help!

That line (at least in its current location) guarantees the responses will be scored as incorrect.

Would you be able to help me solve that issue?

Delete that line.

It may be needed elsewhere (e.g. at the beginning or end of each trial, to reset the collected response to an empty string). But where it is currently, you are effectively deleting the response before you compare it to the correct answer, so the comparison will always be incorrect.

Thanks for the help!