Giving Feedback to VAS-Rating (correct number stored in excel-file)

Hi everyone!
I’m trying to create an experiment where participants see a fraction and need to locate it on a visual analogue scale from 0 to 1.

I defined my conditions (my fractions) in an excel-file. I also want to give participants feedback on their rating. So far i tried this code and stored the possible numbers in the excel-file. It works but not ideal ! :frowning:
Bildschirmfoto 2020-06-25 um 13.50.52


My Code:
in Stim - each Frame
if rating.getRating() == CorrectAns or rating.getRating() == CorrectAns1 or rating.getRating() == CorrectAns2:
rating.corr = 1
else:
rating.corr = 0

In feedback select begin experiment:
nRespCorr = 0
nRespIncorr = 0

Begin Routine
if rating.corr == 1:
nRepsCorr = 1
nRepsIncorr = 0
else:
nRepsCorr = 0
nRepsIncorr = 1

Is it possible to give a range rather than a specific number? Since it’s hard to get the exact possible ratings from the VAS this would be a much more precise way to tell the participant how exact their rating was.

Thank You so much for any suggestions! :slight_smile:

You could try using the builtin Python function range in your if statements, something like:

if rating.getRating() in range(CorrectAns-5, CorrectAns+5):

meaning it would check whether the rating was within 5 of the correct answer in either direction

1 Like

Thank You so much for your help. This is exactly what i needed, however i keep getting this error message:

if rating.getRating() in range(CorrectAns-0.1, CorrectAns+0.1):
TypeError: ‘numpy.float64’ object cannot be interpreted as an integer

Experiment ended.

Do you know a way to fix this? Thank you!

Ah, that’ll be because either CorrectAns or rating.getRating() is a numpy.float64 object and not a number. To get the value itself, just add .item() to the end, e.g. CorrectAns.item(), as this is the command for numpy objects which extracts their numeric value.

I’ve added the .item() to it but it still won’t work? :confused: CorrectAns in my Excel sheet is 0.1

Ah okay, it looks like range doesn’t work with non-integer values…

In that case your best option is probably:

if (rating.getRating()  >= CorrectAns-0.1) and (rating.getRating() <= CorrectAns+0.1):