Exemplo n.º 1
0
    def __init__(self, *args):
        super(QwtChart, self).__init__(*args)
        # set title
        self.setTitle(u'<h4><font color=red>图表</font></h4>')
        # bgcolor
        self.setCanvasBackground(Qt.Qt.white)
        # legend
        self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.RightLegend)

        # a variation on the C++ example
        self.plotLayout().setAlignCanvasToScales(True)

        # grid
        grid = Qwt.QwtPlotGrid()
        grid.setPen(QtGui.QPen(Qt.Qt.gray, 0, Qt.Qt.DotLine))
        grid.attach(self)

        # set axis titles
        self.setAxisTitle(Qwt.QwtPlot.xBottom, u'X')
        self.setAxisTitle(Qwt.QwtPlot.yLeft, u'Amplitude')

        # set Scale Range
        self.setAxisScale(Qwt.QwtPlot.xBottom, 0.0, 1000.0)
        self.setAxisScale(Qwt.QwtPlot.yLeft, -10.0, 10.0)

        # picker
        self.picker = Qwt.QwtPlotPicker(
            Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft,
            Qwt.QwtPicker.PointSelection | Qwt.QwtPicker.DragSelection,
            Qwt.QwtPlotPicker.CrossRubberBand, Qwt.QwtPicker.AlwaysOn,
            self.canvas())
        self.picker.setRubberBandPen(QtGui.QPen(Qt.Qt.red))
        self.picker.setTrackerPen(QtGui.QPen(Qt.Qt.red))

        self.connect(self.picker, QtCore.SIGNAL('moved(const QPoint &)'),
                     self.moved)

        # insert a horizontal marker at y = 0
        mY = Qwt.QwtPlotMarker()
        mY.setLabel(Qwt.QwtText('y = 0'))
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setLinePen(Qt.QPen(Qt.Qt.cyan, 1, Qt.Qt.DashDotLine))
        mY.setYValue(0.0)
        mY.attach(self)

        # insert a vertical marker at x = 500
        mX = Qwt.QwtPlotMarker()
        mX.setLabel(Qwt.QwtText('x = 500'))
        mX.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mX.setLineStyle(Qwt.QwtPlotMarker.VLine)
        mX.setLinePen(QtGui.QPen(Qt.Qt.cyan, 1, Qt.Qt.DashDotLine))
        mX.setXValue(500)
        mX.attach(self)

        #Initialize data
        self.curves = []
        self.dataLength = 1000
        self.x = np.arange(0.0, 1001.0, 1.0)
Exemplo n.º 2
0
    def __init__(self, *args):
        super(Chart, self).__init__(*args)
        #set title
        self.setTitle(u'<h4><font color=red>图表</font></h4>')
        #背景色
        self.setCanvasBackground(Qt.Qt.white)
        #插入图例--曲线名
        self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.RightLegend)

        # a variation on the C++ example
        self.plotLayout().setAlignCanvasToScales(True)
        
        #创建网格
        grid = Qwt.QwtPlotGrid()
        grid.setPen(Qt.QPen(Qt.Qt.gray, 0, Qt.Qt.DotLine))
        grid.attach(self)
        
        # set axis titles
        self.setAxisTitle(Qwt.QwtPlot.xBottom, u'Time(s)')
        self.setAxisTitle(Qwt.QwtPlot.yLeft, u'Values')
        
        # set Scale Range
        self.setAxisScale(Qwt.QwtPlot.xBottom, 0.0, 10000.0)
        self.setAxisScale(Qwt.QwtPlot.yLeft, -10.0, 10.0)

        # insert a few curves
        self.curveA = Qwt.QwtPlotCurve(u'curveA')
        self.curveA.setPen(Qt.QPen(Qt.Qt.red))
        self.curveA.attach(self)

        self.curveB = Qwt.QwtPlotCurve(u'curveB')
        self.curveB.setPen(Qt.QPen(Qt.Qt.blue))
        self.curveB.attach(self)

        # insert a horizontal marker at y = xxx
        mY = Qwt.QwtPlotMarker()
        mY.setLabel(Qwt.QwtText('Maker:Y'))
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.setLinePen(Qt.QPen(Qt.Qt.green, 1, Qt.Qt.DashDotLine))
        mY.attach(self)

        # insert a vertical marker
        mX = Qwt.QwtPlotMarker()
        mX.setLabel(Qwt.QwtText('Maker:X'))
        mX.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mX.setLineStyle(Qwt.QwtPlotMarker.VLine)
        mX.setXValue(5000)
        mX.setLinePen(Qt.QPen(Qt.Qt.green, 1, Qt.Qt.DashDotLine))
        mX.attach(self)


        #Initialize data
        self.x = np.arange(0.0, 10001.0, 1.0)
        self.curveAData = np.array([0], np.float)
        self.curveBData = np.array([0], np.float)
Exemplo n.º 3
0
    def __init__(self, *args):
        Qwt.QwtPlot.__init__(self, *args)

        # make a QwtPlot widget
        self.setTitle('SimpleDemo.py')
        self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.RightLegend)

        # a variation on the C++ example
        self.plotLayout().setAlignCanvasToScales(True)
        grid = Qwt.QwtPlotGrid()
        grid.attach(self)
        grid.setPen(Qt.QPen(Qt.Qt.black, 0, Qt.Qt.DotLine))

        # set axis titles
        self.setAxisTitle(Qwt.QwtPlot.xBottom, 'x -->')
        self.setAxisTitle(Qwt.QwtPlot.yLeft, 'y -->')

        # insert a few curves
        cSin = Qwt.QwtPlotCurve('y = sin(x)')
        cSin.setPen(Qt.QPen(Qt.Qt.red))
        cSin.attach(self)

        cCos = Qwt.QwtPlotCurve('y = cos(x)')
        cCos.setPen(Qt.QPen(Qt.Qt.blue))
        cCos.attach(self)

        # initialize the data
        cSin.setData(SimpleData(math.sin, 100))
        cCos.setData(SimpleData(math.cos, 100))

        # insert a horizontal marker at y = 0
        mY = Qwt.QwtPlotMarker()
        mY.setLabel(Qwt.QwtText('y = 0'))
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        # insert a vertical marker at x = 2 pi
        mX = Qwt.QwtPlotMarker()
        mX.setLabel(Qwt.QwtText('x = 2 pi'))
        mX.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mX.setLineStyle(Qwt.QwtPlotMarker.VLine)
        mX.setXValue(2 * math.pi)
        mX.attach(self)

        # replot
        self.replot()
    def report_scalar_value(self, data_label, scalar_data):
        """ report a scalar value in case where a vells plot has
          already been initiated
      """
        Message = data_label + ' is a scalar\n with value: ' + str(scalar_data)
        _dprint(3, ' scalar message ', Message)

        text = Qwt.QwtText(Message)
        fn = self.fontInfo().family()
        text.setFont(Qt.QFont(fn, 10, Qt.QFont.Bold))
        text.setColor(Qt.Qt.blue)
        text.setBackgroundBrush(Qt.QBrush(Qt.Qt.yellow))

        if not self.source_marker is None:
            self.source_marker.detach()
        self.source_marker = Qwt.QwtPlotMarker()
        self.source_marker.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        self.source_marker.setLabel(text)
        try:
            ylb = self.axisScale(Qwt.QwtPlot.yLeft).lBound()
            xlb = self.axisScale(Qwt.QwtPlot.xBottom).lBound()
            yhb = self.axisScale(Qwt.QwtPlot.yLeft).hBound()
            xhb = self.axisScale(Qwt.QwtPlot.xBottom).hBound()
        except:
            ylb = self.axisScale(Qwt.QwtPlot.yLeft).lowerBound()
            xlb = self.axisScale(Qwt.QwtPlot.xBottom).lowerBound()
            yhb = self.axisScale(Qwt.QwtPlot.yLeft).upperBound()
            xhb = self.axisScale(Qwt.QwtPlot.xBottom).upperBound()

        self.source_marker.setValue(xlb + 0.1, ylb + 1.0)
        self.source_marker.attach(self)
        self.replot()
        _dprint(3, 'called replot in report_scalar_value')
