Example #1
0
 def setMask(self,value, log=True):
     """Change the mask (all elements have the same mask). Avoid doing this
     during time-critical points in your script. Uploading new textures to the
     graphics card can be time-consuming."""
     self.mask = value
     createTexture(value, id=self._maskID, pixFormat=GL.GL_ALPHA, stim=self, res=self.texRes)
     logAttrib(self, log, 'mask')
Example #2
0
 def setTex(self,value, log=True):
     """Change the texture (all elements have the same base texture). Avoid this
     during time-critical points in your script. Uploading new textures to the
     graphics card can be time-consuming.
     """
     self.tex = value
     createTexture(value, id=self._texID, pixFormat=GL.GL_RGB, stim=self, res=self.texRes)
     logAttrib(self, log, 'tex')
Example #3
0
 def setMask(self,value, log=True):
     """Change the mask (all elements have the same mask). Avoid doing this
     during time-critical points in your script. Uploading new textures to the
     graphics card can be time-consuming."""
     self.mask = value
     createTexture(value, id=self._maskID, pixFormat=GL.GL_ALPHA, stim=self, res=self.texRes)
     if log and self.autoLog:
         self.win.logOnFlip("Set %s mask=%s" %(self.name, value),
             level=logging.EXP,obj=self)
Example #4
0
 def setMask(self,value, log=True):
     """Change the mask (all elements have the same mask). Avoid doing this
     during time-critical points in your script. Uploading new textures to the
     graphics card can be time-consuming."""
     self.mask = value
     createTexture(value, id=self._maskID, pixFormat=GL.GL_ALPHA, stim=self, res=self.texRes)
     if log and self.autoLog:
         self.win.logOnFlip("Set %s mask=%s" %(self.name, value),
             level=logging.EXP,obj=self)
Example #5
0
 def setMask(self,value, log=True):
     """Change the image to be used as an alpha-mask for the image
     """
     self.mask = value
     createTexture(value, id=self._maskID,
         pixFormat=GL.GL_ALPHA,dataType=GL.GL_UNSIGNED_BYTE,
         stim=self,
         res=self.texRes, maskParams=self.maskParams)
     logAttrib(self, log, 'mask')
Example #6
0
 def setMask(self,value, log=True):
     """Change the image to be used as an alpha-mask for the image
     """
     self.mask = value
     createTexture(value, id=self._maskID,
         pixFormat=GL.GL_ALPHA,dataType=GL.GL_UNSIGNED_BYTE,
         stim=self,
         res=self.texRes, maskParams=self.maskParams)
     if log and self.autoLog:
         self.win.logOnFlip("Set %s mask=%s" %(self.name, value),
             level=logging.EXP,obj=self)
Example #7
0
    def mask(self, value):
        """The alpha mask (forming the shape of the image)

        This can be one of various options:
            + 'circle', 'gauss', 'raisedCos', **None** (resets to default)
            + the name of an image file (most formats supported)
            + a numpy array (1xN or NxN) ranging -1:1
        """
        createTexture(value, id=self._maskID, pixFormat=GL.GL_ALPHA, stim=self,
            res=self.texRes, maskParams=self.maskParams)
        self.__dict__['mask'] = value
Example #8
0
    def tex(self, value):
        """
        + **'sin'**,'sqr', 'saw', 'tri', None (resets to default)
        + or the name of an image file (most formats supported)
        + or a numpy array (1xN or NxN) ranging -1:1

        The texture forming the image
        """
        createTexture(value, id=self._texID, pixFormat=GL.GL_RGB, stim=self,
            res=self.texRes, maskParams=self.maskParams)
        #if user requested size=None then update the size for new stim here
        if hasattr(self, '_requestedSize') and self._requestedSize == None:
            self.size = None  # Reset size do default
        self.__dict__['tex'] = value
Example #9
0
    def mask(self, value):
        """The alpha mask (forming the shape of the image)

        This can be one of various options:
            + 'circle', 'gauss', 'raisedCos', **None** (resets to default)
            + the name of an image file (most formats supported)
            + a numpy array (1xN or NxN) ranging -1:1
        """
        createTexture(value,
                      id=self._maskID,
                      pixFormat=GL.GL_ALPHA,
                      stim=self,
                      res=self.texRes,
                      maskParams=self.maskParams)
        self.__dict__['mask'] = value
Example #10
0
 def setMask(self, value, log=True):
     """Change the image to be used as an alpha-mask for the image
     """
     self.mask = value
     createTexture(value,
                   id=self._maskID,
                   pixFormat=GL.GL_ALPHA,
                   dataType=GL.GL_UNSIGNED_BYTE,
                   stim=self,
                   res=self.texRes,
                   maskParams=self.maskParams)
     if log and self.autoLog:
         self.win.logOnFlip("Set %s mask=%s" % (self.name, value),
                            level=logging.EXP,
                            obj=self)
