예제 #1
0
    def __init__(self,
                 win,
                 text,
                 pos=(0, 0),
                 color=0,
                 bg_color=None,
                 wrapWidth=1,
                 height=None):
        """
        Paramters
        ---------
            win : psychopy.Window instance
                window in which the text is drawn
            text : string
                text that will be presented
            pos: (-1..1, -1...1)
                x and y position of the center of the text in norm units
            color : 0..1023
                grey value of text
            bg_color : None or 0..1023
                grey value for the bg_color, if None the bg_color of the
                window will be used.
            wrapWidth : 0..2
                width of the text in norm units
            height : float or None
                height of the character (see psychopy for more details)

        """
        self.win = win
        if bg_color is None:
            bg_color = eizoGS320.decode_color(
                (win.color[0], win.color[1], win.color[2]))
        if bg_color[0] != bg_color[1]:
            print("WARNING: There is something wrong with the bg_color color")
        bg_color = bg_color[0]

        width_mon_half = int(win.size[0] / 2)
        x_pos_left = width_mon_half * (1 + pos[0])
        x_pos_right = width_mon_half * (-1 + pos[0])
        y_pos = 0 + pos[1] * int(win.size[1] / 2)

        self.stim_left = visual.TextStim(self.win,
                                         text,
                                         units="pix",
                                         pos=(x_pos_left, y_pos),
                                         colorSpace="rgb255",
                                         color=eizoGS320.encode_color(
                                             bg_color, color),
                                         height=height,
                                         wrapWidth=wrapWidth)
        self.stim_right = visual.TextStim(self.win,
                                          text,
                                          units="pix",
                                          pos=(x_pos_right, y_pos),
                                          colorSpace="rgb255",
                                          color=eizoGS320.encode_color(
                                              color, bg_color),
                                          height=height,
                                          wrapWidth=wrapWidth)
예제 #2
0
파일: midgrey.py 프로젝트: noum/stimuli
    def __init__(self, win, grey_left, grey_mid, grey_right, grey_background,
            name=None):

        """
        Paramters
        ---------

            win: psychopy.Window instance
            grey_left: 0..1023
                grey value for left infield
            grey_right: 0..1023
                grey value for left surround
            grey_mid: 0..1023
                grey value for right infield
            grey_background: 0..1023
                grey value of background (must be the same as the
                background of the window)

        """
        self.win = win
        self.grey_left = grey_left
        self.grey_mid = grey_mid
        self.grey_right = grey_right
        self.grey_background = grey_background
        self.name = name

        width_mon_half = 512.
        size_stim  = 99. # 1 deg
        size_between  = 50. # 0.5 deg
        x_pos_left = width_mon_half - (size_stim/2. + size_between +
                size_stim/2.)
        x_pos_right = -width_mon_half + (size_stim/2. + size_between +
                size_stim/2.)
        x_pos_mid_left = width_mon_half
        x_pos_mid_right = -width_mon_half
        y_pos = 0.

        self.stim_left = visual.GratingStim(self.win, tex=None, units="pix",
                pos=(x_pos_left, y_pos), size=size_stim, colorSpace="rgb255",
                color=eizoGS320.encode_color(grey_background, grey_left))
        self.stim_right = visual.GratingStim(self.win, tex=None, units="pix",
                pos=(x_pos_right, y_pos), size=size_stim, colorSpace="rgb255",
                color=eizoGS320.encode_color(grey_right, grey_background))
        self.stim_mid_l = visual.GratingStim(self.win, tex=None, units="pix",
                pos=(x_pos_mid_left, y_pos), size=size_stim, colorSpace="rgb255",
                color=eizoGS320.encode_color(grey_background, grey_mid))
        self.stim_mid_r = visual.GratingStim(self.win, tex=None, units="pix",
                pos=(x_pos_mid_right, y_pos), size=size_stim, colorSpace="rgb255",
                color=eizoGS320.encode_color(grey_mid, grey_background))
예제 #3
0
파일: textstim.py 프로젝트: noum/stimuli
    def __init__(self, win, text, pos=(0, 0), color=0, bg_color=None,
            wrapWidth=1, height=None):
        """
        Paramters
        ---------
            win : psychopy.Window instance
                window in which the text is drawn
            text : string
                text that will be presented
            pos: (-1..1, -1...1)
                x and y position of the center of the text in norm units
            color : 0..1023
                grey value of text
            bg_color : None or 0..1023
                grey value for the bg_color, if None the bg_color of the
                window will be used.
            wrapWidth : 0..2
                width of the text in norm units
            height : float or None
                height of the character (see psychopy for more details)

        """
        self.win = win
        if bg_color is None:
            bg_color = eizoGS320.decode_color((win.color[0],
                    win.color[1], win.color[2]))
        if bg_color[0] != bg_color[1]:
            print("WARNING: There is something wrong with the bg_color color")
        bg_color = bg_color[0]

        width_mon_half = int(win.size[0]/2)
        x_pos_left = width_mon_half * (1 + pos[0])
        x_pos_right = width_mon_half * (-1 + pos[0])
        y_pos = 0 + pos[1] * int(win.size[1]/2)

        self.stim_left = visual.TextStim(self.win, text, units="pix",
                pos=(x_pos_left, y_pos), colorSpace="rgb255",
                color=eizoGS320.encode_color(bg_color, color),
                height=height, wrapWidth=wrapWidth)
        self.stim_right = visual.TextStim(self.win, text, units="pix",
                pos=(x_pos_right, y_pos), colorSpace="rgb255",
                color=eizoGS320.encode_color(color, bg_color),
                height=height, wrapWidth=wrapWidth)