Exemplo n.º 5
0
    def mousePressEvent(self, ev):

        # context menu on middle click
        if (ev.buttons() == Qt.Qt.MiddleButton):
            self.triggerMenu(ev.globalPos())

        # add a marker on shift left click
        if ((ev.buttons() == Qt.Qt.LeftButton)
                and (ev.modifiers() == Qt.Qt.ShiftModifier)):

            m = Qwt.QwtPlotMarker()
            (x, y) = (self.invTransform(Qwt.QwtPlot.xBottom, ev.x()),
                      self.invTransform(Qwt.QwtPlot.yLeft, ev.y()))
            m.setValue(x, y)

            lbl = Qwt.QwtText("test")
            lbl.setText('x = %+.6g, y = %.6g' %
                        (self.invTransform(Qwt.QwtPlot.xBottom, ev.x()),
                         self.invTransform(Qwt.QwtPlot.yLeft, ev.y())))
            lbl.setColor(Qt.Qt.cyan)

            m.setLabel(lbl)
            m.attach(self)
            self.markers.append(m)
            self.trigger_update()
Exemplo n.º 6
0
    def __init__(self, *args):
        super(GraphWidget, self).__init__(*args)
        self._legend = Qwt.QwtLegend()
        self.setCanvasBackground(Qt.white)
        self._legend.setItemMode(Qwt.QwtLegend.CheckableItem)
        self.insertLegend(self._legend, Qwt.QwtPlot.BottomLegend)

        self._curves = {}

        self._last_canvas_x = 0
        self._last_canvas_y = 0
        self._pressed_canvas_y = 0
        self._last_click_coordinates = None
        self._color_index = 0

        marker_axis_y = Qwt.QwtPlotMarker()
        marker_axis_y.setLabelAlignment(Qt.AlignRight | Qt.AlignTop)
        marker_axis_y.setLineStyle(Qwt.QwtPlotMarker.HLine)
        marker_axis_y.setYValue(0.0)
        marker_axis_y.attach(self)

        self.zoom_enabled = True

        # Initialize data
        self._newest_time = 0
        self._y_upper_limit = 0.01
        self._y_lower_limit = -0.01
        self._yaxis_updated = 0
        self._canvas_display_width = 10
        self.redraw()
        self.move_canvas(0, 0)
        self.canvas().setMouseTracking(True)
        self.canvas().installEventFilter(self)
Exemplo n.º 7
0
    def setupPlot(self):
        self.qwtPlot.setCanvasBackground(Qt.Qt.white)
        self.alignScales()

        # self.qwtPlot.enableAxis(Qwt.QwtPlot.xBottom, False)
        # self.qwtPlot.enableAxis(Qwt.QwtPlot.yLeft, False) TODO Check why this was here at all
        
        self.qwtPlot.CurveSignal = Qwt.QwtPlotCurve("EEG Signal")
        self.qwtPlot.CurveSignal.attach(self.qwtPlot)
        self.qwtPlot.CurveSignal.setPen(Qt.QPen(Qt.Qt.blue))

        mY = Qwt.QwtPlotMarker()
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self.qwtPlot)

        # grid
        self.qwtPlot.grid = Qwt.QwtPlotGrid()
        self.qwtPlot.grid.enableY(False)
        self.qwtPlot.grid.enableX(True)
        self.qwtPlot.grid.enableXMin(True)
        self.qwtPlot.grid.setMajPen(Qt.QPen(Qt.Qt.gray, 0, Qt.Qt.SolidLine))
        self.qwtPlot.grid.setMinPen(Qt.QPen(Qt.Qt.gray, 0, Qt.Qt.DashLine))
        self.qwtPlot.grid.attach(self.qwtPlot)
    
        self.qwtPlot.startTimer(50)
        self.qwtPlot.phase = 0.0
Exemplo n.º 8
0
    def __init__(self, *args):
        Qwt.QwtPlot.__init__(self, *args)

        self.setCanvasBackground(Qt.Qt.white)
        self.alignScales()

        # Initialize data
        self.x = arange(0, 501, 1)
        self.y = zeros(len(self.x), Float)

        self.setTitle("Plot")

        self.curveR = Qwt.QwtPlotCurve()
        self.curveR.attach(self)

        self.curveR.setPen(Qt.QPen(Qt.Qt.blue))

        self.setAxisTitle(Qwt.QwtPlot.xBottom, "Framecount")
        self.setAxisTitle(Qwt.QwtPlot.yLeft, "Values")

        self.curveR.setData(self.x, self.y)

        self.marker = m = Qwt.QwtPlotMarker()
        m.setValue(0, 0)
        m.setLineStyle(Qwt.QwtPlotMarker.VLine)
        m.setLinePen(Qt.QPen(Qt.Qt.green, 2, Qt.Qt.DashDotLine))
        text = Qwt.QwtText('')
        text.setColor(Qt.Qt.green)
        text.setBackgroundBrush(Qt.Qt.gray)
        text.setFont(Qt.QFont(self.fontInfo().family(), 12, Qt.QFont.Bold))
        m.setLabel(text)
        m.attach(self)
Exemplo n.º 9
0
    def __init__(self, *args):
        Qwt.QwtPlot.__init__(self, *args)

        self.setCanvasBackground(Qt.Qt.white)
        self.alignScales()

        # Initialize data
        self.x = arange(0.0, 100.1, 0.5)
        self.y = zeros(len(self.x), Float)
        self.z = zeros(len(self.x), Float)

        self.setTitle("PyQwt Example")
        self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend)

        self.curveR = Qwt.QwtPlotCurve("Random Data")
        self.curveR.attach(self)

        self.curveR.setPen(Qt.QPen(Qt.Qt.red))

        mY = Qwt.QwtPlotMarker()
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time (seconds)")
        self.setAxisTitle(Qwt.QwtPlot.yLeft, "Values")

        self.startTimer(1)
        self.phase = 0.0
        self.tstart = time.time()
        self.counter = 0
Exemplo n.º 10
0
 def setMarker(self, xPos, title):
     marker = Qwt.QwtPlotMarker()
     marker.setLabel(Qwt.QwtText(title))
     marker.setItemAttribute(Qwt.QwtPlotItem.AutoScale, True)
     marker.setLineStyle(Qwt.QwtPlotMarker.VLine)
     marker.setXValue(xPos)
     marker.setLabelAlignment(QtCore.Qt.AlignRight)
     marker.attach(self)
