Skip to content
Permalink
Browse files

BF: fix to new timing mechanism for first frame of a routine

For clock='now' we weren't taking into account the fact that the time
could have gone BEYOND the next refresh already and ended up adding in
that as an effective gap before presenting
  • Loading branch information...
peircej committed Sep 6, 2019
1 parent 9132bc3 commit 8ddab41a699b463f0a65f9cecd05ce8374164baf
Showing with 3 additions and 3 deletions.
  1. +3 −3 psychopy/visual/window.py
@@ -24,6 +24,7 @@

from psychopy.contrib.lazy_import import lazy_import
from psychopy import colors
import math
from psychopy.clock import monotonicClock

# try to find avbin (we'll overload pyglet's load_library tool and then
@@ -816,16 +817,15 @@ def getFutureFlipTime(self, targetTime=0, clock=None):
timeNext = lastFlip + self.monitorFramePeriod
now = baseClock.getTime()
if (now + targetTime) > timeNext: # target is more than 1 frame in future
extraFrames = round((now + targetTime - timeNext)/self.monitorFramePeriod)
extraFrames = math.ceil((now + targetTime - timeNext)/self.monitorFramePeriod)
thisT = timeNext + extraFrames*self.monitorFramePeriod
else:
thisT = timeNext

# convert back to target clock timebase
if clock=='ptb': # add back the lastResetTime (that's the clock difference)
output = thisT + baseClock.getLastResetTime()
elif clock=='now': # time from now is easy!
output = timeNext - now
output = thisT - now
elif clock:
output = thisT + baseClock.getLastResetTime() - clock.getLastResetTime()
else:

0 comments on commit 8ddab41

Please sign in to comment.
You can’t perform that action at this time.