I came across a problem in my experiment during RT measurement. I want to present a stimulus for a fixed period, while continuously assessing RT. If no response occurred until a response deadline, the stimulus should dissappear, i.e. stimulus duration = response deadline.
In my initial version, as stimulus duration can be best controlled by presenting the stimulus for a fixed number of frames (to the best of my knowledge), I tried this routine:
def present_induct(picture):
pic.setImage(dir_pics + picture + '.bmp') # selects the picture
event.clearEvents()
win.callOnFlip(rt_ind_clock.reset)
for frameN in range(msec_to_fr(rt_deadline)): # msec_to_fr is a custom-written function to calculate a number of frames for a given msec input
pic.draw()
win.flip()
trigger_in = ~port_in.readData() & 255 # I assessed RT using a parallel port
if trigger_in in resp_keys:
rt_ind = rt_ind_clock.getTime()
resp_ind = [[trigger_in,rt_ind]]
return resp_ind
present_feedback('Too slow!') # if no response occured until the deadline, give feedback
resp_ind = [['deadline',0]]
return resp_ind
However, I realized that RT was only recorded at each screen refresh using this approach, i.e. my recorded RTs had only a resolution of 16ms. (The screen refresh rate was 60ms).
I could fix this problem by not drawing the stimulus each frame:
def present_induct(picture):
pic.setImage(dir_pics + picture + '.bmp')
event.clearEvents()
win.callOnFlip(rt_ind_clock.reset)
pic.draw()
win.flip()
while True: # do not skip the loop until a response occured or the deadline is reached
rt_ind = rt_ind_clock.getTime()
trigger_in = ~port_in.readData() & 255
if trigger_in in resp_keys:
resp_ind = [[trigger_in,rt_ind]]
return resp_ind
if rt_ind >= rt_deadline/1000: # the deadline was given in msec
present_feedback('Too slow!')
resp_ind = [['deadline',0]]
return resp_ind
This approach worked fine, assessing RT continuously. However, I was wondering if both approaches possibly could be combined, i.e. drawing the stimulus for an exact fixed number of frames and assessing RT continously during the stimulus presentation. I came across this thread (Calling win.flip() at every frame when using static stimuli: pros and cons), which I think would say no, but I was curious if there may be an updated approach allowing for that…
P.S: I will present the stimulus for 2.5 sec, so I guess presenting it for a fixed number of screen refreshes will be a bit over-the-top for my purpose. However, I was curious if it would be possible in principle.