# Multiple Rating scale

**URL:** <https://discourse.psychopy.org/t/multiple-rating-scale/4197>\
**Category:** Builder\
**Created:** [March 24, 2018, 1:56pm UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197 "2018-03-24T13:56:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![danaolewski](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@danaolewski](https://discourse.psychopy.org/u/danaolewski)\
**Post date:** [March 24, 2018, 1:56pm UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197/1 "2018-03-24T13:56:02Z")

</div>

Hi all,

I am new to Psychopy, and I’m trying to build my first experiment.  
The propose of the experiment is to run a movie (let’s say for 15 sec) and while the movie run, the participant can rate the movie as many times he wants. I want to keep track of the rate and the second the participant rate.  
For example, if I rate at second 5 the movie as 4, at second 10 I can rate to 5, and so on.  
Important to say, the movie needs to run without stops for rating.  
I succeed to build an experiment that plays the movie and rate the first number I choose, but once I selected the rate, I cant change it.

Is there an option to run the movie with multiple rating?

Thanks in advance!

Here is the code I did:

# Create some handy timers

globalClock = core.Clock() # to track the time since experiment started  
routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine

# ------Prepare to start Routine “trial”-------

t = 0  
trialClock.reset() # clock  
frameN = -1  
continueRoutine = True

# update component parameters for each repeat

rating.reset()

# keep track of which components have finished

trialComponents = [movie, rating]  
for thisComponent in trialComponents:  
if hasattr(thisComponent, ‘status’):  
thisComponent.status = NOT\_STARTED

# -------Start Routine “trial”-------

while continueRoutine:  
# get current time  
t = trialClock.getTime()  
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)  
# update/draw components on each frame

```
# *movie* updates
if t >= 0.0 and movie.status == NOT_STARTED:
    # keep track of start time/frame for later
    movie.tStart = t
    movie.frameNStart = frameN # exact frame index
    movie.setAutoDraw(True)
# *rating* updates
if t >= 0.0 and rating.status == NOT_STARTED:
    # keep track of start time/frame for later
    rating.tStart = t
    rating.frameNStart = frameN # exact frame index
    rating.setAutoDraw(True)
```

---

<div class="post-metadata">

