psychopy.visual.RatingScale & .corr

Hello!
I’m creating an experiment with a visual rating continuous scale in which participants can use the mouse to select their confidence level in any point of the line. I also need to categorize their judgements as correct or incorrect depending on ‘left’/‘right’ choices because I’m using a StairCase to change the stimuli.
Someone knows how to create the correct answers in the rating to use them in the stairhandler? Would be similar to the .corr conditions in keyboard components…
Many thanks!

Hi @d142107004, I find these things easier using the new Slider, rather than using Rating Scale. Slider also allows you to create radio buttons for scales, which may seem more relevant for categorical responses like this. I would set up a slider, with only two responses labelled e.g., left and right. In my conditions file, I would add a “correctAns” column with the correct answers, e.g., left or right. Add a code component, and in the “Every Frame” tab check whether the rating was the same as the correct answer. E.g.,

if slider.getRating() is not None:  # If there was a rating
    rating = int(slider.getRating()) - 1  # Get the rating as an int (-1 as its used to index a Python list)
    if slider.labels[rating] == correctAns:  # If the rating label is the same as the correct answer
        continueRoutine = False  # End the Routine

Here is a demo - with all settings needed in the Slider for a radio Slider.

cond.xlsx (7.8 KB)
ratingCorr.psyexp (8.2 KB)

1 Like

Hi David!
Thanks a lot for your reply. I really appreciate the idea of using the Slider, it actually seems easier. However, I cannot run the demo you sent me, could you send it again with the .py code?
All the best.

Open the .psyexp file in PsychoPy and push the “Compile script” button in the toolbar to generate a .py script from it.

Thanks Michael.
Actually, the slider in the builder view is somehow “blocked” so when you compile the script you cannot access this information and the problem shown sais: “NameError: name ‘slider’ is not defined”. Do you know how to unblock the slider element?

I don’t really know what this means, but are you using the latest version of PsychoPy? The Slider is relatively new. You should be able to see an icon for it it in the Builder component panel in the “responses” section.

1 Like

Yes, I think you got to the problem, thanks.
I’m trying to use the standalone latest version 3.0.5 for windows but it doesn’t work… I’ll keep trying. Otherwise I’ll use the RatingScale element.

Thanks @Michael. @d142107004, what do you mean, that it does not work? Do you mean PsychoPy is failing due to an error? Or that the Slider does not work?

1 Like

The Slider works. After being able to run the PsychoPy 3.0.5 I can now see the two buttons for left and right. I will try to change it to a continuous variable with a line. Many thanks.