コード例 #1
0
 def testShow(self):
     from PyMca5.PyMcaGui.plotting import MaskImageWidget
     widget = MaskImageWidget.MaskImageWidget()
     widget.show()
     self.qapp.processEvents()
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
コード例 #2
0
 def testShow(self):
     from PyMca5.PyMcaGui.pymca import ScanWindow
     widget = ScanWindow.ScanWindow()
     widget.show()
     self.qapp.processEvents()
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
コード例 #3
0
 def testShow(self):
     from PyMca5.PyMcaGui.physics.xrf import McaAdvancedFit
     widget = McaAdvancedFit.McaAdvancedFit()
     widget.show()
     self.qapp.processEvents()
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
コード例 #4
0
 def testShow(self):
     from PyMca5.PyMcaGui.plotting import RGBCorrelatorGraph
     widget = RGBCorrelatorGraph.RGBCorrelatorGraph()
     widget.show()
     self.qapp.processEvents()
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
コード例 #5
0
 def testShow(self):
     from PyMca5.PyMcaGui.pymca import RGBCorrelatorWidget
     widget = RGBCorrelatorWidget.RGBCorrelatorWidget()
     widget.show()
     self.qapp.processEvents()
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
コード例 #6
0
 def testShow(self):
     from PyMca5.PyMcaGui.plotting import MaskImageWidget
     widget = MaskImageWidget.MaskImageWidget()
     widget.show()
     self.qapp.processEvents()
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
コード例 #7
0
 def testShow(self):
     from PyMca5.PyMcaGui.pymca import PyMcaMain
     widget = PyMcaMain.PyMcaMain()
     widget.show()
     self.qapp.processEvents()
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
コード例 #8
0
 def testShow(self):
     from PyMca5.PyMcaGui.physics.xrf import McaAdvancedFit
     widget = McaAdvancedFit.McaAdvancedFit()
     widget.show()
     self.qapp.processEvents()
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
コード例 #9
0
 def testShow(self):
     from PyMca5.PyMcaGui.physics.xrf import McaCalWidget
     widget = McaCalWidget.McaCalWidget(y=[1, 2, 3, 4])
     widget.show()
     self.qapp.processEvents()
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
コード例 #10
0
 def testShow(self):
     from PyMca5.PyMcaGui.physics.xas import XASNormalizationWindow
     spectrum = [1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 5, 5, 5, 5, 5, 5]
     widget = XASNormalizationWindow.XASNormalizationWindow(None, spectrum)
     widget.show()
     self.qapp.processEvents()
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
コード例 #11
0
    def _workOnBackend(self, backend):
        from PyMca5.PyMcaGui.physics.xrf import McaAdvancedFit
        from PyMca5.PyMcaGraph.Plot import Plot
        Plot.defaultBackend = backend
        widget = McaAdvancedFit.McaAdvancedFit()
        widget.show()
        self.qapp.processEvents()

        # read the data
        from PyMca5 import PyMcaDataDir
        dataDir = PyMcaDataDir.PYMCA_DATA_DIR
        from PyMca5.PyMcaIO import specfilewrapper as specfile
        from PyMca5.PyMcaPhysics.xrf import ClassMcaTheory
        from PyMca5.PyMcaPhysics.xrf import ConcentrationsTool
        from PyMca5.PyMcaIO import ConfigDict

        dataFile = os.path.join(dataDir, "Steel.spe")
        self.assertTrue(os.path.isfile(dataFile),
                        "File %s is not an actual file" % dataFile)
        sf = specfile.Specfile(dataFile)
        self.assertTrue(len(sf) == 1, "File %s cannot be read" % dataFile)
        self.assertTrue(sf[0].nbmca() == 1, "Spe file should contain MCA data")
        y = counts = sf[0].mca(1)
        x = channels = numpy.arange(y.size).astype(numpy.float)
        sf = None
        widget.setData(x, y)
        self.qapp.processEvents()

        # read the fit configuration
        configFile = os.path.join(dataDir, "Steel.cfg")
        self.assertTrue(os.path.isfile(configFile),
                        "File %s is not an actual file" % configFile)
        configuration = ConfigDict.ConfigDict()
        configuration.read(configFile)
        widget.configure(configuration)
        self.qapp.processEvents()
        time.sleep(1)

        # switch log axis
        #   widget.graphWindow.yLogButton clicked
        isLogy0 = widget.graphWindow.isYAxisLogarithmic()
        self.mouseClick(widget.graphWindow.yLogButton, qt.Qt.LeftButton)
        self.qapp.processEvents()
        isLogy1 = widget.graphWindow.isYAxisLogarithmic()
        self.assertTrue(isLogy0 != isLogy1, "Y scale not toggled!")
        time.sleep(1)
        # reset zoom
        widget.graphWindow.resetZoom()

        # swith energy axis:
        #   widget.graphWindow._energyIconSignal
        #   widget.graphWindow.energyButton clicked
        label0 = widget.graphWindow.getGraphXLabel()
        self.mouseClick(widget.graphWindow.energyButton, qt.Qt.LeftButton)
        self.qapp.processEvents()
        label1 = widget.graphWindow.getGraphXLabel()
        self.assertTrue(label0 != label1, "Energy scale not toggled!")
        self.assertTrue(label0.lower() in ["channel", "energy"],
                        "Unexpected plot X label <%s>" % label0)
        self.assertTrue(label1.lower() in ["channel", "energy"],
                        "Unexpected plot X label <%s>" % label0)

        # reset zoom
        widget.graphWindow.resetZoom()

        # fit:
        #   callback widget.fit
        #   widget.graphWindow.fitButton clicked
        #   widget.graphWindow._fitIconSignal
        self.assertTrue(not widget._fitdone(),
                        "Bad fit widget state. Fit should not be finished")
        self.mouseClick(widget.graphWindow.fitButton, qt.Qt.LeftButton)
        self.qapp.processEvents()
        self.assertTrue(widget._fitdone(),
                        "Bad fit widget state. Fit should be finished")

        # toggle matrix spectrum
        curveList0 = widget.graphWindow.getAllCurves(just_legend=True)
        self.mouseClick(widget.matrixSpectrumButton, qt.Qt.LeftButton)
        self.qapp.processEvents()
        curveList1 = widget.graphWindow.getAllCurves(just_legend=True)
        self.assertTrue(
            abs(len(curveList0) - len(curveList1)) == 1,
            "Matrix spectrum not working!!")

        # toggle peaks
        curveList0 = widget.graphWindow.getAllCurves(just_legend=True)
        for curve in ["Data", "Fit", "Continuum", "Pile-up"]:
            self.assertTrue(curve in curveList0,
                            "Curve <%s> expected but not found" % curve)
        self.mouseClick(widget.peaksSpectrumButton, qt.Qt.LeftButton)
        self.qapp.processEvents()
        curveList1 = widget.graphWindow.getAllCurves(just_legend=True)
        self.assertTrue(
            len(curveList0) != len(curveList1), "Peaks spectrum not working!!")

        time.sleep(1)
        from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
        PyMcaPrintPreview.resetSingletonPrintPreview()