Exemplo n.º 11
0
    def __init__(self, *args):
        Qwt.QwtPlot.__init__(self, *args)

        # make a QwtPlot widget
        self.setTitle('ReallySimpleDemo.py')
        self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.RightLegend)

        # set axis titles
        self.setAxisTitle(Qwt.QwtPlot.xBottom, 'x -->')
        self.setAxisTitle(Qwt.QwtPlot.yLeft, 'y -->')

        # insert a few curves
        cSin = Qwt.QwtPlotCurve('y = sin(x)')
        cSin.setPen(Qt.QPen(Qt.Qt.red))
        cSin.attach(self)

        cCos = Qwt.QwtPlotCurve('y = cos(x)')
        cCos.setPen(Qt.QPen(Qt.Qt.blue))
        cCos.attach(self)

        # make a Numeric array for the horizontal data
        x = arange(0.0, 10.0, 0.1)

        # initialize the data
        cSin.setData(x, sin(x))
        cCos.setData(x, cos(x))

        # insert a horizontal marker at y = 0
        mY = Qwt.QwtPlotMarker()
        mY.setLabel(Qwt.QwtText('y = 0'))
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        # insert a vertical marker at x = 2 pi
        mX = Qwt.QwtPlotMarker()
        mX.setLabel(Qwt.QwtText('x = 2 pi'))
        mX.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mX.setLineStyle(Qwt.QwtPlotMarker.VLine)
        mX.setXValue(2 * pi)
        mX.attach(self)

        # replot
        self.replot()
Exemplo n.º 12
0
 def __createMarker(self, x, y, point=None):
     marker = Qwt.QwtPlotMarker()
     marker.setSymbol(self.symbol)
     marker.setValue(x, y)
     marker.attach(self.plot)
     if point is None:
         self.markers.append(marker)
     else:
         self.markers.insert(point, marker)
Exemplo n.º 13
0
    def __init__(self, *args):

        Qwt.QwtPlot.__init__(self, *args)

        self.setCanvasBackground(Qt.Qt.white)
        #self.alignScales()

        # self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend);
        self.curve = Qwt.QwtPlotCurve('Unfiltered Spectrum')
        self.curve.setPen(Qt.QPen(Qt.Qt.red))
        self.curve.attach(self)

        # Make 100 "gray" curves
        self.curve_gray = []
        for i in xrange(50):
            curve = Qwt.QwtPlotCurve('Cumulative Filter Attenuation')
            if i > 0:
                curve.setItemAttribute(Qwt.QwtPlotItem.Legend, False)
            curve.setPen(Qt.QPen(Qt.Qt.gray))
            curve.attach(self)
            self.curve_gray.append(curve)

        self.curve2 = Qwt.QwtPlotCurve('Filtered Spectrum')
        self.curve2.setPen(Qt.QPen(Qt.Qt.blue))
        self.curve2.attach(self)

        self.curve3 = Qwt.QwtPlotCurve()
        self.curve3.setItemAttribute(Qwt.QwtPlotItem.Legend, False)
        self.curve3.setPen(Qt.QPen(Qt.Qt.green))
        self.curve3.attach(self)

        self.curve_white = Qwt.QwtPlotCurve()
        self.curve_white.setItemAttribute(Qwt.QwtPlotItem.Legend, False)
        self.curve_white.setPen(Qt.QPen(Qt.Qt.white))
        self.curve_white.attach(self)

        self.curve_green = Qwt.QwtPlotCurve('Mono Energy')
        self.curve_green.setPen(Qt.QPen(Qt.Qt.darkGreen))
        self.curve_green.attach(self)

        mY = Qwt.QwtPlotMarker()
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        self.setAxisScaleEngine(Qwt.QwtPlot.xBottom, Qwt.QwtLog10ScaleEngine())
        self.setAxisScaleEngine(Qwt.QwtPlot.yLeft, Qwt.QwtLog10ScaleEngine())

        # Add grid to plot
        grid = Qwt.QwtPlotGrid()
        pen = Qt.QPen(Qt.Qt.DotLine)
        pen.setColor(Qt.Qt.black)
        pen.setWidth(0)
        grid.setPen(pen)
        grid.attach(self)
Exemplo n.º 14
0
    def showMs(self, row1):
        self.row1 = row1
        self.cur.execute(
            "select name,peakindex,peakintensity  from catalog where id=%d" %
            row1)
        temp = self.cur.fetchall()
        masstemp = np.frombuffer(temp[0][1], dtype=np.int)
        intensitytemp = np.frombuffer(temp[0][2], dtype=np.int)
        intensitytemp = 100 * intensitytemp / np.max(intensitytemp)
        row = np.zeros(len(masstemp))
        mass = coo_matrix((intensitytemp, (row, masstemp)),
                          shape=(1, ceil(masstemp[-1]) + 1)).todense()
        self.massSeacher = mass.tolist()
        radio_MS = 0.01 * (np.max(self.massSeacher[0]) -
                           np.min(self.massSeacher[0]))
        peak_MS = []
        for i in range(5, len(self.massSeacher[0]) - 5):
            if (self.massSeacher[0][i] == max(self.massSeacher[0][i - 5:i + 5])
                    and self.massSeacher[0][i] >= radio_MS):
                peak_intensity_MS = (i, self.massSeacher[0][i])
                peak_MS.append(peak_intensity_MS)
        self.plot2.clear()
        self.plot2.setTitle("MS of %s" % str(temp[0][0][:-2]))
        color = QColor('black')
        curve2 = Qwt.QwtPlotCurve("test1")
        pen = QPen(color)
        pen.setWidth(1)
        curve2.setPen(pen)
        self.axis2 = masstemp
        curve2.setData(masstemp, intensitytemp)
        curve2.setStyle(Qwt.QwtPlotCurve.Sticks)
        curve2.attach(self.plot2)
        for i in range(len(peak_MS)):
            text_MS = Qwt.QwtText('%s' % (str(peak_MS[i][0])))
            marker_MS = Qwt.QwtPlotMarker()
            marker_MS.setLabelAlignment(Qt.AlignCenter | Qt.AlignTop)
            marker_MS.setLabel(text_MS)
            marker_MS.setValue(peak_MS[i][0], peak_MS[i][1])
            marker_MS.attach(self.plot2)

        x = np.hstack((self.axis, self.axis2))
        x_min = np.min(x)
        x_max = np.max(x)
        y1_max = np.max(self.mass)
        y1_min = np.min(self.mass)
        y2_max = np.max(intensitytemp)
        y2_min = np.min(intensitytemp)

        self.plot1.setAxisScale(self.plot1.xBottom, 0, x_max * 1.1)
        self.plot2.setAxisScale(self.plot1.xBottom, 0, x_max * 1.1)
        self.plot1.setAxisScale(self.plot1.yLeft, 0, y1_max * 1.1)
        self.plot2.setAxisScale(self.plot1.yLeft, 0, y2_max * 1.1)

        self.plot1.replot()
        self.plot2.replot()
        self.ShowMolFile()
Exemplo n.º 15
0
    def initialize(self):
        # attach a horizontal marker at y = 0
        self.clear()
        self.curves = {}
        # set Markers
        marker = Qwt.QwtPlotMarker()
        marker.attach(self)
        marker.setValue(0.0, 25.0)
        marker.setLineStyle(Qwt.QwtPlotMarker.HLine)
        marker.setLabelAlignment(Qt.Qt.AlignLeft | Qt.Qt.AlignTop)
        marker.setLabel(Qwt.QwtText('NDVI = 0'))
        #
        self.pointMarker = Qwt.QwtPlotMarker()
        self.pointMarker.attach(self)

        # set Legend
        legend = Qwt.QwtLegend()
        legend.setItemMode(Qwt.QwtLegend.CheckableItem)
        self.insertLegend(legend, Qwt.QwtPlot.RightLegend)
        self.connect(self, Qt.SIGNAL('legendChecked(QwtPlotItem*, bool)'),
                     self.showCurve)
