Hi all,
I am trying to create a variable that calculates the approximate refresh rate and frame rate of my experiment. I’m trying to calculate those rates through a ‘frame_count’ variable, but it outputs values that are incorrect (e.g., ~9.00 for frame rate, and ~110 refresh rate). Can anyone spot something wrong with my code (pasted below)? Alternatively, is there a way to use ‘frameN’ as a way to output approximate frame and refresh rates?
Many thanks for the help!
Cait
Begin Routine
Start clocks
duration_clock = core.Clock()
Initialize the frame counters
frame_count = 0
Each Frame
if started == False and duration_clock.getTime() >= 1:
duration_clock.reset()
frame_count = 0
started=True
picture_stim.autoDraw = True
word_stim.autoDraw=True
if started == True and masked == False and picture_finished == False and (duration_clock.getTime()*1000 >= PICTURE_PRESENTATION_TIME_MS):
thisExp.addData(“picture_duration”, duration_clock.getTime()*1000)
picture_stim.autoDraw=False
picture_finished = True
if started == True and masked == False and (duration_clock.getTime() * 1000 >= WORD_PRESENTATION_TIME_MS):
thisExp.addData(“word_duration”, duration_clock.getTime()*1000)
word_stim.autoDraw = False
mask_stim.autoDraw = True
masked = True
if started == True and masked == True and (duration_clock.getTime() * 1000 >= WORD_PRESENTATION_TIME_MS + 100):
mask_stim.autoDraw = False
frame_count += 1
End Routine
Calculate average refresh duration
average_refresh_duration = (duration_clock.getTime()*1000)/frame_count
thisExp.addData(‘average_refresh_duration’, average_refresh_duration)
Approx frame duration
approx_frame_rate = 1000/average_refresh_duration
thisExp.addData(“approx_frame_rate”, approx_frame_rate)
Reset the stimuli
picture_stim.setAutoDraw(False)
word_stim.setAutoDraw(False)
mask_stim.setAutoDraw(False)
Reset the frame
frame_count = 0