I am working on a section in my experiment that includes an editable textBox component for participants to use when they respond to the task. Participants see a string and mark it as grammatical (G) or nongrammatical(N). Currently, the data file shows the participant response as this:
I would like to be able to check for accuracy - I have a list with the correct answers, but I was wondering if/how I might be able to place this in the data file, and have Psychopy check if the values that the participant inputs match the values on the list. I was also wondering if there is a way to only record what the participants type, without the âResponse:â there, as I think that might interfere with checking for accuracy.
Thank you for the video! However, I was wondering if this would work with the way my experiment is set up. The trial I am trying to check accuracy already has a loop, with strings that the participant responds to (trial _2 in the image below). If I nest the loops like this, will it be able to check the accuracy after the first loop has gone and the participants have typed their responses? I also donât want the feedback to show up on the screen, just to be included in the data file.
I used this code component, and while it worked, I think that having two loops caused the experiment conditions to run repeatedly, instead of just once. I removed the second loop and just put the file with the strings and the correct answers into one loop. However, now my experiment cuts out once it reaches that portion of the experiment, with no indications as to why.
Yes, you should only need one loop (I assumed the second loop was part of your design (i.e. that you wanted to repeat a loop several times) rather than associated with checking accuracy!).
Try adding some print statements to see where your experiment is âworkingâ until
e.g.
print('checking accuracy')
if key_resp_2.rt:
if textbox.text ==corrAns:
corr = 1
print('Answer was correct!')
else:
corr = 0
print('Answer was incorrect!')
trials_2.addData('correct', corr)
print('data saved')
From this you should be able to see in your stdout window which parts of the code were successfully executed before the crash. If you do not get any information in your stdout window, this could be a bug. Try closing psychopy, reopening it and then opening your .psyexp file through the open file icon in psychopy, rather than clicking on the .psyexp file directly