예제 #4
0
    def __init__(self, win, inf_left, sur_left, inf_right, sur_right,
            background):
        """
        :Paramters:

            win: psychopy.Window instance
            inf_left: 0..1023
                grey value for left infield
            sur_left: 0..1023
                grey value for left surround
            inf_right: 0..1023
                grey value for right infield
            sur_right: 0..1023
                grey value for right surround
            background: 0..1023
                grey value of background (must be the same as the
                background of the window)

        """
        self.win = win

        width_mon_half = 512
        size_inf  = 80
        size_sur  = 454
        size_diff = 40
        x_pos_right = size_diff/2.+size_sur/2.-width_mon_half
        x_pos_left = width_mon_half-size_diff/2.-size_sur/2.
        y_pos = 0

        self.sur_right = visual.GratingStim(win, tex=None, units="pix",
                pos=(x_pos_right, y_pos), size=size_sur, colorSpace="rgb255",
                color=eizoGS320.encode_color(sur_right, background))
        self.sur_left = visual.GratingStim(win, tex=None, units="pix",
                pos=(x_pos_left, y_pos), size=size_sur, colorSpace="rgb255",
                color=eizoGS320.encode_color(background, sur_left))
        self.inf_right = visual.GratingStim(win, tex=None, units="pix",
                pos=(x_pos_right, y_pos), size=size_inf, colorSpace="rgb255",
                color=eizoGS320.encode_color(inf_right, background))
        self.inf_left = visual.GratingStim(win, tex=None, units="pix",
                pos=(x_pos_left, y_pos), size=size_inf, colorSpace="rgb255",
                color=eizoGS320.encode_color(background, inf_left))
예제 #5
0
    #from grey_dict import grey_dict
    #patch_stim_rgb = grey_dict.values()

    ## Code to check for significant bit on the left side of the EIZO
    ## GS320 monitor
    #patch_stim_rgb = list()
    #for b in (0,1,2,4,8,16,32,64,128):
    #    patch_stim_rgb.append( (0,180,b) )

    ## Code to check for significant bit on the right side of the EIZO
    ## GS320 monitor
    #patch_stim_rgb = list()
    #for b in (0,1,2,4,8,16,32,64,128):
    #    patch_stim_rgb.append( (180,0,b) )

    ## all greys on EIZO GS320
    import eizoGS320
    #patch_stim_rgb = [eizoGS320.encode_color(x, x) for x in range(697,700)]
    patch_stim_rgb = [
        eizoGS320.encode_color(866, 871),
    ]
    print(patch_stim_rgb)

    mywin = visual.Window(size=(1024, 1536),
                          monitor='mymon',
                          color=(1, 1, 1),
                          screen=1,
                          colorSpace='rgb')

    getDepth(patch_stim_rgb, win=mywin, imi=0.5, colorSpace='rgb255', n=5)
예제 #6
0
    #        for b in range(100,150):
    #            patch_stim_rgb.append( (r,g,b) )

    #from grey_dict import grey_dict
    #patch_stim_rgb = grey_dict.values()


    ## Code to check for significant bit on the left side of the EIZO
    ## GS320 monitor
    #patch_stim_rgb = list()
    #for b in (0,1,2,4,8,16,32,64,128):
    #    patch_stim_rgb.append( (0,180,b) )

    ## Code to check for significant bit on the right side of the EIZO
    ## GS320 monitor
    #patch_stim_rgb = list()
    #for b in (0,1,2,4,8,16,32,64,128):
    #    patch_stim_rgb.append( (180,0,b) )

    ## all greys on EIZO GS320
    import eizoGS320
    #patch_stim_rgb = [eizoGS320.encode_color(x, x) for x in range(697,700)]
    patch_stim_rgb = [eizoGS320.encode_color(866, 871),]
    print(patch_stim_rgb)

    mywin = visual.Window(size=(1024,1536), monitor='mymon',
                color=(1,1,1), screen=1, colorSpace='rgb')

    getDepth(patch_stim_rgb, win=mywin, imi=0.5, colorSpace='rgb255', n=5)