Exemplo n.º 16
0
    def __init__(self,
                 titlePlot="noTitleSet",
                 legendCurveOne="noLegendSet",
                 legendCurveTwo=None,
                 *args):  #, *args
        Qwt.QwtPlot.__init__(self, *args)  #, *args
        #print "TOTO:"+str(*args)
        self.setCanvasBackground(Qt.Qt.white)
        self.alignScales()

        # Initialize data
        #self.x = arange(0.0, 100.1, 0.5)
        self.x = arange(0.0, 500.1, 0.5)

        self.y = zeros(len(self.x), Float)
        self.z = zeros(len(self.x), Float)

        self.setTitle(titlePlot)
        self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend)

        self.curveOne = Qwt.QwtPlotCurve(legendCurveOne)
        self.curveOne.attach(self)

        self.setMarker(50, "Welcome\n")

        #self.startTimer(50)
        self.phase = 0.0
        self.isAnalysed = False

        self.legendCurveTwo = legendCurveTwo
        if not legendCurveTwo == None:  #and not self.isAnalysed:
            self.curveTwo = Qwt.QwtPlotCurve(legendCurveTwo)
            self.curveTwo.attach(self)

        #to add yellow circles
        #if not legendCurveTwo==None:
        #    self.curveTwo.setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse,
        #                                Qt.QBrush(),
        #                                Qt.QPen(Qt.Qt.yellow),
        #                                Qt.QSize(7, 7)))

        self.curveOne.setPen(Qt.QPen(Qt.Qt.red))
        if not legendCurveTwo == None:
            self.curveTwo.setPen(Qt.QPen(Qt.Qt.blue))

        mY = Qwt.QwtPlotMarker()
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time (s)")
        self.setAxisTitle(Qwt.QwtPlot.yLeft, "Value [C]")
Exemplo n.º 17
0
        def __init__(self, *args):
            super(DataPlot, self).__init__(*args)
            self.setCanvasBackground(Qt.white)
            self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend)

            self.curves = {}
            self.pauseFlag = False
            self.dataOffsetX = 0
            self.canvasOffsetX = 0
            self.canvasOffsetY = 0
            self.lastCanvasX = 0
            self.lastCanvasY = 0
            self.pressedCanvasY = 0
            self.redrawOnEachUpdate = False
            self.redrawOnFullUpdate = True
            self.redrawTimerInterval = None
            self.redrawManually = False
            self.oscilloscopeNextDataPosition = 0
            self.oscilloscopeMode = False
            self.lastClickCoordinates = None

            markerAxisY = Qwt.QwtPlotMarker()
            markerAxisY.setLabelAlignment(Qt.AlignRight | Qt.AlignTop)
            markerAxisY.setLineStyle(Qwt.QwtPlotMarker.HLine)
            markerAxisY.setYValue(0.0)
            markerAxisY.attach(self)

            #self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time")
            #self.setAxisTitle(Qwt.QwtPlot.yLeft, "Value")


            self.picker = Qwt.QwtPlotPicker(
                Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PolygonSelection,
                Qwt.QwtPlotPicker.PolygonRubberBand, Qwt.QwtPicker.AlwaysOn, self.canvas()
            )
            self.picker.setRubberBandPen(QPen(self.colors[-1]))
            self.picker.setTrackerPen(QPen(self.colors[-1]))

            # Initialize data
            self.timeAxis = arange(self.dataNumValuesPloted)
            self.canvasDisplayHeight = 1000
            self.canvasDisplayWidth = self.canvas().width()
            self.dataOffsetX = self.dataNumValuesSaved - len(self.timeAxis)
            self.redraw()
            self.moveCanvas(0, 0)
            self.canvas().setMouseTracking(True)
            self.canvas().installEventFilter(self)

            # init and start redraw timer
            self.timerRedraw = QTimer(self)
            self.timerRedraw.timeout.connect(self.redraw)
            if self.redrawTimerInterval:
                self.timerRedraw.start(self.redrawTimerInterval)
    def __init__(self, grblock, *args):
        Qwt.QwtPlot.__init__(self, *args)

        self.setCanvasBackground(Qt.Qt.white)

        self.grblock = grblock

        # Initialize data
        self.t = np.arange(self.grblock.ntau)
        self.pdp = np.zeros(self.t.size)

        self.setTitle("Power Delay Profile")
        self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend)

        self.pdpcurve = Qwt.QwtPlotCurve("PDP")
        self.pdpcurve.attach(self)

        self.pdpcurve.setPen(Qt.QPen(Qt.Qt.red))

        mY = Qwt.QwtPlotMarker()
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time (seconds)")
        scale = time_scale(self.grblock.t_symbol)
        self.setAxisScaleDraw(Qwt.QwtPlot.xBottom, scale)

        self.setAxisTitle(Qwt.QwtPlot.yLeft, "Power")
        self.setAxisScale(Qwt.QwtPlot.yLeft, -100, 0)
        # for linear scale
        #self.setAxisScale(Qwt.QwtPlot.yLeft, 0, 2)

        # zoomer
        self.zoomer = Qwt.QwtPlotZoomer(Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft,
                                        Qwt.QwtPicker.DragSelection,
                                        Qwt.QwtPicker.AlwaysOff, self.canvas())
        self.zoomer.setRubberBandPen(Qt.QPen(Qt.Qt.green))

        # picker showing the coordinates at the mouse pointer
        self.picker = QwtPlotPicker(self.grblock.t_symbol, Qwt.QwtPlot.xBottom,
                                    Qwt.QwtPlot.yLeft,
                                    Qwt.QwtPicker.PointSelection,
                                    Qwt.QwtPlotPicker.CrossRubberBand,
                                    Qwt.QwtPicker.AlwaysOn, self.canvas())
        self.picker.setTrackerPen(Qt.QPen(Qt.Qt.cyan))
Exemplo n.º 19
0
    def __init__(self, *args, **kwargs):

        self.monitor = kwargs[MONITOR_KEY.KWARG]
        del kwargs[MONITOR_KEY.KWARG]

        Qwt.QwtPlot.__init__(self, *args)

        self.setCanvasBackground(Qt.Qt.white)

        # Set the title
        title = Qwt.QwtText("Title")
        titleFont = QtGui.QFont('SansSerif', 10)
        titleFont.setWeight(QtGui.QFont.Light)
        title.setFont(titleFont)
        self.setTitle(title)

        self.curve = Qwt.QwtPlotCurve()
        self.curve.setPen(Qt.QPen(Qt.Qt.blue))
        self.curve.attach(self)

        mY = Qwt.QwtPlotMarker()
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        # Set the title
        xAxisLabel = Qwt.QwtText("X Value")
        xAxisLabel.setFont(titleFont)

        yAxisLabel = Qwt.QwtText("Y Value")
        yAxisLabel.setFont(titleFont)

        self.setAxisTitle(Qwt.QwtPlot.xBottom, xAxisLabel)
        self.setAxisTitle(Qwt.QwtPlot.yLeft, yAxisLabel)

        self.vbar = Qwt.QwtPlotCurve()
        self.vbar.setPen(Qt.QPen(Qt.Qt.red))
        self.vbar.attach(self)

        self._dragBar = False

        self.setMouseTracking(True)

        self.monitor.connect(VAR.VERT_BAR_POS_X, self.handle_vbar_position)
