Hello all,
I am trying to program a simple experiment on Psychopy Builder 1.90.3 for python2 on Mac Sierra 10.12.
In this experiment, subjects indicate whether they felt a change in temperature during a stimulus. I am trying to define a new variable called ‘response’ depending on their response and whether it was the correct response or not. I would like to add this variable to .csv output file.
In the ‘begin experiment’ tab, I defined my new variable, aka ‘response’.
In the ‘end routine’ tab, I am trying to define the ‘response’ variable in an if statement. This is where it does not work. It does not seem to go through the if statement.
I have spent hours reading online and trying different solutions, but I cannot get it to work.
Here is the code:
keys=answer.keys
#if there is a difference and they detect it, response type =1
if corrans == 2 and keys == 2:
response=1
#if there is no difference and they report no difference, response =2
elif corrans == 1 and keys == 1:
response=2
#if there is a difference and they report no difference, response =3
elif corrans == 2 and keys == 1:
response = 3
#if there is no difference and they report a difference, response =4
elif corrans == 1 and keys == 2:
response = 4
thisExp.addData('Response_type', response)
I would truly appreciate any suggestions.
Thanks a lot