A class for getting numeric or categorical ratings, e.g., on a 1-to-7 scale.
Returns a re-usable rating-scale object having a .draw() method, with a customizable visual appearance. Tries to provide useful default values.
The .draw() method displays the rating scale only (not the item to be rated), handles the subject’s response, and updates the display. When the subject responds, .noResponse goes False (i.e., there is a response). You can then call .getRating() to obtain the rating, .getRT() to get the decision time, or .reset() to restore the scale (for re-use). The experimenter has to handle the item to be rated, i.e., draw() it in the same window each frame. A RatingScale instance has no idea what else is on the screen. The subject can use the arrow keys (left, right) to move the marker in small increments (e.g., 1/100th of a tick-mark if precision = 100).
Auto-rescaling happens if the low-anchor is 0 and high-anchor is a multiple of 10, just to reduce visual clutter.
Example 1:
*Default 7-point scale*::
myItem = <create your text, image, movie, ...>
myRatingScale = visual.RatingScale(myWin)
while myRatingScale.noResponse:
myItem.draw()
myRatingScale.draw()
myWin.flip()
rating = myRatingScale.getRating()
decisionTime = myRatingScale.getRT()
Example 2:
Mouse-free. Considerable customization is possible. For fMRI, if your response
box sends keys 1-4, you could specify left, right, and accept keys, and no mouse:
myRatingScale = visual.RatingScale(myWin, markerStart=4,
leftKeys='1', rightKeys = '2', acceptKeys='4')
Example 3:
Non-numeric choices (categorical, unordered):
myRatingScale = visual.RatingScale(myWin, choices=['agree', 'disagree'])
myRatingScale = visual.RatingScale(myWin,
choices=['cherry', 'apple', True, 3.14, 'pie'])
str(item) will be displayed, but the value returned by
getResponse() will be of type you gave it::
myRatingScale = visual.RatingScale(myWin, choices=[True, False])
So if you give boolean values and the subject chooses False,
getResponse() will return False (bool) and not 'False' (str).
See Coder Demos -> stimuli -> ratingScale.py for examples. As another example, fMRI_launchScan.py uses a rating scale for the experimenter to choose between two modes (and not for subjects giving ratings).
The Builder RatingScale component gives a restricted set of options, but also allows full control over a RatingScale (via ‘customizeEverything’).
| Author : | 2010 Jeremy Gray, 2011 updates |
|---|---|
| Parameters : |
|
Update the visual display, check for response (key, mouse, skip).
sets response flags as appropriate (self.noResponse, self.timedOut). draw() only draws the rating scale, not the item to be rated
Returns the seconds taken to make the rating (or to indicate skip). Returns None if no rating available. or maxTime if the response timed out.
Returns the numerical rating. None if the subject skipped this item; False if not available.
restores the rating-scale to its post-creation state (as “untouched” by the subject).
does not restore the scale text description (such reset is needed between items when rating multiple items)
Method to set the description that appears above the line, (e.g., “1=not at all...extremely=7”) The text will not be visible if showScale is False. This can be useful if re-using the same RatingScale object to get ratings of different dimentions. While its possible to just assign to rs.scaleDescription.text, its better to do rs.setDescription() which records the appropriate change in the log file.
Method to allow the experimenter to set the marker’s position on the scale (in units of tick marks). This method can also set the index within a list of choices (which start at 0). No range checking is done.
Assuming you have defined rs = RatingScale(...), you can specify a tick position directly:
rs.setMarkerPos(2)