Exemplo n.º 1
0
    def __init__(self, parent=None):
        super(VisPSD, self).__init__(parent)
        self.setupUi(self)
        self.splitter.setStretchFactor(0, 0)
        self.splitter.setStretchFactor(1, 100)

        self._colors = colors.colors()
        self.xmin = None
        self.xmax = None
        self.ymin = None
        self.ymax = None
        self._xFunc = None

        # setup class-types, and plotting-curve types for the list
        self.listView_datasets.supportedClasses = self.supportedClasses
        self.listView_datasets.setItemClass(DFItem)

        #        for xVal in self.X_VALUES:
        #            self.comboBox_xValues.addItem(xVal[0])
        #        self.doubleSpinBox_wavelength.setValue(powderdiffraction.CuKa)

        self.plotWidget.plotItem.setLabel("left", "Frequency")
        self.plotWidget.plotItem.setLabel("bottom",
                                          "Diameter ({}m)".format(uchars.mu))
        self.plotWidget.plotItem.setLogMode(x=True)

        # --- signal connections --- #
        self.listView_datasets.model().itemsAdded.connect(self.addCurves)
        self.listView_datasets.model().itemTextUpdated.connect(
            self.plotWidget.plotItem.resetLegend)
        self.listView_datasets.model().itemToggled.connect(self.itemToggled)
        self.listView_datasets.model().rowsMoved.connect(self.processNewLayout)
        self.listView_datasets.model().itemsDeleted.connect(
            self.processNewLayout)
Exemplo n.º 2
0
    def __init__(self, parent=None):
        super(VisPowderDiffraction, self).__init__(parent)
        self.setupUi(self)
        self.splitter.setStretchFactor(0, 0)
        self.splitter.setStretchFactor(1, 100)

        self._colors = colors.colors()
        self.xmin = None
        self.xmax = None
        self.ymin = None
        self.ymax = None
        self._xFunc = None

        # setup class-types, and plotting-curve types for the list
        self.listView_datasets.setItemClass(DFItem)
        self.listView_datasets.supportedClasses = self.supportedClasses

        for xVal in self.x_values:
            self.comboBox_xValues.addItem(xVal[0])
        self.doubleSpinBox_wavelength.setValue(powderdiffraction.CuKa)

        self.plotWidget.plotItem.setLabel("left", "intensity")
        self.plotWidget.plotItem.setLabel("bottom", "two-theta (deg)")

        # --- signal connections --- #
        self.listView_datasets.model().itemsAdded.connect(self.addCurves)
        self.listView_datasets.model().itemTextUpdated.connect(
            self.plotWidget.plotItem.resetLegend)
        self.listView_datasets.model().itemToggled.connect(self.itemToggled)
        self.listView_datasets.model().rowsMoved.connect(self.processNewLayout)
        self.listView_datasets.model().itemsDeleted.connect(
            self.processNewLayout)
        # self.listView_datasets.model().rowsRemoved.connect(self.processNewLayout)
        self.doubleSpinBox_wavelength.editingFinished.connect(
            self.determineXBounds)
        self.doubleSpinBox_wavelength.editingFinished.connect(
            self.setXDataFunction)
        self.doubleSpinBox_wavelength.editingFinished.connect(
            self.recalculateXValues)
        self.checkBox_normalize.stateChanged.connect(self.recalculateYValues)
        self.checkBox_xStagger.stateChanged.connect(self.recalculateXValues)
        self.checkBox_xStagger.stateChanged.connect(
            self.doubleSpinBox_xStagger.setEnabled)
        self.checkBox_yStagger.stateChanged.connect(self.recalculateYValues)
        self.checkBox_yStagger.stateChanged.connect(
            self.doubleSpinBox_yStagger.setEnabled)
        self.doubleSpinBox_yStagger.valueChanged.connect(
            self.recalculateYValues)
        self.doubleSpinBox_xStagger.valueChanged.connect(
            self.recalculateXValues)
        self.comboBox_xValues.currentIndexChanged.connect(
            self.xSelectionChanged)
        # --- end signal connections --- #

        self.doubleSpinBox_yStagger.setEnabled(False)
        self.doubleSpinBox_xStagger.setEnabled(False)
        self.setXDataFunction()
Exemplo n.º 3
0
 def resetColors(self):
     self._colors = colors.colors()
Exemplo n.º 4
0
    def __init__(self, parent=None):
        super(VisTGA, self).__init__(parent)
        self.setupUi(self)
        self.splitter.setStretchFactor(0, 0)
        self.splitter.setStretchFactor(1, 100)

        self._colors = colors.colors()
        self.xmin = None
        self.xmax = None
        self.y1min = None
        self.y1max = None
        self.y2min = None
        self.y2max = None

        self.xlabel = None
        self.y1label = None
        self.y2label = None

        self._xFunc = None
        self._y1Func = None
        self._y2Func = None

        # setup class-types, and plotting-curve types for the list
        self.listView_datasets.supportedClasses = self.supportedClasses
        self.listView_datasets.setItemClass(DFItem)

        # Setup plotting choices
        for x_key in self.X_COMBO:
            self.comboBox_x.addItem(x_key)
        for y_key in self.Y1_COMBO:
            self.comboBox_y1.addItem(y_key)
        for y_key in self.Y2_COMBO:
            self.comboBox_y2.addItem(y_key)

        self.comboBox_x.setCurrentIndex(0)
        self.comboBox_y1.setCurrentIndex(0)
        self.comboBox_y2.setCurrentIndex(1)

        self.plotWidget.plotItem.setLabel("left", "Weight (mg)")
        self.plotWidget.plotItem.setLabel("bottom", "Temperature (°C)")

        # Setup secondary y axis
        # pyqtgraph does not have this really built in
        # A new viewbox must be created which will hold its own plotDataItems
        # That viewbox must be linked to the existing plotItem
        # Adapted from : https://stackoverflow.com/questions/23679159/two-y-scales-in-pyqtgraph-twinx-like
        # PlotDataItems (or PlotCurveItems etc..) can now be added to
        # the self.y2ViewBox via its addItem function
        self.plotWidget.plotItem.showAxis("right")
        self.plotWidget.plotItem.setLabel("right", "Deriv. Weight (mg/°C)")
        self.y2ViewBox = pg.ViewBox()
        self.plotWidget.plotItem.scene().addItem(self.y2ViewBox)
        self.plotWidget.plotItem.getAxis('right').linkToView(self.y2ViewBox)
        self.y2ViewBox.setXLink(self.plotWidget.plotItem)
        self.updateViews()
        self.plotWidget.plotItem.getViewBox().sigResized.connect(
            self.updateViews)

        # --- signal connections --- #
        # Taking the lazy approach with a complete redraw every time something changes
        # as opposed to changing only what is required
        self.listView_datasets.model().itemsAdded.connect(
            self.processNewLayout)
        self.listView_datasets.model().itemTextUpdated.connect(
            self.processNewLayout)
        self.listView_datasets.model().itemToggled.connect(
            self.processNewLayout)
        self.listView_datasets.model().rowsMoved.connect(self.processNewLayout)
        self.listView_datasets.model().itemsDeleted.connect(
            self.processNewLayout)
        self.checkBox_normalizeWeight.stateChanged.connect(
            self.processNewLayout)
        self.comboBox_x.currentIndexChanged.connect(self.processNewLayout)
        self.comboBox_y1.currentIndexChanged.connect(self.processNewLayout)
        self.comboBox_y2.currentIndexChanged.connect(self.processNewLayout)
        # --- end signal connections --- #

        self.setXDataFunction()
        self.setY1DataFunction()
        self.setY2DataFunction()