OpenSesame videos
Python videos
Supported by Supported by

Access response history

instance responses

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

A responses object is created automatically when the experiment starts.

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.

Example:

print('The accuracy was %s%%' % responses.acc)

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.

Example:

print('The average RT was %s ms' % responses.avg_rt)

function responses.clear()

Clears all responses.

Example:

responses.clear()

property responses.correct

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

Example:

for correct in responses.correct:
        print(correct)

property responses.feedback

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

Example:

for feedback in responses.feedback:
        print(feedback)

property responses.item

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

Example:

for item in responses.item:
        print(item)

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.)

Example:

for response in responses.response:
        print(response)

property responses.response_time

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

Example:

for rt in responses.response_time:
        print(rt)
Supported by Supported by