当前位置: 首页>>代码示例>>Python>>正文


Python utils.compareScreenshot函数代码示例

本文整理汇总了Python中psychopy.tests.utils.compareScreenshot函数的典型用法代码示例。如果您正苦于以下问题:Python compareScreenshot函数的具体用法?Python compareScreenshot怎么用?Python compareScreenshot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了compareScreenshot函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testText

 def testText(self):
     win = self.win
     contextName=self.contextName
     #set font
     if win.winType=='pygame':
         if sys.platform=='win32': font = 'times'
         else:font = '/Library/Fonts/Times New Roman.ttf'
     else: font = 'Times New Roman'
     #using init
     stim = visual.TextStim(win,text=u'\u03A8a', color=[0.5,1.0,1.0], ori=15,
         height=0.8*self.scaleFactor, pos=[0,0], font=font) 
     stim.draw()
     #compare with a LIBERAL criterion (fonts do differ) 
     utils.compareScreenshot('data/text1_%s.png' %(contextName), win, crit=40)
     win.flip()#AFTER compare screenshot
     #using set
     stim.setText('y')
     stim.setFont(font)
     stim.setOri(-30.5)
     stim.setHeight(1.0*self.scaleFactor)
     stim.setColor([0.1,-1,0.8], colorSpace='rgb')
     stim.setPos([-0.5,0.5],'+')
     stim.draw()
     #compare with a LIBERAL criterion (fonts do differ)
     utils.compareScreenshot('data/text2_%s.png' %(contextName), win, crit=30)
开发者ID:richarddavis,项目名称:psychopy,代码行数:25,代码来源:testMany.py

示例2: test_gabor

    def test_gabor(self):
        win = self.win
        #using init
        gabor = visual.PatchStim(win, mask='gauss', ori=-45,
            pos=[0.6*self.scaleFactor, -0.6*self.scaleFactor],
            sf=2.0/self.scaleFactor, size=2*self.scaleFactor,
            interpolate=True, autoLog=False)
        gabor.draw()
        utils.compareScreenshot('gabor1_%s.png' %(self.contextName), win)
        win.flip()#AFTER compare screenshot

        #did buffer image also work?
        #bufferImgStim = visual.BufferImageStim(self.win, stim=[gabor])
        #bufferImgStim.draw()
        #utils.compareScreenshot('gabor1_%s.png' %(self.contextName), win)
        #win.flip()

        #using .set()
        gabor.setOri(45, log=False)
        gabor.setSize(0.2*self.scaleFactor, '-', log=False)
        gabor.setColor([45,30,0.3], colorSpace='dkl', log=False)
        gabor.setSF(0.2/self.scaleFactor, '+', log=False)
        gabor.setPos([-0.5*self.scaleFactor, 0.5*self.scaleFactor], '+', log=False)
        gabor.setContrast(0.8, log=False)
        gabor.setOpacity(0.8, log=False)
        gabor.draw()
        utils.compareScreenshot('gabor2_%s.png' %(self.contextName), win)
        win.flip()
        str(gabor) #check that str(xxx) is working
开发者ID:rpbaxter,项目名称:psychopy,代码行数:29,代码来源:test_all_stimuli.py

示例3: test_radial

    def test_radial(self):
        if self.win.winType=='pygame':
            pytest.skip("RadialStim dodgy on pygame")
        win = self.win
        #using init
        wedge = visual.RadialStim(win, tex='sqrXsqr', color=1,size=2*self.scaleFactor,
            visibleWedge=[0, 45], radialCycles=2, angularCycles=2, interpolate=False)
        wedge.draw()
        thresh = 10
        utils.compareScreenshot('wedge1_%s.png' %(self.contextName), win, crit=thresh)
        win.flip()#AFTER compare screenshot

        #using .set()
        wedge.mask = 'gauss'
        wedge.size = 3 * self.scaleFactor
        wedge.angularCycles = 3
        wedge.radialCycles = 3
        wedge.ori = 180
        wedge.contrast = 0.8
        wedge.opacity = 0.8
        wedge.radialPhase += 0.1
        wedge.angularPhase = 0.1
        wedge.draw()
        str(wedge) #check that str(xxx) is working
        utils.compareScreenshot('wedge2_%s.png' %(self.contextName), win, crit=10.0)
开发者ID:Lx37,项目名称:psychopy,代码行数:25,代码来源:test_all_stimuli.py

