OpenSesame videos
Python videos

Access response history

class responses

The responses object contains the history of the responses that were collected during the experiment.

In addition to the functions listed below, the following semantics are supported:

Example:

# Loop through all responses, where last-given responses come first
# Each response has correct, response, response_time, item, and feedback
# attributes.
for response in responses:
        print(response.correct)
# Print the two last-given respones
print('last_two responses:')
print(responses[:2])

property responses.acc

The percentage of correct responses for all responses that are included in feedback. If there are no responses to give feedback on, 'undefined' is returned.

function responses.add(response=None, correct=None, response_time=None, item=None, feedback=True)

Adds a response.

Example:

responses.add(response_time=500, correct=1, response='left')

Keywords:

  • response -- The response value, for example, 'space' for the spacebar, 0 for joystick button 0, etc.
    • Default: None
  • correct -- The correctness of the response.
    • Type: bool, int, None
    • Default: None
  • response_time -- The response_time.
    • Type: float, int, None
    • Default: None
  • item -- The item that collected the response.
    • Type: str, None
    • Default: None
  • feedback -- Indicates whether the response should be included in feedback on accuracy and average response time.
    • Type: bool
    • Default: True

property responses.avg_rt

The average response time for all responses that are included in feedback. If there are no responses to give feedback on, 'undefined' is returned.

function responses.clear()

Clears all responses.

Example:

responses.clear()

property responses.correct

A list of all correct (0, 1, or None) values.

property responses.feedback

A list of the feedback status (True or False) associated with each response.

property responses.item

A list of all item names (str or None) associated with each response.

function responses.reset_feedback()

Sets the feedback status of all responses to False, so that only new responses will be included in feedback.

Example:

responses.reset_feedback()

property responses.response

A list of all response values. (I.e. not response objects, but actual response keys, buttons, etc.)

property responses.response_time

A list of all response times (float or None).

Supported by Supported by