Пример #1
0
 def __init__(self, parent=None, analyzer=None, backend=None):
     super(XASMdiArea, self).__init__(parent)
     if analyzer is None:
         analyzer = XASClass.XASClass()
     self.analyzer = analyzer
     #self.setActivationOrder(qt.QMdiArea.CreationOrder)
     self._windowDict = {}
     self._windowList = ["Spectrum", "Post-edge", "Signal", "FT"]
     self._windowList.reverse()
     for title in self._windowList:
         plot = PlotWindow(self, position=True, aspectRatio=False,
                           colormap=False, yInverted=False,
                           roi=False, mask=False, fit=False,
                           backend=backend)
         toolbar = plot.getInteractiveModeToolBar()
         toolbar.getZoomModeAction().setVisible(False)
         toolbar.getPanModeAction().setVisible(False)
         pluginsToolButton = PluginsToolButton(plot=plot)
         plot.toolBar().addWidget(pluginsToolButton)
         plot.setWindowTitle(title)
         self.addSubWindow(plot)
         self._windowDict[title] = plot
         plot.setDataMargins(0, 0, 0.025, 0.025)
     self._windowList.reverse()
     self.setActivationOrder(qt.QMdiArea.StackingOrder)
     self.tileSubWindows()
Пример #2
0
    def __init__(self, parent=None, analyzer=None, color="blue", backend=None):
        super(XASWindow, self).__init__(parent)
        self.setWindowTitle("XAS Window")
        if parent is not None:
            # behave as a widget
            self.setWindowFlags(qt.Qt.Widget)
        if analyzer is None:
            analyzer = XASClass.XASClass()
        self.mdiArea = XASMdiArea(self, analyzer=analyzer, backend=backend)
        self.setCentralWidget(self.mdiArea)
        self.parametersDockWidget = qt.QDockWidget(self)
        self.parametersDockWidget.layout().setContentsMargins(0, 0, 0, 0)
        self.parametersWidget = XASParameters.XASParameters(color=color)
        self.parametersDockWidget.setWidget(self.parametersWidget)
        self.addDockWidget(qt.Qt.RightDockWidgetArea, self.parametersDockWidget)

        # connect
        self.parametersWidget.sigXASParametersSignal.connect(self._parametersSlot)
        self.mdiArea.sigXASMdiAreaSignal.connect(self._update)
Пример #3
0
 def __init__(self, parent=None, analyzer=None, backend=None):
     super(XASMdiArea, self).__init__(parent)
     if analyzer is None:
         analyzer = XASClass.XASClass()
     self.analyzer = analyzer
     #self.setActivationOrder(qt.QMdiArea.CreationOrder)
     self._windowDict = {}
     self._windowList = ["Spectrum", "Post-edge", "Signal", "FT"]
     self._windowList.reverse()
     for title in self._windowList:
         plot = PlotWindow.PlotWindow(self,
                                      #control=True,
                                      position=True,
                                      backend=backend)
         plot.setWindowTitle(title)
         self.addSubWindow(plot)
         self._windowDict[title] = plot
         plot.setDataMargins(0, 0, 0.025, 0.025)
     self._windowList.reverse()
     self.setActivationOrder(qt.QMdiArea.StackingOrder)
     self.tileSubWindows()
Пример #4
0
 def __init__(self, analyzer=None):
     if analyzer is None:
         analyzer = XASClass.XASClass()
     self._analyzer = analyzer
Пример #5
0
        outputDict = {}
        outputDict["names"] = ["Jump", "Edge"]
        output = numpy.zeros((2, e0.shape[0], e0.shape[1]), dtype=e0.dtype)
        output[0, :] = jump.value
        output[1, :] = e0.value
        outputDict["images"] = output
        out.flush()
        out.close()

        t = time.time() - t0
        _logger.debug("First fit elapsed = %f", t)
        _logger.debug("Spectra per second = %f",
                      data.shape[0] * data.shape[1] / float(t))
        t0 = time.time()
        return outputDict


if __name__ == "__main__":
    _logger.setLevel(logging.DEBUG)
    analyzer = XASClass.XASClass()
    instance = XASStackBatch(analyzer=analyzer)
    configurationFile = "test.ini"
    dataFile = h5py.File("testdata.h5", "r")
    for entry in dataFile:
        data = dataFile[entry]["data"]
        energy = dataFile[entry]["energy"]
        break
    instance.setConfigurationFile(configurationFile)
    instance.processMultipleSpectra(energy, data)
    dataFile.close()
Пример #6
0
if __name__ == "__main__":
    _logger.setLevel(logging.DEBUG)
    app = qt.QApplication([])
    from PyMca5.PyMcaIO import specfilewrapper as specfile
    from PyMca5.PyMcaDataDir import PYMCA_DATA_DIR
    if len(sys.argv) > 1:
        fileName = sys.argv[1]
    else:
        fileName = os.path.join(PYMCA_DATA_DIR, "EXAFS_Ge.dat")
    data = specfile.Specfile(fileName)[0].data()[-2:, :]
    energy = data[0, :]
    mu = data[1, :]
    if 0:
        w = XASWindow()
        w.show()
        w.setSpectrum(energy, mu)
        w.update()
        app.exec_()
    else:
        from PyMca5.PyMca import XASClass
        ownAnalyzer = XASClass.XASClass()
        configuration = ownAnalyzer.getConfiguration()
        w = XASDialog()
        w.setSpectrum(energy, mu)
        w.setConfiguration(configuration)
        print("SENT CONFIGURATION", configuration["Normalization"])
        if w.exec_():
            print("PARAMETERS = ", w.getConfiguration())
        else:
            print("PARAMETERS = ", configuration)