Reaction time accumulated
Hi,
I am running into a problem with measuring the reaction time. I intended to set the onset of calculation as the appearance of responses and the offset as clicking the response button for each trial. However, it seems that the reaction time generated in the output file is time of each click "minus" the time of the very first appearance of the response (instead of each appearance of the response in each trial). Anyone has an ideia how should I improve the script ?
Thanks for your attention!
reponse_not_pressed = True
my_mouse = Mouse(visible=True)
t = canvas_response.show()
while reponse_not_pressed == True:
timestamp, (x, y), button = my_mouse.get_click()
for element in canvas_response.elements_at(x, y):
if not element.startswith('Button'):
continue
if element == 'Button_1':
var.response_trial = '1'
var.reaction_time_trial = timestamp - t
reponse_not_pressed = 'False'
if element == 'Button_3':
var.response_trial = '3'
var.reaction_time_trial = timestamp - t
reponse_not_pressed = 'False'
canvas_response.show()
if var.response_trial == var.correct_response:
var.accuracy_trial = 1
else:
var.accuracy_trial = 0
Comments
reponse_not_pressed = True my_mouse = Mouse(visible=True) while reponse_not_pressed == True: timestamp, (x, y), button = my_mouse.get_click() for element in canvas_response.elements_at(x, y): t = canvas_response.show() if not element.startswith('Button'): continue if element == 'Button_1': var.response_trial = '1' var.reaction_time_trial = timestamp - t reponse_not_pressed = 'False' if element == 'Button_3': var.response_trial = '3' var.reaction_time_trial = timestamp - t reponse_not_pressed = 'False' canvas_response.show() if var.response_trial == var.correct_response: var.accuracy_trial = 1 else: var.accuracy_trial = 0Does this work? (I moved the definition of t inside the loop rather than before.
Eduard