I want to add offset times for a stimulus which stays on the screen until the end of the routine. As you may know, the offset times are recorded only if the stimulus goes off the screen during the routine. For routines which keep the stimulus on till the end, offset times are not recorded.
So far, to get offset times I have been using the onset of the next stimulus (the next routine), but this is not the most viable option (during analysis, it makes things confusing).
So I tried putting a stimulus component to the very beginning of my experiment, and took it as a time reference, the time_reference here is a text component.
time_ref = time_reference.tStartRefresh
def getTimeStamp():
return time_ref + globalClock.getTime()
And then I use this to receive the offset time (I place the code to the end of the routine) assume the stimulus component I want to save the offset is “some_text” so, the offset would be:
thisExp.addData('some_text.stopped',getTimeStamp())
Doing this, I assume I can get accurate offset times. But it turns out that taking the onset of the next stimulus in the next routine is faster (it gives a smaller value), on average a ~20ms difference happens between the measurement of my custom offset code and the onset of the next stimulus.
This is not a huge difference, but as you can see it is not strictly accurate either. It would be a nice feature to have the opportunity to save offset times even if they last till the end of the routine.
EDIT: Oh wait, is it because I am not subtracting frameTolerance from my timestamp?