コード例 #12
0
ファイル: PyMcaBatchTest.py プロジェクト: XiaoshengLin/pymca
 def tearDown(self):
     shutil.rmtree(self.path)
     from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
     PyMcaPrintPreview.resetSingletonPrintPreview()
     super(testPyMcaBatch, self).tearDown()
コード例 #13
0
    def _workOnBackend(self, backend):
        from PyMca5.PyMcaGui.physics.xrf import McaAdvancedFit
        from PyMca5.PyMcaGraph.Plot import Plot
        Plot.defaultBackend = backend
        widget = McaAdvancedFit.McaAdvancedFit()
        widget.show()
        self.qapp.processEvents()

        # read the data
        from PyMca5 import PyMcaDataDir
        dataDir = PyMcaDataDir.PYMCA_DATA_DIR        
        from PyMca5.PyMcaIO import specfilewrapper as specfile
        from PyMca5.PyMcaPhysics.xrf import ClassMcaTheory
        from PyMca5.PyMcaPhysics.xrf import ConcentrationsTool
        from PyMca5.PyMcaIO import ConfigDict

        dataFile = os.path.join(dataDir, "Steel.spe")
        self.assertTrue(os.path.isfile(dataFile),
                        "File %s is not an actual file" % dataFile)
        sf = specfile.Specfile(dataFile)
        self.assertTrue(len(sf) == 1, "File %s cannot be read" % dataFile)
        self.assertTrue(sf[0].nbmca() == 1,
                        "Spe file should contain MCA data")
        y = counts = sf[0].mca(1)
        x = channels = numpy.arange(y.size).astype(numpy.float)
        sf = None
        widget.setData(x, y)
        self.qapp.processEvents()

        # read the fit configuration
        configFile = os.path.join(dataDir, "Steel.cfg")
        self.assertTrue(os.path.isfile(configFile),
                        "File %s is not an actual file" % configFile)
        configuration = ConfigDict.ConfigDict()
        configuration.read(configFile)
        widget.configure(configuration)
        self.qapp.processEvents()
        time.sleep(1)

        # switch log axis
        #   widget.graphWindow.yLogButton clicked
        isLogy0 = widget.graphWindow.isYAxisLogarithmic()
        self.mouseClick(widget.graphWindow.yLogButton, qt.Qt.LeftButton)
        self.qapp.processEvents()
        isLogy1 = widget.graphWindow.isYAxisLogarithmic()
        self.assertTrue(isLogy0 != isLogy1,
                        "Y scale not toggled!")
        time.sleep(1)
        # reset zoom
        widget.graphWindow.resetZoom()

        # swith energy axis:
        #   widget.graphWindow._energyIconSignal
        #   widget.graphWindow.energyButton clicked
        label0 = widget.graphWindow.getGraphXLabel()
        self.mouseClick(widget.graphWindow.energyButton, qt.Qt.LeftButton)
        self.qapp.processEvents()
        label1 = widget.graphWindow.getGraphXLabel()
        self.assertTrue(label0 != label1,
                        "Energy scale not toggled!")
        self.assertTrue(label0.lower() in ["channel", "energy"],
                        "Unexpected plot X label <%s>" % label0)
        self.assertTrue(label1.lower() in ["channel", "energy"],
                        "Unexpected plot X label <%s>" % label0)

        # reset zoom
        widget.graphWindow.resetZoom()

        # fit:
        #   callback widget.fit
        #   widget.graphWindow.fitButton clicked
        #   widget.graphWindow._fitIconSignal
        self.assertTrue(not widget._fitdone(),
                        "Bad fit widget state. Fit should not be finished")
        self.mouseClick(widget.graphWindow.fitButton, qt.Qt.LeftButton)
        self.qapp.processEvents()
        self.assertTrue(widget._fitdone(),
                        "Bad fit widget state. Fit should be finished")

        # toggle matrix spectrum
        curveList0 = widget.graphWindow.getAllCurves(just_legend=True)
        self.mouseClick(widget.matrixSpectrumButton, qt.Qt.LeftButton)
        self.qapp.processEvents()
        curveList1 = widget.graphWindow.getAllCurves(just_legend=True)
        self.assertTrue(abs(len(curveList0) - len(curveList1)) == 1,
                        "Matrix spectrum not working!!")

        # toggle peaks
        curveList0 = widget.graphWindow.getAllCurves(just_legend=True)
        for curve in ["Data", "Fit", "Continuum", "Pile-up"]:
            self.assertTrue(curve in curveList0,
                            "Curve <%s> expected but not found" % curve)
        self.mouseClick(widget.peaksSpectrumButton, qt.Qt.LeftButton)
        self.qapp.processEvents()
        curveList1 = widget.graphWindow.getAllCurves(just_legend=True)
        self.assertTrue(len(curveList0) != len(curveList1),
                        "Peaks spectrum not working!!")

        time.sleep(1)
        from PyMca5.PyMcaGui.plotting import PyMcaPrintPreview
        PyMcaPrintPreview.resetSingletonPrintPreview()