def test_setGammaRamp(): """test that the gamma ramp is set as requested""" testGamma = 2.2 win = visual.Window([600,600], autoLog=False) desiredRamp = numpy.tile( visual.gamma.createLinearRamp( rampSize=win.backend._rampSize, driver=win.backend._driver ), (3, 1) ) if numpy.all(testGamma == 1.0) == False: # correctly handles 1 or 3x1 gamma vals desiredRamp = desiredRamp**(1.0/numpy.array(testGamma)) win.gamma = testGamma for n in range(5): win.flip() setRamp = win.backend.getGammaRamp() win.close() # can't get/set LUT in travis utils.skip_under_travis() assert numpy.allclose(desiredRamp, setRamp, atol=1.0 / desiredRamp.shape[1])
def test_text_with_add(self): # pyglet text will reset the blendMode to 'avg' so check that we are # getting back to 'add' if we want it win = self.win text = visual.TextStim(win, pos=[0, 0.9]) grat1 = visual.GratingStim(win, size=2 * self.scaleFactor, opacity=0.5, pos=[0.3, 0.0], ori=45, sf=2 * self.scaleFactor) grat2 = visual.GratingStim(win, size=2 * self.scaleFactor, opacity=0.5, pos=[-0.3, 0.0], ori=-45, sf=2 * self.scaleFactor) text.draw() grat1.draw() grat2.draw() utils.skip_under_travis() utils.compareScreenshot('blend_add_%s.png' % (self.contextName), win, crit=20)
def test_gammaSetGetMatch(): """test that repeatedly getting and setting the gamma table has no cumulative effect.""" startGammaTable = None n_repeats = 2 for _ in range(n_repeats): win = visual.Window([600, 600], autoLog=False) for _ in range(5): win.flip() if startGammaTable is None: startGammaTable = win.backend.getGammaRamp() else: currGammaTable = win.backend.getGammaRamp() assert numpy.all(currGammaTable == startGammaTable) win.close() utils.skip_under_travis()
def test_gammaSetGetMatch(): """test that repeatedly getting and setting the gamma table has no cumulative effect.""" startGammaTable = None n_repeats = 2 for _ in range(n_repeats): win = visual.Window([600, 600], autoLog=False) for _ in range(5): win.flip() if startGammaTable is None: startGammaTable = win.backend.getGammaRamp() else: currGammaTable = win.backend.getGammaRamp() assert numpy.all(currGammaTable == startGammaTable) win.close() utils.skip_under_travis()
def test_refresh_rate(self): if self.win.winType=='pygame': pytest.skip("getMsPerFrame seems to crash the testing of pygame") #make sure that we're successfully syncing to the frame rate msPFavg, msPFstd, msPFmed = visual.getMsPerFrame(self.win,nFrames=60, showVisual=True) utils.skip_under_travis() # skip late so we smoke test the code assert (1000/150.0 < msPFavg < 1000/40.0), \ "Your frame period is %.1fms which suggests you aren't syncing to the frame" %msPFavg
def test_refresh_rate(self): if self.win.winType=='pygame': pytest.skip("getMsPerFrame seems to crash the testing of pygame") #make sure that we're successfully syncing to the frame rate msPFavg, msPFstd, msPFmed = visual.getMsPerFrame(self.win,nFrames=60, showVisual=True) utils.skip_under_travis() # skip late so we smoke test the code assert (1000/150.0 < msPFavg < 1000/40.0), \ "Your frame period is %.1fms which suggests you aren't syncing to the frame" %msPFavg
def test_text_with_add(self): # pyglet text will reset the blendMode to 'avg' so check that we are # getting back to 'add' if we want it win = self.win text = visual.TextStim(win, pos=[0, 0.9]) grat1 = visual.GratingStim(win, size=2*self.scaleFactor, opacity=0.5, pos=[0.3,0.0], ori=45, sf=2*self.scaleFactor) grat2 = visual.GratingStim(win, size=2 * self.scaleFactor, opacity=0.5, pos=[-0.3,0.0], ori=-45, sf=2*self.scaleFactor) text.draw() grat1.draw() grat2.draw() utils.skip_under_travis() utils.compareScreenshot('blend_add_%s.png' %(self.contextName), win, crit=20)