Difference between revisions of "Holcombe:FahedProject"

From OpenWetWare
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 14: Line 14:
  
 
In visual.py:
 
In visual.py:
*The following code has been added above the 'def setVertices' line to allow us to set the contrast colour of the fill within shapestim:
+
*The following code has been added above the 'def setVertices' line to allow us to set the contrast, and colour of the fill and lines within shapestim:
<code>   def setFillRGB(self,value,operation=None): #expects three values  
+
<code>
 +
    def setFillRGB(self,value,operation=None): #expects three values  
 
         if type(value) in [tuple,list]:
 
         if type(value) in [tuple,list]:
 
             value=numpy.asarray(value,float)         
 
             value=numpy.asarray(value,float)         
Line 21: Line 22:
 
         #print 'fillRGB type=',type(self.fillRGB),' =',self.fillRGB,'whereas value wanted to assign=',value,
 
         #print 'fillRGB type=',type(self.fillRGB),' =',self.fillRGB,'whereas value wanted to assign=',value,
 
         #print ' and self =',self
 
         #print ' and self =',self
          
+
    def setLineRGB(self,value,operation=None): #expects three values
 +
         if type(value) in [tuple,list]:
 +
            value=numpy.asarray(value,float)       
 +
        self.lineRGB=numpy.array(value, float)
 +
        #print 'lineRGB type=',type(self.lineRGB),' =',self.lineRGB,'whereas value wanted to assign=',value,
 +
        #print ' and self =',self       
 
         #if we don't have shaders we need to rebuild the texture
 
         #if we don't have shaders we need to rebuild the texture
 
         #if not self._useShaders:
 
         #if not self._useShaders:
 
         #    self.setTex(self._texName)
 
         #    self.setTex(self._texName)
     def setFillContrast(self,value): #
+
     def setFillContrast(self,value): #THIS DOESN'T WORK
 
       self.contrast = value  
 
       self.contrast = value  
 
       desiredRGB = (self.fillRGB*self.contrast+1)/2.0#RGB in range 0:1 and scaled for contrast
 
       desiredRGB = (self.fillRGB*self.contrast+1)/2.0#RGB in range 0:1 and scaled for contrast
Line 31: Line 37:
 
       if numpy.any(desiredRGB**2.0>1.0): #if outside -1,1 range, then
 
       if numpy.any(desiredRGB**2.0>1.0): #if outside -1,1 range, then
 
           desiredRGB=numpy.array([0.6,0.6,0.4]) #set to arbitrary val
 
           desiredRGB=numpy.array([0.6,0.6,0.4]) #set to arbitrary val
       self.setFillRGB(value=desiredRGB)    #self is understood</code>
+
       self.setFillRGB(value=desiredRGB)    #self is understood
 +
</code>

Latest revision as of 19:15, 18 June 2009

Members

Alex Holcombe
Polly Barr
• Charlie Ludowici
• Kim Ransley
• Ingrid Van Tongeren
William Ngiam
Fahed Jbarah
• Patrick Goodbourn
Alumni



Technical

Skills Checklist
Python Programming
Psychopy/VisionEgg Installation Notes
R analysis,plot,stats
Statistics
Buttonbox
Buttonbox with photocell
Programming Cheat Sheets


  • Moving dot patch gives 17 ms interframe times but only on old Kuna laptop, not on newer white MacBook
  • setText apparently takes a lot of time, dozens of msec (debugText.setText)

Changes made to visual.py and misc.py

In misc.py:

  • the following code has been inserted above the line that imports image and cPickle:

def ObjectArray(inputSeq):

   return numpy.array(inputSeq, 'O')
  • and the function attribute "numpy.array"has been added to the line defining the variable cmSize in the definition of the function 'deg2pix' to yield:

cmSize = deg2cm(numpy.array(degrees), monitor)

In visual.py:

  • The following code has been added above the 'def setVertices' line to allow us to set the contrast, and colour of the fill and lines within shapestim:

   def setFillRGB(self,value,operation=None): #expects three values 
       if type(value) in [tuple,list]:
           value=numpy.asarray(value,float)        
       self.fillRGB=numpy.array(value, float)
       #print 'fillRGB type=',type(self.fillRGB),' =',self.fillRGB,'whereas value wanted to assign=',value,
       #print ' and self =',self
   def setLineRGB(self,value,operation=None): #expects three values 
       if type(value) in [tuple,list]:
           value=numpy.asarray(value,float)        
       self.lineRGB=numpy.array(value, float)
       #print 'lineRGB type=',type(self.lineRGB),' =',self.lineRGB,'whereas value wanted to assign=',value,
       #print ' and self =',self        
       #if we don't have shaders we need to rebuild the texture
       #if not self._useShaders:
       #    self.setTex(self._texName)
   def setFillContrast(self,value): #THIS DOESN'T WORK
      self.contrast = value 
      desiredRGB = (self.fillRGB*self.contrast+1)/2.0#RGB in range 0:1 and scaled for contrast
      #print 'desiredRGB type=',type(desiredRGB),' =',desiredRGB
      if numpy.any(desiredRGB**2.0>1.0): #if outside -1,1 range, then
          desiredRGB=numpy.array([0.6,0.6,0.4]) #set to arbitrary val
      self.setFillRGB(value=desiredRGB)    #self is understood