예제 #7
0
    def __init__(self,
                 win,
                 grey_left,
                 grey_mid,
                 grey_right,
                 grey_background,
                 name=None):
        """
        Paramters
        ---------

            win: psychopy.Window instance
            grey_left: 0..1023
                grey value for left infield
            grey_right: 0..1023
                grey value for left surround
            grey_mid: 0..1023
                grey value for right infield
            grey_background: 0..1023
                grey value of background (must be the same as the
                background of the window)

        """
        self.win = win
        self.grey_left = grey_left
        self.grey_mid = grey_mid
        self.grey_right = grey_right
        self.grey_background = grey_background
        self.name = name

        width_mon_half = 512.
        size_stim = 99.  # 1 deg
        size_between = 50.  # 0.5 deg
        x_pos_left = width_mon_half - (size_stim / 2. + size_between +
                                       size_stim / 2.)
        x_pos_right = -width_mon_half + (size_stim / 2. + size_between +
                                         size_stim / 2.)
        x_pos_mid_left = width_mon_half
        x_pos_mid_right = -width_mon_half
        y_pos = 0.

        self.stim_left = visual.GratingStim(self.win,
                                            tex=None,
                                            units="pix",
                                            pos=(x_pos_left, y_pos),
                                            size=size_stim,
                                            colorSpace="rgb255",
                                            color=eizoGS320.encode_color(
                                                grey_background, grey_left))
        self.stim_right = visual.GratingStim(self.win,
                                             tex=None,
                                             units="pix",
                                             pos=(x_pos_right, y_pos),
                                             size=size_stim,
                                             colorSpace="rgb255",
                                             color=eizoGS320.encode_color(
                                                 grey_right, grey_background))
        self.stim_mid_l = visual.GratingStim(self.win,
                                             tex=None,
                                             units="pix",
                                             pos=(x_pos_mid_left, y_pos),
                                             size=size_stim,
                                             colorSpace="rgb255",
                                             color=eizoGS320.encode_color(
                                                 grey_background, grey_mid))
        self.stim_mid_r = visual.GratingStim(self.win,
                                             tex=None,
                                             units="pix",
                                             pos=(x_pos_mid_right, y_pos),
                                             size=size_stim,
                                             colorSpace="rgb255",
                                             color=eizoGS320.encode_color(
                                                 grey_mid, grey_background))
예제 #8
0
    def __init__(self, win, inf_left, sur_left, trans_left,
             inf_right, sur_right, trans_right, background,
             angle_left=20, angle_right=-20, opacity_left=0.5,
             opacity_right=0.5):
        """
        :Paramters:

            win: psychopy.Window instance
            inf_left: 0..1023
                grey value for left infield
            sur_left: 0..1023
                grey value for left surround
            trans_left: 0..1023
                grey value for left transparent layer
            angle_left: 0..360 or negative
                angle for rotation of transparent layer
            opacity_left: 0..1
                0 = completely transparent, 1 = opaque
            inf_right: 0..1023
                grey value for right infield
            sur_right: 0..1023
                grey value for right surround
            trans_right: 0..1023
                grey value for right transparent layer
            angle_right: 0..360 or negative
                angle for rotation of transparent layer
            opacity_right: 0..1
                0 = completely transparent, 1 = opaque
            background: 0..1023
                grey value of background (must be the same as the
                background of the window)

        """
        self.win = win

        width_mon_half = 512
        size_inf  = 80
        size_sur  = 390
        size_diff = 120
        x_pos_right = size_diff/2.+size_sur/2.-width_mon_half
        x_pos_left = width_mon_half-size_diff/2.-size_sur/2.
        y_pos = 0

        self.sur_right = visual.GratingStim(win, tex=None, units="pix",
                pos=(x_pos_right, y_pos), size=size_sur, colorSpace="rgb255",
                color=eizoGS320.encode_color(sur_right, background))
        self.sur_left = visual.GratingStim(win, tex=None, units="pix",
                pos=(x_pos_left, y_pos), size=size_sur,
                colorSpace="rgb255",
                color=eizoGS320.encode_color(background, sur_left))
        self.inf_right = visual.GratingStim(win, tex=None, units="pix",
                pos=(x_pos_right, y_pos), size=size_inf,
                colorSpace="rgb255",
                color=eizoGS320.encode_color(inf_right, background))
        self.inf_left = visual.GratingStim(win, tex=None, units="pix",
                pos=(x_pos_left, y_pos), size=size_inf, colorSpace="rgb255",
                color=eizoGS320.encode_color(background, inf_left))
        self.trans_right = visual.GratingStim(win, tex=None, units="pix",
                pos=(x_pos_right, y_pos), size=size_sur, colorSpace="rgb255",
                color=eizoGS320.encode_color(trans_right, background),
                ori=angle_right, opacity=opacity_right)
        self.trans_left = visual.GratingStim(win, tex=None, units="pix",
                pos=(x_pos_left, y_pos), size=size_sur, colorSpace="rgb255",
                color=eizoGS320.encode_color(background, trans_left),
                ori=angle_left, opacity=opacity_left)