Exemplo n.º 20
0
    def init_window(self):
        self.setCanvasBackground(Qt.Qt.white)
        #self.alignScales()

        self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend)

        #
        # Insert a horizontal maker
        mY = Qwt.QwtPlotMarker()
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time (seconds)")

        self.setAxisTitle(Qwt.QwtPlot.yLeft, "Values")
        self.setAxisScale(Qwt.QwtPlot.yLeft, -200, 200)
Exemplo n.º 21
0
    def __init__(self, *args):
        # call base class constructor
        Qwt.QwtPlot.__init__(self, *args)

        self.setCanvasBackground(Qt.Qt.white)

        # initialize data
        self.x = np.arange(0.0, 100.1, 0.5)
        self.y = np.zeros(len(self.x), np.float)
        self.z = np.zeros(len(self.x), np.float)

        # title
        self.setTitle("A Moving QwtPlot Demonstration")
        # legend
        self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend)

        # plot going right
        self.curveR = Qwt.QwtPlotCurve("Data Moving Right")
        self.curveR.attach(self)
        # plot going left
        self.curveL = Qwt.QwtPlotCurve("Data Moving Left")
        self.curveL.attach(self)

        # accent on each data point of plot going left
        self.curveL.setSymbol(
            Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse, Qt.QBrush(),
                          Qt.QPen(Qt.Qt.yellow), Qt.QSize(7, 7)))

        # line colors
        self.curveR.setPen(Qt.QPen(Qt.Qt.red))
        self.curveL.setPen(Qt.QPen(Qt.Qt.blue))

        # set a line marker at zero
        mY = Qwt.QwtPlotMarker()
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        # axis titles
        self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time (seconds)")
        self.setAxisTitle(Qwt.QwtPlot.yLeft, "Values")

        self.phase = 0.0
Exemplo n.º 22
0
    def initPlots(self):
        self.plot3.clear()
        self.plot3.setAxisScale(self.plot1.xBottom, -4, 4)
        self.plot3.setAxisScale(self.plot1.yLeft, -4, 4)
        self.plot1.clear()
        self.plot1.setTitle("Search MS")
        self.plot1.setAxisTitle(Qwt.QwtPlot.yLeft, 'Intensity')
        grid = Qwt.QwtPlotGrid()
        pen = QPen(Qt.DotLine)
        pen.setColor(Qt.black)
        pen.setWidth(0)
        grid.setPen(pen)
        grid.attach(self.plot1)
        self.plot1.setAxisScale(self.plot1.yLeft, 0, 1.1 * np.max(self.mass))
        color = QColor('black')
        curve = Qwt.QwtPlotCurve("test1")
        pen = QPen(color)
        pen.setWidth(1)
        curve.setPen(pen)
        #self.axis= np.arange(len(self.mass))
        curve.setData(self.axis, self.mass)
        curve.setStyle(Qwt.QwtPlotCurve.Sticks)
        curve.attach(self.plot1)
        for i in range(len(self.peak_MS)):
            text_MS = Qwt.QwtText('%s' % (str(self.peak_MS[i][0])))
            marker_MS = Qwt.QwtPlotMarker()
            marker_MS.setLabelAlignment(Qt.AlignCenter | Qt.AlignTop)
            marker_MS.setLabel(text_MS)
            marker_MS.setValue(self.peak_MS[i][0], self.peak_MS[i][1])
            marker_MS.attach(self.plot1)
        self.plot1.replot()

        self.plot2.clear()
        self.plot2.setTitle("NIST MS")
        #        self.plot2.setAxisTitle(Qwt.QwtPlot.xBottom, 'Raman shift (cm-1)')
        self.plot2.setAxisTitle(Qwt.QwtPlot.yLeft, 'Intensity')
        grid = Qwt.QwtPlotGrid()
        pen = QPen(Qt.DotLine)
        pen.setColor(Qt.black)
        pen.setWidth(0)
        grid.setPen(pen)
        grid.attach(self.plot2)
        self.plot2.replot()
Exemplo n.º 23
0
    def preparePlot(self):
        """Prepare the plotting window"""
        if self.figure:
            return
        self.figure = Qwt.QwtPlot()
        self.figure.setCanvasBackground(Qt.Qt.white)
        self.figure.canvas().setFrameStyle(Qt.QFrame.Box | Qt.QFrame.Plain)
        self.figure.canvas().setLineWidth(1)
        for i in range(Qwt.QwtPlot.axisCnt):
            scaleWidget = self.figure.axisWidget(i)
            if scaleWidget:
                scaleWidget.setMargin(0)
            scaleDraw = self.figure.axisScaleDraw(i)
            if scaleDraw:
                scaleDraw.enableComponent(Qwt.QwtAbstractScaleDraw.Backbone,
                                          False)
        self.figure.setTitle("Figure: %d - %s" % (self.figNr, self.title))
        self.figure.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend)

        self.figure.setAxisTitle(Qwt.QwtPlot.xBottom, "Time")
        self.figure.setAxisTitle(Qwt.QwtPlot.yLeft, self.ylabel)
        self.axis1 = Qwt.QwtPlot.yLeft
        if len(self.alternate) > 0:
            self.figure.enableAxis(Qwt.QwtPlot.yRight)
            self.figure.setAxisTitle(Qwt.QwtPlot.yRight, self.ylabel2)
            self.axis2 = Qwt.QwtPlot.yRight

        if self.spec.logscale:
            self.figure.setAxisScaleEngine(Qwt.QwtPlot.yLeft,
                                           Qwt.QwtLog10ScaleEngine())
            if len(self.alternate) > 0:
                self.figure.setAxisScaleEngine(Qwt.QwtPlot.yRight,
                                               Qwt.QwtLog10ScaleEngine())

        mY = Qwt.QwtPlotMarker()
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self.figure)

        self.figure.resize(500, 300)
        self.figure.show()
Exemplo n.º 24
0
 def addPlotMarker(self, xPosition, label, samplecounter):
     ''' Create and add trigger event marker
     @param xPosition: horizontal screen position
     @param label: label string
     @param samplecounter: total sample position
     '''
     margin = float(len(self.traces) + 1) / 10.0 / 3.0  # 2.5% bottom margin
     sym = Qwt.QwtSymbol()
     sym.setStyle(Qwt.QwtSymbol.VLine)
     sym.setSize(20)
     mX = Qwt.QwtPlotMarker()
     mX.setLabel(Qwt.QwtText(label))
     mX.setLabelAlignment(Qt.Qt.AlignHCenter | Qt.Qt.AlignBottom)
     mX.setLineStyle(Qwt.QwtPlotMarker.NoLine)
     mX.setXValue(xPosition)
     mX.setYValue(-1.0 + margin)
     mX.setSymbol(sym)
     mX.sampleCounter = samplecounter
     mX.attach(self)
     self.plot_markers.append(mX)
