Multiple correct responses in Builder View

496 views
Skip to first unread message

Vyoma Shah

unread,
Sep 23, 2014, 1:32:03 PM9/23/14
to psychop...@googlegroups.com
Hi all,

My experiment is set up so that participants respond to numbers they see using a button box. Both 'b' and 'y' are correct responses some numbers presented, and both 'r' and 'g' work for other numbers presented. However, I'm having trouble filling in what the correct response should be. 

Currently, the stimuli are pulled out from an excel file, which also has a correct response column (which is the column psychopy looks at for the corr_resp variable). I tried using the method calling it "b, y" as well as "=OR(b, y)" but it's taking it as literal text and that's not working.

Any ideas?

Thanks,
V

Michael MacAskill

unread,
Sep 23, 2014, 7:21:15 PM9/23/14
to psychop...@googlegroups.com
Dear Vyoma,

This will require some custom code as the keyboard component can't make a comparison like that (it assumes there is only one possible correct answer).

So if your Keyboard component is set to end the routine, insert a Code component and in its "End routine" tab, put something like this:

if yourKeyboardComponentName.keys in eval(corr_resp):
thisExp.addData('Correct', 'Yes')
# whatever else needs to happen after a correct response
else:
thisExp.addData('Correct', 'No')

In your corr_resp column, the values should look like this:

"['b','y']"
"['r','g']"
etc

The quotes (double and single) are important here.

Don't put anything in the "Correct answer" and "Store correct" fields of the Keyboard competent, as you are handling those decisions in code now.

Untested, but hope this works for you.

Regards,

Michael
Reply all
Reply to author
Forward
0 new messages