Hi all,
We’re trying to make a between hand choice RT using builder.
We assigned ‘c’ key for the left-hand response, while ‘m’ key for the right-hand response.
For all the responses, we provide feedback.
For example, the imperative requires left-hand response,
the correct response (press ‘c’ in the absence of ‘m’ key response), we display RT.
If there is a ‘m’ key response, display ‘wrong choice’
No response, display ‘missed’
We set ‘all keys’ option for the response property.
In the function (begin routine), we tried the following:
if ('c' in RightStopResp.keys and 'c' in corrAns) and (RightStopResp.keys!='m'):
msg="RT=%.3f" %(RightStopResp.rt[0])
elif RightStopResp.keys=='m':
msg="wrong response"
else:
msg="missed"
But this doesn’t work.
It seems that registering no response using ‘m’ is the problem.
RightStopResp.keys is a list and you’re trying to compare it to a string (two different data types) - so I suspect you need to do what you did in the first clause
elif 'm' in RightStopResp.keys:
msg="wrong response"
else:
msg="missed"
In what situation would a participant press “m” - is the purpose of the study to train people not to press it?
If you move the whole lot into a code component in your test routine (end of routine tab) rather than the begin routine tab of your feedback routine it should work fine.
Hi Oli,
“In what situation would a participant press “m” - is the purpose of the study to train people not to press it?”
I didn’t explain full details, but this is a part of bimanual reaction time task which requires bimanual response, left hand only response or right hand only response.
Accordingly, it is likely that when “c” response is required (left hand only response) sometimes participants press ‘c’ as well as ‘m’ (fail to stop right hand response). We would like to mark this response as fail.
I moved the entire code into End Routine tab (please see attached).
But still the same…
Hi Oli,
Just letting you know that we managed to solve the issue based on your advice.
The final code looks like this:
if ('c' in RightStopResp.keys and 'c' in corrAns) and ('m' not in RightStopResp.keys): #correct response, if only "c" was pressed return RT
msg="RT=%.3f" %(RightStopResp.rt[0])
elif 'm' in RightStopResp.keys: # if participant pressed 'm' ('c' could be pressed before or after 'm' press, register as a wrong response
msg="wrong response"
else:
msg="missed" # everything else