コード例 #1
0
    def test_numpyTexture(self):
        win = self.win
        grating = filters.makeGrating(res=64,
                                      ori=20.0,
                                      cycles=3.0,
                                      phase=0.5,
                                      gratType='sqr',
                                      contr=1.0)
        imageStim = visual.ImageStim(win,
                                     image=grating,
                                     size=3 * self.scaleFactor,
                                     interpolate=True)
        imageStim.draw()

        utils.compareScreenshot('numpyImage_%s.png' % (self.contextName), win)
        "{}".format(imageStim)  #check that str(xxx) is working
        win.flip()
        #set lowcontrast using color
        imageStim.color = [0.1, 0.1, 0.1]
        imageStim.draw()
        utils.compareScreenshot('numpyLowContr_%s.png' % (self.contextName),
                                win)
        win.flip()
        #now try low contrast using contr
        imageStim.color = 1
        imageStim.contrast = 0.1  #should have identical effect to color=0.1
        imageStim.draw()
        utils.compareScreenshot('numpyLowContr_%s.png' % (self.contextName),
                                win)
        win.flip()
コード例 #2
0
    def test_numpyTexture(self):
        win = self.win
        grating = filters.makeGrating(res=64, ori=20.0,
                                     cycles=3.0, phase=0.5,
                                     gratType='sqr', contr=1.0)
        imageStim = visual.ImageStim(win, image=grating,
                                     size = 3*self.scaleFactor,
                                     interpolate=True)
        imageStim.draw()

        utils.compareScreenshot('numpyImage_%s.png' %(self.contextName), win)
        str(imageStim) #check that str(xxx) is working
        win.flip()
        #set lowcontrast using color
        imageStim.color = [0.1,0.1,0.1]
        imageStim.draw()
        utils.compareScreenshot('numpyLowContr_%s.png' %(self.contextName), win)
        win.flip()
        #now try low contrast using contr
        imageStim.color = 1
        imageStim.contrast = 0.1#should have identical effect to color=0.1
        imageStim.draw()
        utils.compareScreenshot('numpyLowContr_%s.png' %(self.contextName), win)
        win.flip()
コード例 #3
0
#make clock object and hide mouse

clock = core.Clock()
mouse = event.Mouse(visible=False)

#define colours

colorstim = [0, 1, 2]  #red,green,blue

#define orientation

orientstim = [45, 135, 90]  #left,right,horizontal

#make grating

grating = filters.makeGrating(256, cycles=1)

texture_red = np.zeros([256, 256, 3])
texture_red[:, :, 0] = grating  #r
texture_red[:, :, 1] = -1  #g
texture_red[:, :, 2] = -1  #b

texture_green = np.zeros([256, 256, 3])
texture_green[:, :, 0] = -1  #r
texture_green[:, :, 1] = grating  #g
texture_green[:, :, 2] = -1  #b

texture_blue = np.zeros([256, 256, 3])
texture_blue[:, :, 0] = -1  #r
texture_blue[:, :, 1] = -1  #g
texture_blue[:, :, 2] = grating  #b
コード例 #4
0
pixels = 128

win = visual.Window((1024, 768), units='pix', allowGUI=True, bitsMode=None)
visual.TextStim(win, text='building stimuli').draw()

win.flip()

globalClock = core.Clock()

# for luminance modulated noise
noiseMatrix = num.random.randint(0, 2, [pixels, pixels])  # * noiseContrast
noiseMatrix = noiseMatrix * 2.0-1  # into range -1: 1

stimFrames = []; lumGratings=[]
# create the 4 frames of the sequence (luminance and contrast modulated noise in quadrature)
lumGratings.append(filters.makeGrating(pixels, 0, cyclesSpace, phase=0))
stimFrames.append(visual.GratingStim(win, texRes=pixels, mask='circle',
        size=pixels * 2, sf=1.0 / pixels, ori=90,
        tex= (noiseMatrix * info['lumModNoise'] + lumGratings[0] * info['lumModLum'])
        ))
lumGratings.append(filters.makeGrating(pixels, 0, cyclesSpace, phase=90) / 2.0 + 0.5)
stimFrames.append(visual.GratingStim(win, texRes=pixels, mask='circle',
        size=pixels * 2, sf=1.0/pixels, ori=90,
        tex= (noiseMatrix * info['contrastModNoise'] * lumGratings[1])
        ))
lumGratings.append(filters.makeGrating(pixels, 0, cyclesSpace, phase=180))
stimFrames.append(visual.GratingStim(win, texRes=pixels, mask='circle',
        size=pixels * 2, sf=1.0/pixels, ori=90,
        tex= (noiseMatrix * info['lumModNoise'] + lumGratings[2] * info['lumModLum'])
        ))
lumGratings.append(filters.makeGrating(pixels, 0, cyclesSpace, phase=270) / 2.0 + 0.5)
コード例 #5
0
win = visual.Window((1024, 768), units='pix', allowGUI=True, bitsMode=None)
visual.TextStim(win, text='building stimuli').draw()

win.flip()

globalClock = core.Clock()

# for luminance modulated noise
noiseMatrix = num.random.randint(0, 2, [pixels, pixels])  # * noiseContrast
noiseMatrix = noiseMatrix * 2.0 - 1  # into range -1: 1

stimFrames = []
lumGratings = []
# create the 4 frames of the sequence (luminance and contrast modulated noise in quadrature)
lumGratings.append(filters.makeGrating(pixels, 0, cyclesSpace, phase=0))
stimFrames.append(
    visual.GratingStim(win,
                       texRes=pixels,
                       mask='circle',
                       size=pixels * 2,
                       sf=1.0 / pixels,
                       ori=90,
                       tex=(noiseMatrix * info['lumModNoise'] +
                            lumGratings[0] * info['lumModLum'])))
lumGratings.append(
    filters.makeGrating(pixels, 0, cyclesSpace, phase=90) / 2.0 + 0.5)
stimFrames.append(
    visual.GratingStim(win,
                       texRes=pixels,
                       mask='circle',