Пример #1
0
    def __init__(self):
        # Check syntax
        super(PmtXYPlot, self).__init__()
        
        # Counter
        self.ctr = expt.getNICounter(gateTime=100)

        self.setCanvasBackground(QtGui.QColor("white"))
        #self.alignScales()


        self.x = arange(0.0, 100.1, 1.)
        self.y = zeros(len(self.x), Float)

        self.setTitle("PMT Counts")
        self.curve = Qwt.QwtPlotCurve("Counts")
        self.curve.attach(self)

        self.curve.setSymbol(Qwt.QwtSymbol(
            Qwt.QwtSymbol.Ellipse,
            QtGui.QBrush(QtGui.QColor("black")),
            QtGui.QPen(QtGui.QColor("black")),
            QtCore.QSize(5, 5),
        ))

        self.setAxisTitle(Qwt.QwtPlot.xBottom, "Time (units)")
        self.setAxisTitle(Qwt.QwtPlot.yLeft, "Counts/bin")
        
        self.startTimer(10)
Пример #2
0
 def plot_data(self, plot, samples):
     self.x = list(range(0, len(samples), 1))
     self.y = samples
     # clear the previous points from the plot
     plot.clear()
     # draw curve with new points and plot
     curve = Qwt.QwtPlotCurve()
     curve.setPen(Qt.QPen(Qt.Qt.blue, 2))
     curve.attach(plot)
     curve.setData(self.x, self.y)
     plot.replot()
Пример #3
0
    def __init__(self, QwtPlot, chartHistoryLen, **kwargs):
        curveColor = kwargs.get('curveColor', Qt.Qt.green)
        curveTitle = kwargs.get('curveTitle', '')
        self.curveMovement = kwargs.get('curveMovement', 0)

        self.curve = Qwt.QwtPlotCurve(curveTitle)
        self.x = arange(0, chartHistoryLen, 1)
        self.y = zeros(len(self.x), Float)
        self.curve.attach(QwtPlot)
        self.curve.setPen(Qt.QPen(curveColor))
        self.curve.setSymbol(
            Qwt.QwtSymbol(
                Qwt.QwtSymbol.Ellipse,
                Qt.QBrush(curveColor),
                Qt.QPen(curveColor),
                Qt.QSize(5, 5),
            ))

def plotSomething():
    global ys
    ys = numpy.roll(ys, -1)
    c.setData(xs, ys)
    uiplot.qwtPlot.replot()


if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    win_plot = ui_plot.QtGui.QMainWindow()
    uiplot = ui_plot.Ui_win_plot()
    uiplot.setupUi(win_plot)

    # tell buttons what to do when clicked
    uiplot.btnA.clicked.connect(plotSomething)
    uiplot.btnB.clicked.connect(lambda: uiplot.timer.setInterval(100.0))
    uiplot.btnC.clicked.connect(lambda: uiplot.timer.setInterval(10.0))
    uiplot.btnD.clicked.connect(lambda: uiplot.timer.setInterval(1.0))

    # set up the QwtPlot (pay attention!)
    c = Qwt.QwtPlotCurve()  #make a curve
    c.attach(uiplot.qwtPlot)  #attach it to the qwtPlot object
    uiplot.timer = QtCore.QTimer()  #start a timer (to call replot events)
    uiplot.timer.start(100.0)  #set the interval (in ms)
    win_plot.connect(uiplot.timer, QtCore.SIGNAL('timeout()'), plotSomething)

    # show the main window
    win_plot.show()
    sys.exit(app.exec_())