示例4: test_text

 def test_text(self):
     win = self.win
     if self.win.winType=='pygame':
         pytest.skip("Text is different on pygame")
     #set font
     fontFile = os.path.join(prefs.paths['resources'], 'DejaVuSerif.ttf')
     #using init
     stim = visual.TextStim(win,text=u'\u03A8a', color=[0.5, 1.0, 1.0], ori=15,
         height=0.8*self.scaleFactor, pos=[0,0], font='DejaVu Serif',
         fontFiles=[fontFile])
     stim.draw()
     #compare with a LIBERAL criterion (fonts do differ)
     utils.compareScreenshot('text1_%s.png' %(self.contextName), win, crit=20)
     win.flip()#AFTER compare screenshot
     #using set
     stim.text = 'y'
     if sys.platform=='win32':
         stim.font = 'Courier New'
     else:
         stim.font = 'Courier'
     stim.ori = -30.5
     stim.height = 1.0 * self.scaleFactor
     stim.setColor([0.1, -1, 0.8], colorSpace='rgb')
     stim.pos += [-0.5, 0.5]
     stim.contrast = 0.8
     stim.opacity = 0.8
     stim.draw()
     "{}".format(stim) #check that str(xxx) is working
     #compare with a LIBERAL criterion (fonts do differ)
     utils.compareScreenshot('text2_%s.png' %(self.contextName), win, crit=20)
开发者ID:kastman,项目名称:psychopy,代码行数:30,代码来源:test_all_stimuli.py

示例5: test_mov

 def test_mov(self):
     win = self.win
     if self.win.winType == 'pygame':
         pytest.skip("movies only available for pyglet backend")
     elif _travisTesting and not _anacondaTesting:
         pytest.skip("Travis with system Python doesn't seem to have a "
                     "working ffmpeg")
     win.flip()
     #construct full path to the movie file
     fileName = os.path.join(utils.TESTS_DATA_PATH, 'testMovie.mp4')
     #check if present
     if not os.path.isfile(fileName):
         raise IOError('Could not find movie file: %s'
                       % os.path.abspath(fileName))
     #then do actual drawing
     pos = [0.6*self.scaleFactor, -0.6*self.scaleFactor]
     mov = visual.MovieStim3(win, fileName, pos=pos, noAudio=True)
     mov.setFlipVert(True)
     mov.setFlipHoriz(True)
     for frameN in range(10):
         mov.draw()
         if frameN==0:
             utils.compareScreenshot('movFrame1_%s.png' %self.contextName,
                                     win, crit=10)
         win.flip()
     "{}".format(mov) #check that str(xxx) is working
开发者ID:isolver,项目名称:psychopy,代码行数:26,代码来源:test_all_stimuli.py

示例6: test_text

 def test_text(self):
     win = self.win
     if self.win.winType=='pygame':
         pytest.skip("Text is different on pygame")
     #set font
     fontFile = os.path.join(prefs.paths['resources'], 'DejaVuSerif.ttf')
     #using init
     stim = visual.TextStim(win,text=u'\u03A8a', color=[0.5,1.0,1.0], ori=15,
         height=0.8*self.scaleFactor, pos=[0,0], font='DejaVu Serif',
         fontFiles=[fontFile], autoLog=False)
     stim.draw()
     #compare with a LIBERAL criterion (fonts do differ)
     utils.compareScreenshot('text1_%s.png' %(self.contextName), win, crit=20)
     win.flip()#AFTER compare screenshot
     #using set
     stim.setText('y', log=False)
     if sys.platform=='win32':
         stim.setFont('Courier New', log=False)
     else:
         stim.setFont('Courier', log=False)
     stim.setOri(-30.5, log=False)
     stim.setHeight(1.0*self.scaleFactor, log=False)
     stim.setColor([0.1,-1,0.8], colorSpace='rgb', log=False)
     stim.setPos([-0.5,0.5],'+', log=False)
     stim.setContrast(0.8, log=False)
     stim.setOpacity(0.8, log=False)
     stim.draw()
     str(stim) #check that str(xxx) is working
     #compare with a LIBERAL criterion (fonts do differ)
     utils.compareScreenshot('text2_%s.png' %(self.contextName), win, crit=20)
开发者ID:rpbaxter,项目名称:psychopy,代码行数:30,代码来源:test_all_stimuli.py

示例7: test_text

 def test_text(self):
     win = self.win
     #set font
     fontFile = os.path.join(prefs.paths['resources'], 'DejaVuSerif.ttf')
     #using init
     stim = visual.TextStim(win,text=u'\u03A8a', color=[0.5,1.0,1.0], ori=15,
         height=0.8*self.scaleFactor, pos=[0,0], font='DejaVu Serif',
         fontFiles=[fontFile])
     stim.draw()
     #compare with a LIBERAL criterion (fonts do differ)
     utils.compareScreenshot('text1_%s.png' %(self.contextName), win, crit=20)
     win.flip()#AFTER compare screenshot
     #using set
     stim.setText('y')
     if sys.platform=='win32':
         stim.setFont('Courier New')
     else:
         stim.setFont('Courier')
     stim.setOri(-30.5)
     stim.setHeight(1.0*self.scaleFactor)
     stim.setColor([0.1,-1,0.8], colorSpace='rgb')
     stim.setPos([-0.5,0.5],'+')
     stim.setContrast(0.8)
     stim.setOpacity(0.8)
     stim.draw()
     #compare with a LIBERAL criterion (fonts do differ)
     utils.compareScreenshot('text2_%s.png' %(self.contextName), win, crit=20)
