psychopy.org | Reference | Downloads | Github

RatingScale: rating output for skip keys

Hi,

I’m having participants rate different items with a rating scale. However, some of the items are not applicable to all, so I want to give participants an option to skip that question via the skipKeys argument. If I understand the documentation correctly, if they make use of the skip key, the getRating function should return None. If I press the skip key fast enough (say a couple of hundred ms) None indeed is the output. However, if I wait just a little before pressing, the output becomes the low end of the scale.

How do I make sure None is indeed the output of getRating even if I wait a bit with pressing the skip key?

Find below an example of the code I use. I’d appreciate any help!

Thanks!
Niklas

from psychopy import visual, event

win=visual.Window(color = (1,1,1),units = ‘pix’,fullscr = True, screen = 1)

def ratingIcons(win, icon):

ratingScale = visual.RatingScale(win, pos = (0,-350), low = -100, high = 100, scale = None, tickMarks = (-100,0,100),
                                     labels = ('Not attractive at all', ' ', 'Very attractive'), textColor = 'black',
                                     lineColor = 'black', precision = 1, marker = 'triangle', markerStart = 0, markerColor = 'DarkRed',
                                     singleClick = False, showValue = False, showAccept = True, acceptText = 'Confirm', stretch = 2, skipKeys = 'space')

textReminder = visual.TextStim(win, text = 'How attractive does this app look to you?',  pos = (0,350), color='black', height = 40 , wrapWidth = 1200)
theItem = visual.TextStim(win, text = '', color='black')

event.Mouse(visible = True)

while ratingScale.noResponse:
    theItem.setText(icon)
    theItem.draw()
    textReminder.draw()
    ratingScale.draw()
    win.flip()

rating = ratingScale.getRating()
ratingRT = ratingScale.getRT()

print icon, rating

someQuestions = [‘Q1’, ‘Q2’, ‘Q3’, ‘Q4’, ‘Q5’]

for aQuestion in someQuestions:
ratingIcons(win, aQuestion)

win.close()test.py (1.3 KB)

Hi @niklasjohannes, there seems to be a bug related to skipKeys. To get your None values for every response, you can replace the getRating function with the getHistory function, and just index the tuple with the rating information:

rating = ratingScale.getHistory()[1][0]

Hey @dvbridges, thanks, that does the trick! However, for those who have the same problem, I think it should be the last tuple, is that possible? Accessing the second tuple only worked for skipping, but not for rating.

rating = ratingScale.getHistory()[-1][0]

Yes it is possible. It sounds like we are seeing different outputs from getHistory. If you print(ratingScale.getHistory()) what is your output?

After skipping:

Q1 [(None, 0.0), (None, 1.079)]

After rating:

Q2 [(None, 0.0), (2, 3.272), (3, 3.355), (4, 3.371), (7, 3.39), (12, 3.41), (17, 3.427), (21, 3.441), (25, 3.457), (28, 3.475), (31, 3.489), (32, 3.507), (33, 3.524), (35, 3.539), (38, 3.573), (42, 3.589), (45, 3.604), (49, 3.623), (53, 3.637), (56, 3.655), (59, 3.672), (61, 3.688), (63, 3.705), (64, 3.739), (65, 3.77), (66, 3.808), (68, 3.822), (69, 3.839), (70, 3.856), (71, 3.889), (72, 4.004), (72, 5.492)]