Hi Sarah, let me make an example. So imagine that you want to record the onset and offset time of a text component which starts at the beginning of the routine and ends 1 second after. If you look at the python code that is generated out of the builder script, you get:
while continueRoutine and routineTimer.getTime() > 0: # get current time t = trialClock.getTime() frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # text updates if t >= 0.0 and text.status == NOT_STARTED: # keep track of start time/frame for later text.tStart = t text.frameNStart = frameN # exact frame index text.setAutoDraw(True) frameRemains = 0.0 + 1.0- win.monitorFramePeriod * 0.75 # most of one frame period left if text.status == STARTED and t >= frameRemains: text.setAutoDraw(False) # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in trialComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # check for quit (the Esc key) if endExpNow or event.getKeys(keyList=["escape"]): core.quit() # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip()
So you know that the onset time is stored in text.tStart.You can add the instruction to get the offset time:
if text.status == STARTED and t >= frameRemains: text.setAutoDraw(False) text.tEnd = t
Then to save the value in the data file:
exp.addData('TextOnset', text.tStart)exp.addData('TextOffset', text.tEnd)
You might want to look at all the different components to see if they provide a more accurate timing procedure and maybe refer to that one.Did I answer to the question?