Beispiel #1
0
    def __init__(self, data, parent=None, **kw):
        """
        Constructor, initialization
        """

        QGLWidget.__init__(self, parent)
        self.setFormat(QGLFormat(QGL.SampleBuffers))
        self.setMinimumSize(500, 300)  #300
        self.setMouseTracking(True)
        self.setFocusPolicy(Qt.StrongFocus)

        self.data = data
        vertexes = []
        colors = []
        from utils.misc import IceAndFire
        maxY = max(map(max, [log10(el.y_data) for el in data]))
        maxX = max(map(max, [el.x_data for el in data]))
        rtmax = max([z.rtmin for z in data])
        for el in data:
            for i, x in enumerate(el.x_data):
                c = IceAndFire.getQColor(log10(el.y_data[i]) / maxY)
                colors.append(c)
                vertexes.append([(x * 2 * self.corner_) / maxX,
                                 (el.rt * 2 * self.corner_) / rtmax])
        from OpenGL.arrays.vbo import VBO

        self.vertexes = VBO(array(vertexes, 'f'))
        self.colors = VBO(array(colors, 'f'))

        self.mode = "None"  # "ZOOMING", "PANNING", "NONE"
        self.lastpos = QPoint()

        self.counter_trans_x = 0
        self.counter_trans_y = 0

        self.defaultColors = {
            'ticks': (0., 0., 0., 0.),
            'axes': (0., 0., 0., 0.),
            'curves': (0., 0., 1., 0.),
            'backgroundColor': (1., 1., 1., 1.)
        }

        #self.axes=self.drawAxes()
        self.transformationMatrix = self.setupTransformationMatrix(
            self.width(), self.height())
Beispiel #2
0
    def __init__(self, data, parent=None, **kw):
        """
        Constructor, initialization
        """
        
        QGLWidget.__init__(self, parent)
        self.setFormat(QGLFormat(QGL.SampleBuffers))
        self.setMinimumSize(500,300)#300
        self.setMouseTracking(True) 
        self.setFocusPolicy(Qt.StrongFocus)
        
        self.data=data
        vertexes=[]
        colors=[]
        from utils.misc import IceAndFire
        maxY=max(map(max, [log10(el.y_data) for el in data]))
        maxX=max(map(max, [el.x_data for el in data]))
        rtmax=max([z.rtmin for z in data])
        for el in data:
            for i, x in enumerate(el.x_data):
                c=IceAndFire.getQColor(log10(el.y_data[i])/maxY)
                colors.append(c)
                vertexes.append([(x*2*self.corner_)/maxX, (el.rt*2*self.corner_)/rtmax])
        from OpenGL.arrays.vbo import VBO
        
        self.vertexes= VBO(array(vertexes,'f'))
        self.colors=VBO(array(colors,'f'))
        
        self.mode = "None" # "ZOOMING", "PANNING", "NONE"
        self.lastpos = QPoint()
        
        self.counter_trans_x = 0
        self.counter_trans_y = 0

        
        self.defaultColors = {'ticks':(0.,0.,0.,0.),
                              'axes':(0.,0.,0.,0.),
                              'curves':(0.,0.,1.,0.),
                              'backgroundColor':(1.,1.,1.,1.)
                              }
     
        #self.axes=self.drawAxes()
        self.transformationMatrix = self.setupTransformationMatrix(self.width(), 
                                                                   self.height())
Beispiel #3
0
 def vertexAndColors(self, *args, **kwargs):
     from utils.misc import Ice, Fire, Hot, IceAndFire, Grey
     self.vertexList, self.colors =[], []
     min_, max_ = min(map(min, self.intensityList)), max(map(max, self.intensityList))
     for i, mass_of_spectrum in enumerate(self.massList):
         
         for j, mass in enumerate(mass_of_spectrum):
             self.vertexList.append([ - self.corner_ +  mass, 
                                      -self.corner_, 
                                      - self.near_- 2*self.corner_ - self.rtList[i][0]])
                  
             self.vertexList.append([ - self.corner_ + mass, 
                                - self.corner_ + self.intensityList[i][j], 
                                - self.near_- 2*self.corner_ - self.rtList[i][0]])
     
             color =IceAndFire._get_color(self.intensityList[i][j]/max_)
             for n in xrange(2):
                 self.colors.append(color)
         QThread.usleep(10)