I am studying code generated from the PsychoPy builder (as a practice exercise) and just noticed something strange. I 'd like to present a stimulus 0.5s after the beggining of a given trial. The builder generates the following piece of code:
t = trialClock.getTime() if t >= 0.5 and stim.status == NOT_STARTED: # keep track of start time/frame for later stim.tStart = t stim.frameNStart = frameN # exact frame index stim.setAutoDraw(True) if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip()
On LCD monitors, the refresh is a flood fill from top to bottom. Does the flip() method correspond to top (onset of refresh cycle, which I suspect) or bottom (end of refresh cycle)?
In a second exercise, I chose to present the stimulus at t = 0.2s during 0.2s. The builder then generates the following:
if t >= 0.2 and stim.status == NOT_STARTED: # keep track of start time/frame for later stim.tStart = t stim.frameNStart = frameN # exact frame index stim.setAutoDraw(True) frameRemains = 0.2 + 0.2- win.monitorFramePeriod * 0.75 # most of one frame period left if stim.status == STARTED and t >= frameRemains: stim.setAutoDraw(False)
I am confused. Why is ‘-win.monitorFramePeriod * 0.75’ added in this case?
Thanks for your help on this!