psychopy.org | Reference | Downloads | Github

Reaction slider with loop

Hi,
I have a problem running a specified loop. I’m working with the builder using a slider for my response.

I used this for my code component:

if(Schmerzen.ticks == '1'):
    doSchmerzskalen = 1
else:
    doSchmerzskalen = 0
if(Schmerzen.ticks == '2'):
    doEmpfindungsskalen = 1
else:
    doEmpfindungsskalen = 0

when I run the experiment there is no reaction but this failure notice:

2019-09-25 23:14:27.240 python[4199:398432] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
/Users/regina/Documents/Schmerz1_lastrun.py:352: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if(Schmerzen.ticks == '1'):
/Users/regina/Documents/Schmerz1_lastrun.py:356: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if(Schmerzen.ticks == '2'):

Could you please help me to fix it?

Thanks,
FaceIt

This is just a warning rather than an error, but it looks like whatever Schmerzen.ticks is, it contains multiple values rather than a single value, and yet you are comparing it to a single value of '1'.

Try this to debug:

print(Schmerzen.ticks)
print(type(Schmerzen.ticks))

Hi @Michael,
Schmerzen.ticks is my slider where the participant could either klick “yes” or “no” so there are two values (ticks) ‘1’ or ‘2’.
I am using the builder, where could I insert your code to debug?

Thanks,
FaceIt

In your existing code component.

I’m not that familiar with the slider but you need to think about what comparison you actually want to make. Are you perhaps interested in the response that has been made, rather than the values of the ticks, which it seems you already know, and which will presumably be constant?