开发者ID:DiogoamCoutinho,项目名称:stimulus.py,代码行数:27,代码来源:test_all_stimuli.py

示例8: test_radial

    def test_radial(self):
        win = self.win
        #using init
        wedge = visual.RadialStim(win, tex='sqrXsqr', color=1,size=2*self.scaleFactor,
            visibleWedge=[0, 45], radialCycles=2, angularCycles=2, interpolate=False)
        wedge.draw()
        thresh = 10
        if win.winType != 'pygame':  # pygame definitely gets radialstim wrong!
            utils.compareScreenshot('wedge1_%s.png' %(self.contextName), win, crit=thresh)
        win.flip()#AFTER compare screenshot

        #using .set()
        wedge.mask = 'gauss'
        wedge.size = 3 * self.scaleFactor
        wedge.angularCycles = 3
        wedge.radialCycles = 3
        wedge.ori = 180
        wedge.contrast = 0.8
        wedge.opacity = 0.8
        wedge.radialPhase += 0.1
        wedge.angularPhase = 0.1
        wedge.draw()
        "{}".format(wedge) #check that str(xxx) is working
        if win.winType != 'pygame':  # pygame definitely gets radialstim wrong!
            utils.compareScreenshot('wedge2_%s.png' %(self.contextName), win, crit=10.0)
        else:
            pytest.skip("Pygame fails to render RadialStim properly :-/")
开发者ID:shigeakinishina,项目名称:psychopy,代码行数:27,代码来源:test_all_stimuli.py

示例9: test_gabor

    def test_gabor(self):
        win = self.win
        #using init
        gabor = visual.PatchStim(win, mask='gauss', ori=-45,
            pos=[0.6*self.scaleFactor, -0.6*self.scaleFactor],
            sf=2.0/self.scaleFactor, size=2*self.scaleFactor,
            interpolate=True)
        gabor.draw()
        utils.compareScreenshot('gabor1_%s.png' %(self.contextName), win)
        win.flip()#AFTER compare screenshot

        #did buffer image also work?
        #bufferImgStim = visual.BufferImageStim(self.win, stim=[gabor])
        #bufferImgStim.draw()
        #utils.compareScreenshot('gabor1_%s.png' %(self.contextName), win)
        #win.flip()

        #using .set()
        gabor.ori = 45
        gabor.size -= 0.2*self.scaleFactor
        gabor.setColor([45,30,0.3], colorSpace='dkl')
        gabor.sf += 0.2/self.scaleFactor
        gabor.pos += [-0.5*self.scaleFactor, 0.5*self.scaleFactor]
        gabor.contrast = 0.8
        gabor.opacity = 0.8
        gabor.draw()
        utils.compareScreenshot('gabor2_%s.png' %(self.contextName), win)
        win.flip()
开发者ID:yemu,项目名称:psychopy,代码行数:28,代码来源:test_all_stimuli.py

示例10: test_greyscaleImage

 def test_greyscaleImage(self):
     win = self.win
     fileName = os.path.join(utils.TESTS_DATA_PATH, 'greyscale.jpg')
     imageStim = visual.ImageStim(win, fileName, autoLog=False)
     imageStim.draw()
     utils.compareScreenshot('greyscale_%s.png' %(self.contextName), win)
     str(imageStim) #check that str(xxx) is working
开发者ID:rpbaxter,项目名称:psychopy,代码行数:7,代码来源:test_all_stimuli.py

示例11: test_radial

    def test_radial(self):
        if self.win.winType=='pygame':
            pytest.skip("RadialStim dodgy on pygame")
        win = self.win
        #using init
        wedge = visual.RadialStim(win, tex='sqrXsqr', color=1,size=2*self.scaleFactor,
            visibleWedge=[0, 45], radialCycles=2, angularCycles=2, interpolate=False, autoLog=False)
        wedge.draw()
        thresh = 10
        utils.compareScreenshot('wedge1_%s.png' %(self.contextName), win, crit=thresh)
        win.flip()#AFTER compare screenshot

        #using .set()
        wedge.setMask('gauss', log=False)
        wedge.setSize(3*self.scaleFactor, log=False)
        wedge.setAngularCycles(3, log=False)
        wedge.setRadialCycles(3, log=False)
        wedge.setOri(180, log=False)
        wedge.setContrast(0.8, log=False)
        wedge.setOpacity(0.8, log=False)
        wedge.setRadialPhase(0.1,operation='+', log=False)
        wedge.setAngularPhase(0.1, log=False)
        wedge.draw()
        str(wedge) #check that str(xxx) is working
        utils.compareScreenshot('wedge2_%s.png' %(self.contextName), win, crit=10.0)