Exemplo n.º 25
0
   def __init__(self, multimeter, *args):
       Qwt.QwtPlot.__init__(self, *args)

       self.multimeter = multimeter

       self.setCanvasBackground(Qt.Qt.white)
       self.alignScales()

       # Initialize data
       self.x = arange(0.0, 100.1, 0.5)
       self.y = zeros(len(self.x), Float)
       #self.z = zeros(len(self.x), Float)

       self.setTitle("A Moving QwtPlot Demonstration")
       self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend);

       #self.curveR = Qwt.QwtPlotCurve("Data Moving Right")
       #self.curveR.attach(self)
       self.curveL = Qwt.QwtPlotCurve("Data Moving Left")
       self.curveL.attach(self)

       self.curveL.setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse,
                                       Qt.QBrush(),
                                       Qt.QPen(Qt.Qt.yellow),
                                       Qt.QSize(7, 7)))

       #self.curveR.setPen(Qt.QPen(Qt.Qt.red))
       self.curveL.setPen(Qt.QPen(Qt.Qt.blue))

       mY = Qwt.QwtPlotMarker()
       mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
       mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
       mY.setYValue(0.0)
       mY.attach(self)

       self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time (seconds)")
       self.setAxisTitle(Qwt.QwtPlot.yLeft, "Values")

       self.startTimer(50)
       self.phase = 0.0
Exemplo n.º 26
0
    def _initDataCursors(self):
        """ """

        current_font = self.fontInfo().family()

        self.data_cursors = {}

        marker = qwt.QwtPlotMarker()
        marker.setValue(1, 200)
        text = qwt.QwtText('test')
        text.setFont(Qt.QFont(current_font, 12, Qt.QFont.Bold))
        text.setColor(Qt.Qt.blue)
        text.setBackgroundBrush(Qt.QBrush(Qt.Qt.yellow))
        text.setBackgroundPen(Qt.QPen(Qt.Qt.red, 2))
        marker.setLabel(text)
        marker.setSymbol(
            qwt.QwtSymbol(
                qwt.QwtSymbol.
                Ellipse,  # Marker Type (None, Ellipse, Rect, Diamond)
                Qt.QBrush(
                    Qt.Qt.green
                ),  # Fill Color (Use "Qt.QBrush()" if you want transparent)
                Qt.QPen(
                    Qt.Qt.black, 6
                ),  # Edge Color & Edge Thickness (Use "Qt.QPen()" if you want transparent
                Qt.QSize(5,
                         5)))  # Marker Size (Horizontal Size, Vertical Size)
        marker.setVisible(False)
        marker.attach(self.qwtPlot)
        data_cursor = PlotDataCursor(marker, qwt.QwtPlot.xBottom,
                                     qwt.QwtPlot.yLeft,
                                     qwt.QwtPicker.PointSelection,
                                     qwt.QwtPlotPicker.NoRubberBand,
                                     qwt.QwtPicker.AlwaysOff,
                                     self.qwtPlot.canvas())
        data_cursor.setEnabled(False)

        self.data_cursors['qwtPlot'] = data_cursor
def main(args):
    app = Qt.QApplication(args)
    demo = Qwt.QwtPlot()
    grid = Qwt.QwtPlotGrid()
    grid.attach(demo)
    grid.setPen(Qt.QPen(Qt.Qt.black, 0, Qt.Qt.DotLine))
    grid.enableX(True)
    grid.enableY(True)
    complex_divider = 50.0

    myXScale = ComplexScaleDraw(start_value=0.0, end_value=complex_divider)
    demo.setAxisScaleDraw(Qwt.QwtPlot.xBottom, myXScale)

    m = Qwt.QwtPlotMarker()
    m.attach(demo)
    m.setValue(complex_divider, 0.0)
    m.setLineStyle(Qwt.QwtPlotMarker.VLine)
    m.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignBottom)
    m.setLinePen(Qt.QPen(Qt.Qt.black, 2, Qt.Qt.SolidLine))

    vector_array = numpy.zeros((100,), numpy.float32)
    for i in range(100):
      vector_array[i] = i

    curve = Qwt.QwtPlotCurve('example data')
    curve.attach(demo)
    x_array = numpy.zeros(100, numpy.float32)
    y_array = numpy.zeros(100, numpy.float32)
    for i in range(100):
      x_array[i] = 1.0 * i
      y_array[i] = 2.0 * i
    curve.setData(x_array,y_array)

    demo.resize(600, 400)
    demo.replot()
    demo.show()
#   app.setMainWidget(demo)
    app.exec_()
Exemplo n.º 28
0
    def showMs(self):
        self.cur.execute("select name,peakindex,peakintensity,MW from catalog where id=%d"%self.id)
        temp=self.cur.fetchall()
        masstemp=np.frombuffer(temp[0][1],dtype=np.int)
        intensitytemp=np.frombuffer(temp[0][2],dtype=np.int)
        row = np.zeros(len(masstemp))
        mass = coo_matrix( (intensitytemp,(row,masstemp)), shape=(1,temp[0][3]+50)).todense()
        self.massSeacher=mass.tolist()
        radio_MS=0.01*(np.max(self.massSeacher[0])-np.min(self.massSeacher[0]))
        peak_MS=[]  
        for i in range(5,len(self.massSeacher[0])-5):
            if (self.massSeacher[0][i]==max(self.massSeacher[0][i-5:i+5]) and self.massSeacher[0][i]>=radio_MS):
                peak_intensity_MS=(i,self.massSeacher[0][i])
                peak_MS.append(peak_intensity_MS)
        self.plot1.clear()
#        self.plot1.setTitle("MS of %s"%str(temp[0][0][:-2]))
        self.plot1.setAxisScale(self.plot1.yLeft,0,1.1*np.max(self.massSeacher[0]))
        color = QColor('black')
        curve2 = Qwt.QwtPlotCurve("test1")
        pen = QPen(color)
        pen.setWidth(1)
        curve2.setPen(pen)
        self.axis= np.arange(temp[0][3]+50)+1
        curve2.setData(self.axis,self.massSeacher[0])
        curve2.setStyle(Qwt.QwtPlotCurve.Sticks)
        curve2.attach(self.plot1)
        for i in range(len(peak_MS)):
            text_MS=Qwt.QwtText('%s'%(str(peak_MS[i][0])))
            marker_MS = Qwt.QwtPlotMarker()
            marker_MS.setLabelAlignment(Qt.AlignCenter | Qt.AlignTop)
            marker_MS.setLabel(text_MS)
            marker_MS.setValue(peak_MS[i][0],peak_MS[i][1])
            marker_MS.attach(self.plot1)        
        self.plot1.replot()
        self.ShowMolFile()        
        
        
Exemplo n.º 29
0
    def __init__(self, *args):

        Qwt.QwtPlot.__init__(self, *args)

        self.setCanvasBackground(Qt.Qt.white)

        # Set the title
        title = Qwt.QwtText("Title")
        titleFont = QtGui.QFont('SansSerif', 10)
        titleFont.setWeight(QtGui.QFont.Light)
        title.setFont(titleFont)
        self.setTitle(title)

        # self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend);
        self.curve = Qwt.QwtPlotCurve()

        # self.curve.setStyle(Qwt.QwtPlotCurve.Sticks)

        self.curve.setPen(Qt.QPen(Qt.Qt.blue))
        self.curve.attach(self)

        mY = Qwt.QwtPlotMarker()
        mY.setLabelAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTop)
        mY.setLineStyle(Qwt.QwtPlotMarker.HLine)
        mY.setYValue(0.0)
        mY.attach(self)

        # Set the title
        xAxisLabel = Qwt.QwtText("X Value")
        xAxisLabel.setFont(titleFont)

        yAxisLabel = Qwt.QwtText("Y Value")
        yAxisLabel.setFont(titleFont)

        self.setAxisTitle(Qwt.QwtPlot.xBottom, xAxisLabel)
        self.setAxisTitle(Qwt.QwtPlot.yLeft, yAxisLabel)