**Author:** ![Michael](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/michael/32/16_2.png) [@Michael](https://discourse.psychopy.org/u/Michael)\
**Post date:** [March 25, 2018, 5:53am UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197/2 "2018-03-25T05:53:56Z")

</div>

1:

> [@Please surround python code with backticks](https://discourse.psychopy.org/t/please-surround-python-code-with-backticks/1775):
>
> When you include python code on this forum please put triple “backticks” like this ``` on the line before and the line after your code. If you’ve done it correctly then your code will appear in a grey box with correct indentation like this (check the preview of your post on the right hand side before posting it) and other people will be better able to work out what might be right/wrong with your code. if myVal==True: break If you’ve already posted something that didn’t follow this rule th…

2:

I think you can set a rating scale to store of history of responses, rather than just collect one:

[http://www.psychopy.org/api/visual/ratingscale.html](http://www.psychopy.org/api/visual/ratingscale.html)

---

<div class="post-metadata">

**Author:** ![jeremygray](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jeremygray/32/13_2.png) [@jeremygray](https://discourse.psychopy.org/u/jeremygray)\
**Post date:** [March 26, 2018, 12:10am UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197/3 "2018-03-26T00:10:25Z")

</div>

Yes, `rating.getHistory()` is what you want. The values should be there already; there should be no need to do anything special to enable this feature.

Edit: For people using the Builder interface (which is not your situation), they DO have to enable it. There’s a checkbox on the Advanced tab.

---

<div class="post-metadata">

**Author:** ![danaolewski](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@danaolewski](https://discourse.psychopy.org/u/danaolewski)\
**Post date:** [March 26, 2018, 8:43pm UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197/4 "2018-03-26T20:43:12Z")

</div>

Thanks!

I already check the store history in the advanced tab,  
As follow:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/f/9/f9b35e56d2bb97c3e8a4baf58893608dd5973486.png)

But yet, when I run the experiment, I can only choose one rate, when I choose and click the triangle become grey, and I unable to change it.  
you can see in the photo below;  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/5/6/566af78d3945c9fd481aa8b32385ee7a57779205.jpeg)

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jeremygray](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jeremygray/32/13_2.png) [@jeremygray](https://discourse.psychopy.org/u/jeremygray)\
**Post date:** [March 26, 2018, 9:13pm UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197/5 "2018-03-26T21:13:41Z")

</div>

Ah, you are using Builder, ok. Un-check `Single click` – that option means “end the trial after exactly one response has been made”.

---

<div class="post-metadata">

**Author:** ![danaolewski](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@danaolewski](https://discourse.psychopy.org/u/danaolewski)\
**Post date:** [March 27, 2018, 1:42pm UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197/6 "2018-03-27T13:42:53Z")

</div>

Thanks!

I try that but then I get an empty excel as an output

---

<div class="post-metadata">

**Author:** ![jeremygray](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jeremygray/32/13_2.png) [@jeremygray](https://discourse.psychopy.org/u/jeremygray)\
**Post date:** [March 27, 2018, 1:59pm UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197/7 "2018-03-27T13:59:41Z")

</div>

In that case I suspect that the data are getting collected at run-time but not saved, because the accept button is not pressed. So to keep your experiment set up this way, and not require people to indicate accept, you’ll need to add a code component, and at the end of the routine add code

`thisExp.addData('history', rating.getHistory())`

---

<div class="post-metadata">

**Author:** ![danaolewski](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@danaolewski](https://discourse.psychopy.org/u/danaolewski)\
**Post date:** [March 30, 2018, 10:50am UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197/8 "2018-03-30T10:50:46Z")

</div>

Hi, I try to add this to the code, it still not working, I get an empty file.  
Only if I change the setting to show accept, and click on rate only at the end of the movie I get all the history rating.  
is there any other option to do this?

Thanks!

---

<div class="post-metadata">

**Author:** ![jeremygray](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jeremygray/32/13_2.png) [@jeremygray](https://discourse.psychopy.org/u/jeremygray)\
**Post date:** [March 30, 2018, 1:33pm UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197/9 "2018-03-30T13:33:39Z")

</div>

Try adding one more line to the code part, so that it looks like this:

```auto
thisExp.addData('history', rating.getHistory())
thisExp.nextEntry()
```

---

<div class="post-metadata">

**Author:** ![danaolewski](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@danaolewski](https://discourse.psychopy.org/u/danaolewski)\
**Post date:** [March 31, 2018, 5:36pm UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197/10 "2018-03-31T17:36:41Z")

</div>

I already have this in the code:

```auto
for thisComponent in trialComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)

thisExp.addData('rating.response', rating.getRating())
thisExp.addData('rating.rt', rating.getRT())
thisExp.addData('rating.history', rating.getHistory())
thisExp.nextEntry()

```

---

<div class="post-metadata">

**Author:** ![jeremygray](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jeremygray/32/13_2.png) [@jeremygray](https://discourse.psychopy.org/u/jeremygray)\
**Post date:** [April 6, 2018, 2:50pm UTC](https://discourse.psychopy.org/t/multiple-rating-scale/4197/11 "2018-04-06T14:50:54Z")

</div>

Lets try to get a minimal version working for you, then explore how your experiment differs from one that work for you. The following works for me with PsychoPy 1.85.

1. make a new experiment
2. add one ratingscale component
3. set its advanced settings to:

- disable: disappear, force-end-routine, show accept singleclick
- enable: store history, store rating, store rating time

1. no code components, loops, or anything else, just that one trial
2. save and run, set the marker to a few places, then press return to end the trial. look at the .csv data file. I get values in the data fields for the rating, the rt, and the history