开发者ID:rpbaxter,项目名称:psychopy,代码行数:25,代码来源:test_all_stimuli.py

示例12: test_winScalePosOri

    def test_winScalePosOri(self):
        """test window.viewScale and .viewPos simultaneous
        negative-going scale should mirror-reverse, and position should account for that
        visually, the green square/rect should move clockwise around the text

        Non-zero viewOri would not currently pass with a nonzero viewPos
        """
        with pytest.raises(NotImplementedError):
            w = visual.Window(size=(200,200), viewPos=(1,1), viewOri=1)

        for ori in [0, 45]:
            self.win.viewOri = ori
            for offset in [(0,0), (-.4,0)]:
                if ori and (offset[0] or offset[1]):
                    continue  # this combination is NotImplemented
                self.win.viewPos = offset
                for scale in [[1,1],  # normal: green at lower left
                              [1,-1],  # mirror vert only: green appears to move up, text mirrored
                              [-1,-1],  # mirror horiz & vert: green appears to move right, text normal but upside down
                              [-1,1],  # mirror horiz only: green appears to move down, text mirrored
                        [2,2],[2,-2],[-2,-2],[-2,2]]:  # same, but both larger
                    self.win.viewScale = scale
                    self.win.flip()
                    grn = visual.ShapeStim(self.win, vertices=v, pos=pgrn, size=n, fillColor='darkgreen')
                    img = visual.ImageStim(self.win, image=img_name, size=2*n, pos=pimg)
                    grn.draw()
                    img.draw()

                    oristr = str(ori)
                    scalestr = str(scale[0]) + ',' + str(scale[1])
                    posstr = str(offset[0]) + ',' + str(offset[1])
                    filename = 'winScalePos_ori%s_scale%s_pos%s.png' % (oristr, scalestr, posstr)
                    utils.compareScreenshot(filename, self.win, crit=15)
开发者ID:jeremygray,项目名称:psychopy,代码行数:33,代码来源:test_winScalePos.py

示例13: test_simpleimage

 def test_simpleimage(self):
     win = self.win
     fileName = os.path.join(utils.TESTS_DATA_PATH, 'testimage.jpg')
     if not os.path.isfile(fileName):
         raise IOError('Could not find image file: %s' % os.path.abspath(fileName))
     image = visual.SimpleImageStim(win, image=fileName, flipHoriz=True, flipVert=True)
     image.draw()
     utils.compareScreenshot('simpleimage1_%s.png' %(self.contextName), win, crit=5.0) # Should be exact replication
开发者ID:DiogoamCoutinho,项目名称:stimulus.py,代码行数:8,代码来源:test_all_stimuli.py

示例14: testRatingScale

 def testRatingScale(self):
     # try to avoid text; avoid default / 'triangle' because it does not display on win XP
     win = self.win
     win.flip()
     rs = visual.RatingScale(win, low=0,high=1,precision=100, displaySizeFactor=3, pos=(0,-.4),
                     lowAnchorText=' ', highAnchorText=' ', scale=' ', 
                     markerStyle='glow', markerStart=0.7, markerColor='darkBlue')
     rs.draw()
     utils.compareScreenshot('data/ratingscale1_%s.png' %(self.contextName), win, crit=30.0)
     win.flip()#AFTER compare screenshot
开发者ID:richarddavis,项目名称:psychopy,代码行数:10,代码来源:testMany.py

示例15: test_dotsUnits

 def test_dotsUnits(self):
     #to test this create a small dense circle of dots and check the circle
     #has correct dimensions
     fieldSize = numpy.array([1.0,1.0])*self.scaleFactor
     pos = numpy.array([0.5,0])*fieldSize
     dots = visual.DotStim(self.win, color=[-1.0,0.0,0.5], dotSize=5,
                           nDots=1000, fieldShape='circle', fieldPos=pos)
     dots.draw()
     utils.compareScreenshot('dots_%s.png' %(self.contextName), self.win, crit=20)
     self.win.flip()
开发者ID:Lx37,项目名称:psychopy,代码行数:10,代码来源:test_all_stimuli.py


注:本文中的psychopy.tests.utils.compareScreenshot函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。