Exemplo n.º 30
0
    def ShowMolFile(self):
        self.plot3.clear()
        self.ID = self.row1
        Molecular = {}
        db = sqlite3.connect(MOL_DBPath)
        cur = db.cursor()
        cur.execute("select * from catalog where id=%d" % self.ID)
        c = cur.fetchall()
        Molecular["MolName"] = c[0][1]
        Molecular["MolNum"] = c[0][2]
        Molecular["MolBondNum"] = c[0][3]
        Molecular["Mol"] = c[0][4].split()
        Molecular["MolXAxis"] = np.frombuffer(c[0][5], dtype=np.float)
        Molecular["MolYAxis"] = np.frombuffer(c[0][6], dtype=np.float)
        Molecular["MolStyle"] = np.frombuffer(c[0][7], dtype=np.int)
        Molecular["bondX"] = np.frombuffer(c[0][8], dtype=np.int)
        Molecular["bondY"] = np.frombuffer(c[0][9], dtype=np.int)
        Molecular["bondNum"] = np.frombuffer(c[0][10], dtype=np.int)
        self.Molecular = Molecular
        color = QColor('black')
        curve = Qwt.QwtPlotCurve()
        pen = QPen(color)
        pen.setWidth(1)
        curve.setPen(pen)
        curve.setStyle(Qwt.QwtPlotCurve.NoCurve)
        curve.setSymbol(
            Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse, Qt.black, QPen(Qt.black),
                          QSize(3, 3)))
        curve.attach(self.plot3)
        curve.setData(self.Molecular["MolXAxis"], self.Molecular["MolYAxis"])
        tempstyl1 = []
        tempstyl2 = []
        tempstyl3 = []
        tempstyl4 = []
        for i in range(Molecular["MolBondNum"]):
            if Molecular["bondNum"][i] == 1 and Molecular["MolStyle"][
                    Molecular["bondX"][i] -
                    1] == 0 and Molecular["MolStyle"][Molecular["bondY"][i] -
                                                      1] == 0:
                tempstyl2.append(Molecular["bondX"][i])
                tempstyl2.append(Molecular["bondY"][i])
        for i in range(Molecular["MolBondNum"]):
            if Molecular["bondNum"][i] == 2 and Molecular["MolStyle"][
                    Molecular["bondX"][i] -
                    1] == 0 and Molecular["MolStyle"][Molecular["bondY"][i] -
                                                      1] == 0:
                if (Molecular["bondX"][i]
                        in tempstyl2) and (Molecular["bondY"][i] in tempstyl2):
                    tempstyl1.append(Molecular["bondX"][i])
                    tempstyl1.append(Molecular["bondY"][i])
        for i in range(len(tempstyl2) / 2):
            if (tempstyl2[2 * i] in tempstyl1) and (tempstyl2[2 * i + 1]
                                                    in tempstyl1):
                tempstyl3.append(tempstyl2[2 * i])
                tempstyl3.append(tempstyl2[2 * i + 1])
        for i in range(len(tempstyl1) / 2):
            if (tempstyl1[2 * i] in tempstyl3) and (tempstyl1[2 * i + 1]
                                                    in tempstyl3):
                tempstyl4.append(tempstyl1[2 * i])
                tempstyl4.append(tempstyl1[2 * i + 1])
        tempstyl6 = []
        for i in range(len(tempstyl3) / 2):
            if (tempstyl3[2 * i] in tempstyl4) and (tempstyl3[2 * i + 1]
                                                    in tempstyl4):
                tempstyl6.append(tempstyl3[2 * i])
                tempstyl6.append(tempstyl3[2 * i + 1])
        tempstyl5 = []
        #            print tempstyl4
        while True:
            if len(tempstyl6) == 0 or len(tempstyl4) == 0:
                break
            for i in range(len(tempstyl4) / 2):
                #                print i
                if not (tempstyl4[2 * i] in tempstyl5):
                    tempindex3 = tempstyl6.index(tempstyl4[2 * i])
                    tempindex4 = tempstyl6.index(tempstyl4[2 * i + 1])
                    temp1 = tempstyl4[2 * i]
                    temp2 = tempstyl4[2 * i + 1]
                    if tempindex3 % 2 == 0:
                        temp3 = tempstyl6[tempindex3 + 1]
                        tempindex3other = tempindex3 + 1
                    else:
                        temp3 = tempstyl6[tempindex3 - 1]
                        tempindex3other = tempindex3 - 1
                    if tempindex4 % 2 == 0:
                        temp4 = tempstyl6[tempindex4 + 1]
                        tempindex4other = tempindex4 + 1
                    else:
                        temp4 = tempstyl6[tempindex4 - 1]
                        tempindex4other = tempindex4 - 1
                    tempindex5 = tempstyl4.index(temp3)
                    tempindex6 = tempstyl4.index(temp4)
                    if tempindex5 % 2 == 0:
                        temp5 = tempstyl4[tempindex5 + 1]
                    else:
                        temp5 = tempstyl4[tempindex5 - 1]
                    if tempindex6 % 2 == 0:
                        temp6 = tempstyl4[tempindex6 + 1]
                    else:
                        temp6 = tempstyl4[tempindex6 - 1]
                    tempindex7 = tempstyl6.index(temp5)
                    if tempindex7 % 2 == 0:
                        temp7 = tempstyl6[tempindex7 + 1]
                        tempindex7other = tempindex7 + 1
                    else:
                        temp7 = tempstyl6[tempindex7 - 1]
                        tempindex7other = tempindex7 - 1
                    if temp7 == temp6:
                        if not ((temp1 in tempstyl5) and
                                (temp2 in tempstyl5) and
                                (temp3 in tempstyl5) and
                                (temp4 in tempstyl5) and
                                (temp5 in tempstyl5) and (temp6 in tempstyl5)):
                            tempstyl5.append(temp1)
                            tempstyl5.append(temp2)
                            tempstyl5.append(temp4)
                            tempstyl5.append(temp3)
                            tempstyl5.append(temp6)
                            tempstyl5.append(temp5)
                            temp = [
                                tempindex3, tempindex3other, tempindex4,
                                tempindex4other, tempindex7, tempindex7other
                            ]
                            temp.sort(reverse=True)
                            del tempstyl6[temp[0]]
                            del tempstyl6[temp[1]]
                            del tempstyl6[temp[2]]
                            del tempstyl6[temp[3]]
                            del tempstyl6[temp[4]]
                            del tempstyl6[temp[5]]
                            for i in np.arange((len(tempstyl4) - 1) / 2, -1,
                                               -1):
                                if not (tempstyl4[2 * i] in tempstyl6) or not (
                                        tempstyl4[2 * i + 1] in tempstyl6):
                                    del tempstyl4[2 * i + 1]
                                    del tempstyl4[2 * i]
                            for i in np.arange((len(tempstyl6) - 1) / 2, -1,
                                               -1):
                                if not (tempstyl6[2 * i] in tempstyl4) or not (
                                        tempstyl6[2 * i + 1] in tempstyl4):
                                    del tempstyl6[2 * i + 1]
                                    del tempstyl6[2 * i]
                            for i in np.arange((len(tempstyl4) - 1) / 2, -1,
                                               -1):
                                if not (tempstyl4[2 * i] in tempstyl6) or not (
                                        tempstyl4[2 * i + 1] in tempstyl6):
                                    del tempstyl4[2 * i + 1]
                                    del tempstyl4[2 * i]
                            for i in np.arange((len(tempstyl6) - 1) / 2, -1,
                                               -1):
                                if not (tempstyl6[2 * i] in tempstyl4) or not (
                                        tempstyl6[2 * i + 1] in tempstyl4):
                                    del tempstyl6[2 * i + 1]
                                    del tempstyl6[2 * i]
                            break