Пример #5
0
    def __init__(self, iface):
        '''costruttore'''
        QDialog.__init__(self, iface.mainWindow())
        self.setupUi(self)
        self.iface = iface
        self.activeLayer = self.iface.activeLayer()
        self.Xgraph = self.Ygraph = []
        self.fzyValuer = {}  #hold the valuer for fuzzify matrix
        for i in range(1, self.toolBox.count()):
            self.toolBox.setItemEnabled(i, False)
        QObject.connect(self.SetBtnQuit, SIGNAL("clicked()"), self,
                        SLOT("reject()"))
        self.SetBtnAbout.clicked.connect(self.about)
        self.SetBtnHelp.clicked.connect(self.open_help)
        #QObject.connect(self.EnvAddFieldBtn, SIGNAL( "clicked()" ), self.AddField)
        self.EnvCalculateBtn.clicked.connect(self.AnalyticHierarchyProcess)
        self.EnvGetWeightBtn.clicked.connect(self.Elaborate)
        self.RenderBtn.clicked.connect(self.RenderLayer)
        self.GraphBtn.clicked.connect(self.BuildOutput)
        QObject.connect(self.AnlsBtnBox, SIGNAL("rejected()"), self,
                        SLOT("reject()"))
        self.FzyFieldBtn.clicked.connect(self.getFzyGraph)
        self.FzfyListFieldsCBox.currentIndexChanged.connect(self.setqwtPlot)
        self.qwtPlot.setAutoReplot()
        self.qwtPlot.setAxisScale(0, 0, 1, 0.1)
        self.picker = Qwt.QwtPlotPicker(
            Qwt.QwtPlot.xBottom,
            Qwt.QwtPlot.yLeft,
            #Qwt.QwtPicker.PointSelection,
            Qwt.QwtPicker.PolygonSelection,
            #Qwt.QwtPlotPicker.CrossRubberBand,
            Qwt.QwtPlotPicker.PolygonRubberBand,
            Qwt.QwtPicker.AlwaysOn,
            self.qwtPlot.canvas())
        self.picker.setRubberBandPen(QPen(Qt.red))
        #self.picker.connect(self.picker,SIGNAL('selected(const QwtDoublePoint&)'), self.pickPoints)
        self.picker.connect(self.picker, SIGNAL('selected(const QwtPolygon&)'),
                            self.pickPoints)
        # curves
        self.curve = Qwt.QwtPlotCurve('Fuzzify')
        self.curve.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased)
        self.curve.setPen(QPen(Qt.blue))
        self.curve.setYAxis(self.qwtPlot.yLeft)
        self.curve.attach(self.qwtPlot)

        sourceIn = str(self.iface.activeLayer().source())
        pathSource = os.path.dirname(sourceIn)
        outputFile = "geoFuzzy.shp"
        sourceOut = os.path.join(pathSource, outputFile)

        self.EnvMapNameLbl.setText(self.activeLayer.name())
        self.EnvlistFieldsCBox.addItems(self.GetFieldNames(self.activeLayer))
        self.FzfyListFieldsCBox.addItems(self.GetFieldNames(self.activeLayer))
        self.LabelListFieldsCBox.addItems(self.GetFieldNames(self.activeLayer))
        #################################################################################
        Envfields = self.GetFieldNames(self.activeLayer)  #field list
        self.EnvTableWidget.setColumnCount(len(Envfields))
        self.EnvTableWidget.setHorizontalHeaderLabels(Envfields)
        self.EnvTableWidget.setRowCount(len(Envfields))
        self.EnvTableWidget.setVerticalHeaderLabels(Envfields)

        EnvSetLabel = ["Hedges", "Min", "Max", "Set"]
        self.EnvParameterWidget.setColumnCount(len(Envfields))
        self.EnvParameterWidget.setHorizontalHeaderLabels(Envfields)
        self.EnvParameterWidget.setRowCount(len(EnvSetLabel))
        self.EnvParameterWidget.setVerticalHeaderLabels(EnvSetLabel)
        for r in range(len(Envfields)):
            self.EnvTableWidget.setItem(r, r, QTableWidgetItem("1.0"))
        self.EnvTableWidget.cellChanged[(int,
                                         int)].connect(self.CompleteMatrix)
        self.updateTable()
        ###############################ContextMenu########################################
        #		self.EnvTableWidget.setContextMenuPolicy(Qt.CustomContextMenu)
        #		self.EnvTableWidget.customContextMenuRequested.connect(self.removePopup)
        headers = self.EnvParameterWidget.horizontalHeader()
        headers.setContextMenuPolicy(Qt.CustomContextMenu)
        headers.customContextMenuRequested.connect(self.popMenu)
        #################################################################################
        setting = self.csv2setting()
        try:
            self.setting2table(setting)
        except:
            pass
        for i in range(1, self.toolBox.count()):
            self.toolBox.setItemEnabled(i, True)