Example #11
0
    def setImage(self, value, log=True):
        """Set the image to be used for the stimulus to this new value
        """
        self._imName = value

        wasLumImage = self.isLumImage
        if value == None:
            datatype = GL.GL_FLOAT
        else:
            datatype = GL.GL_UNSIGNED_BYTE
        self.isLumImage = createTexture(value,
                                        id=self._texID,
                                        stim=self,
                                        pixFormat=GL.GL_RGB,
                                        dataType=datatype,
                                        maskParams=self.maskParams,
                                        forcePOW2=False)
        #if user requested size=None then update the size for new stim here
        if hasattr(self, '_requestedSize') and self._requestedSize == None:
            self.size = None  # set size to default
        if log and self.autoLog:
            self.win.logOnFlip("Set %s image=%s" % (self.name, value),
                               level=logging.EXP,
                               obj=self)
        #if we switched to/from lum image then need to update shader rule
        if wasLumImage != self.isLumImage:
            self._needUpdate = True
Example #12
0
    def tex(self, value):
        """Texture to used on the stimulus as a grating (aka carrier)

        This can be one of various options:
            + **'sin'**,'sqr', 'saw', 'tri', None (resets to default)
            + the name of an image file (most formats supported)
            + a numpy array (1xN or NxN) ranging -1:1

        If specifying your own texture using an image or numpy array you should
        ensure that the image has square power-of-two dimesnions (e.g. 256x256).
        If not then PsychoPy will upsample your stimulus to the next larger
        power of two.
        """
        createTexture(value, id=self._texID, pixFormat=GL.GL_RGB, stim=self,
            res=self.texRes, maskParams=self.maskParams)
        #if user requested size=None then update the size for new stim here
        if hasattr(self, '_requestedSize') and self._requestedSize == None:
            self.size = None  # Reset size do default
        self.__dict__['tex'] = value
Example #13
0
    def tex(self, value):
        """Texture to used on the stimulus as a grating (aka carrier)

        This can be one of various options:
            + **'sin'**,'sqr', 'saw', 'tri', None (resets to default)
            + the name of an image file (most formats supported)
            + a numpy array (1xN or NxN) ranging -1:1

        If specifying your own texture using an image or numpy array you should
        ensure that the image has square power-of-two dimesnions (e.g. 256x256).
        If not then PsychoPy will upsample your stimulus to the next larger
        power of two.
        """
        createTexture(value,
                      id=self._texID,
                      pixFormat=GL.GL_RGB,
                      stim=self,
                      res=self.texRes,
                      maskParams=self.maskParams)
        #if user requested size=None then update the size for new stim here
        if hasattr(self, '_requestedSize') and self._requestedSize == None:
            self.size = None  # Reset size do default
        self.__dict__['tex'] = value
Example #14
0
    def setImage(self, value, log=True):
        """Set the image to be used for the stimulus to this new value
        """
        self._imName = value

        wasLumImage = self.isLumImage
        if value==None:
            datatype = GL.GL_FLOAT
        else:
            datatype = GL.GL_UNSIGNED_BYTE
        self.isLumImage = createTexture(value, id=self._texID, stim=self,
            pixFormat=GL.GL_RGB, dataType=datatype,
            maskParams=self.maskParams, forcePOW2=False)
        #if user requested size=None then update the size for new stim here
        if hasattr(self, '_requestedSize') and self._requestedSize==None:
            self.size = None  # set size to default
        logAttrib(self, log, 'image', value)
        #if we switched to/from lum image then need to update shader rule
        if wasLumImage != self.isLumImage:
            self._needUpdate=True
        self._needTextureUpdate = False
Example #15
0
    def setImage(self, value, log=True):
        """Set the image to be used for the stimulus to this new value
        """
        self._imName = value

        wasLumImage = self.isLumImage
        if value==None:
            datatype = GL.GL_FLOAT
        else:
            datatype = GL.GL_UNSIGNED_BYTE
        self.isLumImage = createTexture(value, id=self._texID, stim=self,
            pixFormat=GL.GL_RGB, dataType=datatype,
            maskParams=self.maskParams, forcePOW2=False)
        #if user requested size=None then update the size for new stim here
        if hasattr(self, '_requestedSize') and self._requestedSize==None:
            self.size = None  # set size to default
        if log and self.autoLog:
            self.win.logOnFlip("Set %s image=%s" %(self.name, value),
                level=logging.EXP,obj=self)
        #if we switched to/from lum image then need to update shader rule
        if wasLumImage != self.isLumImage:
            self._needUpdate=True