#            tempstylCom=list(set(tempstyl1) & set(tempstyl2))
#            styl=np.setdiff1d(tempstyl1,tempstylCom)
        for i in range(Molecular["MolBondNum"]):
            x1 = self.Molecular["MolXAxis"][self.Molecular["bondX"][i] - 1]
            x2 = self.Molecular["MolXAxis"][self.Molecular["bondY"][i] - 1]
            y1 = self.Molecular["MolYAxis"][self.Molecular["bondX"][i] - 1]
            y2 = self.Molecular["MolYAxis"][self.Molecular["bondY"][i] - 1]
            if (y2 - y1) == 0:
                Xdiff = 0
                Ydiff = np.sqrt(0.003)
            else:
                h = (x2 - x1) / (y2 - y1)
                Xdiff = np.sqrt(0.003 / (h * h + 1))
                Ydiff = Xdiff * h
            if (Molecular["bondNum"][i]
                    == 2) and not (Molecular["bondX"][i] in tempstyl5):
                tempx1 = []
                tempy1 = []
                tempx2 = []
                tempy2 = []
                tempx1.append(x1 + Xdiff)
                tempx1.append(x2 + Xdiff)
                tempy1.append(y1 - Ydiff)
                tempy1.append(y2 - Ydiff)
                tempx2.append(x1 - Xdiff)
                tempx2.append(x2 - Xdiff)
                tempy2.append(y1 + Ydiff)
                tempy2.append(y2 + Ydiff)
                curve2 = Qwt.QwtPlotCurve()
                curve2.setStyle(Qwt.QwtPlotCurve.Lines)
                curve2.attach(self.plot3)
                curve2.setData(tempx1, tempy1)
                curve3 = Qwt.QwtPlotCurve()
                curve3.setStyle(Qwt.QwtPlotCurve.Lines)
                curve3.attach(self.plot3)
                curve3.setData(tempx2, tempy2)
            elif (Molecular["bondNum"][i] == 3):
                tempx = []
                tempy = []
                tempx.append(x1)
                tempx.append(x2)
                tempy.append(y1)
                tempy.append(y2)
                curve1 = Qwt.QwtPlotCurve()
                curve1.setStyle(Qwt.QwtPlotCurve.Lines)
                curve1.attach(self.plot3)
                curve1.setData(tempx, tempy)
                tempx1 = []
                tempy1 = []
                tempx2 = []
                tempy2 = []
                tempx1.append(x1 + Xdiff)
                tempx1.append(x2 + Xdiff)
                tempy1.append(y1 - Ydiff)
                tempy1.append(y2 - Ydiff)
                tempx2.append(x1 - Xdiff)
                tempx2.append(x2 - Xdiff)
                tempy2.append(y1 + Ydiff)
                tempy2.append(y2 + Ydiff)
                curve2 = Qwt.QwtPlotCurve()
                curve2.setStyle(Qwt.QwtPlotCurve.Lines)
                curve2.attach(self.plot3)
                curve2.setData(tempx1, tempy1)
                curve3 = Qwt.QwtPlotCurve()
                curve3.setStyle(Qwt.QwtPlotCurve.Lines)
                curve3.attach(self.plot3)
                curve3.setData(tempx2, tempy2)
            else:
                tempx = []
                tempy = []
                tempx.append(x1)
                tempx.append(x2)
                tempy.append(y1)
                tempy.append(y2)
                curve1 = Qwt.QwtPlotCurve()
                curve1.setStyle(Qwt.QwtPlotCurve.Lines)
                curve1.attach(self.plot3)
                curve1.setData(tempx, tempy)
        t = np.linspace(0, np.pi * 2, 100)
        diffx1 = np.sin(t) * 0.3
        diffy1 = np.cos(t) * 0.3
        for i in range(len(tempstyl5) / 6):
            x0 = 0
            y0 = 0
            diffx = []
            diffy = []
            x0 = Molecular["MolXAxis"][tempstyl5[
                6 * i] - 1] + Molecular["MolXAxis"][tempstyl5[6 * i + 1] - 1]
            x0 = x0 + Molecular["MolXAxis"][tempstyl5[6 * i + 2] -
                                            1] + Molecular["MolXAxis"][
                                                tempstyl5[6 * i + 3] - 1]
            x0 = x0 + Molecular["MolXAxis"][tempstyl5[6 * i + 4] -
                                            1] + Molecular["MolXAxis"][
                                                tempstyl5[6 * i + 5] - 1]
            x0 = x0 / 6
            y0 = Molecular["MolYAxis"][tempstyl5[
                6 * i] - 1] + Molecular["MolYAxis"][tempstyl5[6 * i + 1] - 1]
            y0 = y0 + Molecular["MolYAxis"][tempstyl5[6 * i + 2] -
                                            1] + Molecular["MolYAxis"][
                                                tempstyl5[6 * i + 3] - 1]
            y0 = y0 + Molecular["MolYAxis"][tempstyl5[6 * i + 4] -
                                            1] + Molecular["MolYAxis"][
                                                tempstyl5[6 * i + 5] - 1]
            y0 = y0 / 6
            for i in range(len(diffx1)):
                diffx.append(diffx1[i] + x0)
                diffy.append(diffy1[i] + y0)
            curve4 = Qwt.QwtPlotCurve()
            curve4.setStyle(Qwt.QwtPlotCurve.Lines)
            curve4.attach(self.plot3)
            curve4.setData(diffx, diffy)
        for i in range(Molecular["MolNum"]):
            if Molecular["MolStyle"][i] != 0:
                text = Qwt.QwtText('%s' % Molecular["Mol"][i])
                #                    text=Qwt.QwtText('%s'%str(i+1))
                text.setColor(Qt.blue)
                text.setFont(QFont("Sans", 12))
                text.setBackgroundBrush(Qt.white)
                marker = Qwt.QwtPlotMarker()
                marker.setLabelAlignment(Qt.AlignCenter | Qt.AlignCenter)
                marker.setLabel(text)
                marker.setValue(self.Molecular["MolXAxis"][i],
                                self.Molecular["MolYAxis"][i])
                marker.attach(self.plot3)
        self.plot3.setAxisScale(self.plot3.xBottom,
                                min((min(Molecular["MolXAxis"]) - 0.5), -4),
                                max((max(Molecular["MolXAxis"]) + 0.5), 4))
        self.plot3.setAxisScale(self.plot3.yLeft,
                                min((min(Molecular["MolYAxis"]) - 0.5), -4),
                                max((max(Molecular["MolYAxis"]) + 0.5), 4))
        self.plot3.replot()