示例#1
0
 def __init__(self, parent, data, image=None, x=None, smooth=False):
     qt.QWidget.__init__(self, parent)
     self.setWindowTitle("SNIP Configuration Window")
     self.mainLayout = qt.QVBoxLayout(self)
     self.mainLayout.setMargin(0)
     self.mainLayout.setSpacing(2)
     if image is None:
         image = False
         if data.shape == 2:
             if 1 not in data.shape:
                 image = True
             else:
                 spectrum = data.ravel()
         else:
             spectrum = data
     elif not image:
         spectrum = data
     self.__smooth = smooth
     self.__image = image
     if self.__image:
         self.spectrum = None
     else:
         if x is None:
             self.xValues = range(len(spectrum))
         else:
             self.xValues = x
     if self.__image:
         self.image = data
         self.graphWidget = MaskImageWidget.MaskImageWidget(
             self,
             colormap=True,
             selection=False,
             imageicons=False,
             standalonesave=True)
         self.parametersWidget = SNIP2DParametersWidget(
             self, shape=self.image.shape)
         self.graph = self.graphWidget.graphWidget.graph
         self.graphWidget.setImageData(data)
         self.mainLayout.addWidget(self.parametersWidget)
         self.mainLayout.addWidget(self.graphWidget)
         self.o3dScene = None
     else:
         self.image = None
         self.spectrum = spectrum
         self.parametersWidget = SNIP1DParametersWidget(
             self, length=len(spectrum), smooth=smooth)
         self.graph = ScanWindow.ScanWindow(self)
         self.graph.newCurve(self.xValues,
                             spectrum,
                             "Spectrum",
                             replace=True)
         self.mainLayout.addWidget(self.parametersWidget)
         self.mainLayout.addWidget(self.graph)
     self.xMarkers = []
     self.yMarkers = []
     self.getParameters = self.parametersWidget.getParameters
     self.setParameters = self.parametersWidget.setParameters
     self.connect(self.parametersWidget, qt.SIGNAL('SNIPParametersSignal'),
                  self.updateGraph)
     self.updateGraph(self.getParameters())
示例#2
0
def test(a):
    from PyMca import PyMcaQt as qt
    from PyMca import Specfit
    from PyMca import ScanWindow
    #print dir(a)
    x = numpy.arange(1000).astype(numpy.float)
    p1 = numpy.array([1500,100.,50.0])
    p2 = numpy.array([1500,700.,50.0])
    y = a.gauss(p1,x)+1
    y = y + a.gauss(p2,x)
    app=qt.QApplication([])
    #fit=Specfit.Specfit(root,x,y,
    #                    user_theory='New Theory',
    #                    user_function=a.gauss,
    #                    user_parameters=['Height','Position','FWHM'])
    #                    #user_estimate=estimate)
    fit=Specfit.Specfit(x,y)
    fit.addtheory('Gaussians',a.gauss,['Height','Position','FWHM'],
                    a.estimate_gauss)                       
    fit.settheory('Gaussians')
    fit.setbackground('Linear')
    
    fit.estimate()
    fit.startfit()
    yfit=fit.gendata(x=x,parameters=fit.paramlist)
    print("I set an offset of 1 to see the difference in log scale :-)")
    w = ScanWindow.ScanWindow()
    w.addCurve(x, y + 1, "Data + 1")
    w.addCurve(x, yfit, "Fit")
    w.show()
    app.exec_()
 def __init__(self, parent=None):
     qt.QWidget.__init__(self, parent)
     self.setWindowTitle("Strip and SNIP Configuration Window")
     self.mainLayout = qt.QVBoxLayout(self)
     self.mainLayout.setMargin(0)
     self.mainLayout.setSpacing(2)
     self.parametersWidget = StripParametersWidget(self)
     if SCANWINDOW:
         self.graphWidget = ScanWindow.ScanWindow(self)
     elif QWT:
         self.graphWidget = Plot1DQwt.Plot1DQwt(self)
     else:
         self.graphWidget = Plot1DMatplotlib.Plot1DMatplotlib(self)
     try:
         self.graphWidget.fitButton.hide()
         self.graphWidget.scanWindowInfoWidget.hide()
     except:
         pass
     self.mainLayout.addWidget(self.parametersWidget)
     self.mainLayout.addWidget(self.graphWidget)
     self.getParameters = self.parametersWidget.getParameters
     self.setParameters = self.parametersWidget.setParameters
     self._x = None
     self._y = None
     self.connect(self.parametersWidget,
                  qt.SIGNAL('StripParametersWidgetSignal'), self._slot)
示例#4
0
 def _add(self, replace=False):
     curve = self.getActiveCurve()
     if curve is None:
         text = "Please make sure to have an active curve"
         raise TypeError(text)
     x, y, legend, info = self.getActiveCurve()
     if self.widget is None:
         self.widget = ScanWindow.ScanWindow()
     self.widget.addCurve(x, y, legend=legend, replot=True, replace=replace)
     self.widget.show()
     self.widget.raise_()
示例#5
0
    def __init__(self, origin=None, name='', selection=[], parent=None):
        qt.QWidget.__init__(self, parent)
        self.setWindowTitle('Scan Window' + ' ' + name)
        self.plotWindow = origin
        self.scanWindow = ScanWindow.ScanWindow()
        self.title = name

        self.scanWindow.scanWindowInfoWidget.hide()

        buttonAdd = qt.QPushButton('Add', self)
        buttonReplace = qt.QPushButton('Replace', self)
        buttonAddAll = qt.QPushButton('Add all', self)
        buttonReplaceAll = qt.QPushButton('Replace all', self)

        buttonLayout = qt.QHBoxLayout(None)
        buttonLayout.setContentsMargins(0, 0, 0, 0)
        buttonLayout.setSpacing(5)
        buttonLayout.addWidget(qt.HorizontalSpacer(self))
        buttonLayout.addWidget(buttonAdd)
        buttonLayout.addWidget(buttonAddAll)
        buttonLayout.addWidget(buttonReplace)
        buttonLayout.addWidget(buttonReplaceAll)

        mainLayout = qt.QVBoxLayout(None)
        mainLayout.setContentsMargins(1, 1, 1, 1)
        mainLayout.setSpacing(0)
        mainLayout.addWidget(self.scanWindow)
        mainLayout.addLayout(buttonLayout)
        self.setLayout(mainLayout)

        buttonAdd.clicked.connect(self.add)
        buttonReplace.clicked.connect(self.replace)
        buttonAddAll.clicked.connect(self.addAll)
        buttonReplaceAll.clicked.connect(self.replaceAll)

        if self.plotWindow:
            activeCurve = self.plotWindow.graph.getActiveCurve(justlegend=True)
        else:
            activeCurve = None
        for legend in selection:
            self.plotWindow.setActiveCurve(legend)
            (xVal,  yVal,  leg,  info) = \
                            self.plotWindow.getActiveCurve()
            if 'selectionlegend' in info:
                newLegend = info['selectionlegend']
            elif 'operation' in info:
                newLegend = (str(operation) + ' ' + self.title)
            else:
                newLegend = leg
            self.scanWindow.addCurve(xVal, yVal, newLegend, info)
        if activeCurve:
            self.plotWindow.setActiveCurve(activeCurve)
示例#6
0
 def _transmissionSlot(self, ddict):
     try:
         compoundList = ddict['CompoundList']
         fractionList = ddict['CompoundFraction']
         density = ddict['Density']
         thickness = ddict.get('Thickness', 0.1)
         energy = numpy.arange(1, 100, 0.1)
         data = Elements.getMaterialTransmission(compoundList,
                                                 fractionList,
                                                 energy,
                                                 density=density,
                                                 thickness=thickness,
                                                 listoutput=False)
         addButton = False
         if self.graph is None and (SCANWINDOW):
             self.graphDialog = qt.QDialog(self)
             self.graphDialog.mainLayout = qt.QVBoxLayout(self.graphDialog)
             self.graphDialog.mainLayout.setMargin(0)
             self.graphDialog.mainLayout.setSpacing(0)
             self.graph = ScanWindow.ScanWindow(self.graphDialog)
             self.graphDialog.mainLayout.addWidget(self.graph)
             self.graph._togglePointsSignal()
             self.graph.graph.crossPicker.setEnabled(False)
             addButton = True
         elif self.graph is None:
             self.graphDialog = Plot1DMatplotlib.Plot1DMatplotlibDialog()
             self.graph = self.graphDialog.plot1DWindow
             addButton = True
         if addButton:
             self._addGraphDialogButton()
         if self.__toolMode:
             legend = ddict['Comment']
         else:
             legend = str(self.matCombo.currentText()) +\
                      " with density = %f g/cm3" % density +\
                      " and thickness = %f cm" % thickness
         self.graph.newCurve(energy,
                             data['transmission'],
                             legend=legend,
                             xlabel='Energy (keV)',
                             ylabel='Transmission',
                             replace=True)
         self.graph.setTitle(ddict['Comment'])
         if self.graphDialog is not None:
             self.graphDialog.exec_()
     except:
         msg = qt.QMessageBox(self)
         msg.setIcon(qt.QMessageBox.Critical)
         msg.setText("Error %s" % sys.exc_info()[0])
         msg.exec_()
示例#7
0
 def _massAttenuationSlot(self, ddict):
     try:
         compoundList = ddict['CompoundList']
         fractionList = ddict['CompoundFraction']
         energy = numpy.arange(1, 100, 0.1)
         data = Elements.getMaterialMassAttenuationCoefficients(
             compoundList, fractionList, energy)
         addButton = False
         if (self.graph is None) and SCANWINDOW:
             self.graphDialog = qt.QDialog(self)
             self.graphDialog.mainLayout = qt.QVBoxLayout(self.graphDialog)
             self.graphDialog.mainLayout.setMargin(0)
             self.graphDialog.mainLayout.setSpacing(0)
             self.graph = ScanWindow.ScanWindow(self.graphDialog)
             self.graphDialog.mainLayout.addWidget(self.graph)
             self.graph._togglePointsSignal()
             self.graph.graph.crossPicker.setEnabled(False)
             addButton = True
         elif self.graph is None:
             self.graphDialog = Plot1DMatplotlib.Plot1DMatplotlibDialog()
             self.graph = self.graphDialog.plot1DWindow
             addButton = True
         if addButton:
             self._addGraphDialogButton()
         self.graph.setTitle(ddict['Comment'])
         legend = 'Coherent'
         self.graph.newCurve(energy,
                             numpy.array(data[legend.lower()]),
                             legend=legend,
                             xlabel='Energy (keV)',
                             ylabel='Mass Att. (cm2/g)',
                             replace=True)
         for legend in ['Compton', 'Photo', 'Total']:
             self.graph.newCurve(energy,
                                 numpy.array(data[legend.lower()]),
                                 legend=legend,
                                 xlabel='Energy (keV)',
                                 ylabel='Mass Att. (cm2/g)',
                                 replace=False)
         self.graph.setActiveCurve(legend + ' ' + 'Mass Att. (cm2/g)')
         self.graph.setTitle(ddict['Comment'])
         if self.graphDialog is not None:
             self.graphDialog.exec_()
     except:
         msg = qt.QMessageBox(self)
         msg.setIcon(qt.QMessageBox.Critical)
         msg.setText("Error %s" % sys.exc_info()[0])
         msg.exec_()
示例#8
0
 def __addRegionsWidget(self):
     #Region handling
     self.regionsWidget = RegionsWidget(self)
     self.regionsWidget.setEnabled(False)
     self.connect(self.regionsWidget, qt.SIGNAL('RegionsWidgetSignal'),
                  self.regionsWidgetSlot)
     #the plot
     self.scanWindow = ScanWindow.ScanWindow(self)
     self.scanWindow.scanWindowInfoWidget.hide()
     self.connect(self.scanWindow.graph, qt.SIGNAL("QtBlissGraphSignal"),
                  self._graphSlot)
     if not self.__regions:
         #I am adding after instantiation
         self.mainLayout.insertWidget(2, self.regionsWidget)
         self.mainLayout.addWidget(self.scanWindow)
     self.__regions = True
 def __init__(self, parent, spectrum, energy=None):
     qt.QWidget.__init__(self, parent)
     self.setWindowTitle("XAS Normalization Configuration Window")
     self.mainLayout = qt.QVBoxLayout(self)
     self.mainLayout.setMargin(0)
     self.mainLayout.setSpacing(2)
     if energy is None:
         self.energy = range(len(spectrum))
     else:
         self.energy = energy
     self.spectrum = spectrum
     self.parametersWidget = XASNormalizationParametersWidget(self)
     self.graph = ScanWindow.ScanWindow(self)
     self.__lastDict = {}
     self.__markerHandling = False
     self.__preEdgeMarkers = [None, None]
     self.__postEdgeMarkers = [None, None]
     self.__edgeMarker = None
     if hasattr(self.graph, "scanWindowInfoWidget"):
         self.graph.scanWindowInfoWidget.hide()
         if hasattr(self.graph, "graph"):
             if hasattr(self.graph.graph, "insertX1Marker"):
                 self.__markerHandling = True
                 self.connect(self.graph.graph,
                              qt.SIGNAL("QtBlissGraphSignal"),
                              self._handleGraphSignal)
     self.graph.addCurve(self.energy,
                         spectrum,
                         legend="Spectrum",
                         replace=True)
     self.mainLayout.addWidget(self.parametersWidget)
     self.mainLayout.addWidget(self.graph)
     # initialize variables
     edgeEnergy, sortedX, sortedY, xPrime, yPrime =\
             XASNormalization.estimateXANESEdge(spectrum, energy=self.energy, full=True)
     self._xPrime = xPrime
     self._yPrime = yPrime
     self.parametersWidget.setEdgeEnergy(edgeEnergy,
                                         emin=self.energy.min(),
                                         emax=self.energy.max())
     self.getParameters = self.parametersWidget.getParameters
     self.setParameters = self.parametersWidget.setParameters
     self.connect(self.parametersWidget,
                  qt.SIGNAL('XASNormalizationParametersSignal'),
                  self.updateGraph)
     self.updateGraph(self.getParameters())
示例#10
0
    def __init__(self, *var, **kw):
        ddict = {}
        ddict['usetab'] = True
        ddict.update(kw)
        ddict['standalonesave'] = False
        MaskImageWidget.MaskImageWidget.__init__(self, *var, **ddict)
        self.slider = qt.QSlider(self)
        self.slider.setOrientation(qt.Qt.Horizontal)
        self.slider.setMinimum(0)
        self.slider.setMaximum(0)

        # The 1D graph
        self.vectorGraph = ScanWindow.ScanWindow(self)
        self.mainTab.addTab(self.vectorGraph, "VECTORS")

        self.mainLayout.addWidget(self.slider)
        self.connect(self.slider, qt.SIGNAL("valueChanged(int)"),
                     self._showImage)

        self.imageList = None
        self.imageNames = None
        self.eigenValues = None
        self.eigenVectors = None
        self.vectorNames = None
        self.vectorGraphTitles = None
        standalonesave = kw.get("standalonesave", True)
        if standalonesave:
            self.connect(self.graphWidget.saveToolButton,
                         qt.SIGNAL("clicked()"), self._saveToolButtonSignal)
            self._saveMenu = qt.QMenu()
            self._saveMenu.addAction(qt.QString("Image Data"),
                                     self.saveImageList)
            self._saveMenu.addAction(qt.QString("Standard Graphics"),
                                     self.graphWidget._saveIconSignal)
            if QTVERSION > '4.0.0':
                if MATPLOTLIB:
                    self._saveMenu.addAction(qt.QString("Matplotlib"),
                                             self._saveMatplotlibImage)
        self.multiplyIcon = qt.QIcon(qt.QPixmap(IconDict["swapsign"]))
        infotext = "Multiply image by -1"
        self.multiplyButton = self.graphWidget._addToolButton(\
                                        self.multiplyIcon,
                                        self._multiplyIconChecked,
                                        infotext,
                                        toggle=False,
                                        position=12)
示例#11
0
 def __init__(self, parent, data, image=None, x=None):
     qt.QWidget.__init__(self, parent)
     self.setWindowTitle("Savitzky-Golay Filter Configuration Window")
     self.mainLayout = qt.QVBoxLayout(self)
     self.mainLayout.setMargin(0)
     self.mainLayout.setSpacing(2)
     spectrum = data
     if x is None:
         self.xValues = range(len(spectrum))
     else:
         self.xValues = x
     self.image = None
     self.spectrum = spectrum
     self.parametersWidget = SGParametersWidget(self, length=len(spectrum))
     self.graph = ScanWindow.ScanWindow(self)
     self.graph.newCurve(self.xValues, spectrum, "Spectrum", replace=True)
     self.mainLayout.addWidget(self.parametersWidget)
     self.mainLayout.addWidget(self.graph)
     self.getParameters = self.parametersWidget.getParameters
     self.setParameters = self.parametersWidget.setParameters
     self.connect(self.parametersWidget, qt.SIGNAL('SGParametersSignal'),
                  self.updateGraph)
     self.updateGraph(self.getParameters())
示例#12
0
MENU_TEXT = "Sort Plots"


def getPlugin1DInstance(plotWindow, **kw):
    ob = SortPlots(plotWindow)
    return ob


if __name__ == "__main__":
    from PyMca import ScanWindow
    from PyMca import PyMcaQt as qt
    import numpy
    app = qt.QApplication([])

    sw = ScanWindow.ScanWindow()

    x = numpy.arange(1000.)
    y0 = 10 * x + 10000. * numpy.exp(
        -0.5 * (x - 500) * (x - 500) / 400) + 1500 * numpy.random.random(1000.)
    y1 = 10 * x + 10000. * numpy.exp(
        -0.5 * (x - 600) * (x - 600) / 400) + 1500 * numpy.random.random(1000.)
    y2 = 10 * x + 10000. * numpy.exp(
        -0.5 * (x - 400) * (x - 400) / 400) + 1500 * numpy.random.random(1000.)
    y2[320:322] = 50000.
    info0 = {
        'FileHeader': ['#F /data/id08/inhouse/somerandomname'],
        'xlabel':
        'foo',
        'ylabel':
        'arb',
示例#13
0
    def build(self, comments, height):
        a = []
        for key in Elements.Material.keys():
            a.append(key)
        a.sort()

        if self.__toolMode:
            layout = qt.QHBoxLayout(self)
            layout.setMargin(0)
            layout.setSpacing(0)
        else:
            layout = qt.QVBoxLayout(self)
            layout.setMargin(0)
            layout.setSpacing(0)
            self.__hboxMaterialCombo = qt.QWidget(self)
            hbox = self.__hboxMaterialCombo
            hboxlayout = qt.QHBoxLayout(hbox)
            hboxlayout.setMargin(0)
            hboxlayout.setSpacing(0)
            label = qt.QLabel(hbox)
            label.setText("Material")
            self.matCombo = MaterialComboBox(hbox, options=a)
            hboxlayout.addWidget(label)
            hboxlayout.addWidget(self.matCombo)
            layout.addWidget(hbox)

            #self.matCombo.setEditable(True)
            if QTVERSION < '4.0.0':
                self.connect(self.matCombo,
                             qt.PYSIGNAL('MaterialComboBoxSignal'),
                             self._comboSlot)
            else:
                self.connect(self.matCombo,
                             qt.SIGNAL('MaterialComboBoxSignal'),
                             self._comboSlot)

        self.materialGUI = MaterialGUI(self,
                                       comments=comments,
                                       height=height,
                                       toolmode=self.__toolMode)
        if QTVERSION > '4.0.0':
            self.connect(self.materialGUI,
                         qt.SIGNAL('MaterialTransmissionSignal'),
                         self._transmissionSlot)
            self.connect(self.materialGUI,
                         qt.SIGNAL('MaterialMassAttenuationSignal'),
                         self._massAttenuationSlot)
        if self.__toolMode:
            self.materialGUI.setCurrent(a[0])
            if (self.graph is None) and SCANWINDOW:
                self.graph = ScanWindow.ScanWindow(self)
                self.graph._togglePointsSignal()
                self.graph.fitButton.hide()
                self.graph.graph.crossPicker.setEnabled(False)
            elif self.graph is None:
                self.graph = Plot1DMatplotlib.Plot1DMatplotlib(self)
                self.graph.fitButton.hide()
            layout.addWidget(self.materialGUI)
            layout.addWidget(self.graph)
        else:
            self.materialGUI.setCurrent(a[0])
            layout.addWidget(self.materialGUI)
示例#14
0
def main():
    import sys, numpy
    app = qt.QApplication(sys.argv)
    sw = ScanWindow.ScanWindow()
    legends = ['Curve0', 'Curve1', 'Curve2']
    motors = [{
        'Motor12': 1,
        'Motor11': 8.692713996985609,
        'Motor10': 21.98364185388587,
        'Motor 8': 0.19806882661182112,
        'Motor 9': 0.4844754557916431,
        'Motor 4': 0.3502522172639875,
        'Motor 5': 0.6639252709334457,
        'Motor 6': 0.8130332644206067,
        'Motor 7': 0.22114941021809853,
        'Motor 0': 0.5931882588655031,
        'Motor 1': 0.6780103928805297,
        'Motor 2': 0.26738924783290086,
        'Motor 3': 0.6778906178576761
    }, {
        'Motor18': 0.4707468826876532,
        'Motor17': 0.6958160702991127,
        'Motor16': 0.8257808117546283,
        'Motor15': 0.2587637453100148,
        'Motor14': 0.7392644674355958,
        'Motor13': 0.09084289261899736,
        'Motor12': 2,
        'Motor11': 0.21344565983311958,
        'Motor10': 0.823400550314221,
        'Motor 8': 0.020278096856981342,
        'Motor 9': 0.5687440213219551,
        'Motor 4': 0.8537811553701731,
        'Motor 5': 0.6967303868907243,
        'Motor 6': 0.2691963139564302,
        'Motor 7': 0.7932933343951395,
        'Motor 0': 0.7692165677566825,
        'Motor 1': 0.9590927095265979,
        'Motor 2': 0.010926468369733544,
        'Motor 3': 0.5382649725528551
    }, {
        'Motor12': 2,
        'Motor11': 0.44400576643956124,
        'Motor10': 0.613870067851634,
        'Motor 8': 0.901968648110583,
        'Motor 9': 0.3197687710845185,
        'Motor 4': 0.5714322786278168,
        'Motor 5': 0.2786758361634877,
        'Motor 6': 0.15443677487828655,
        'Motor 7': 0.41623199933237764,
        'Motor 0': 0.294201017230741,
        'Motor 1': 0.813913587747513,
        'Motor 2': 0.5775729031053222,
        'Motor 3': 0.8690451825680668
    }, {
        'Motor13': 0.6491598094029021,
        'Motor12': 10,
        'Motor11': 0.006312468992195397,
        'Motor10': 0.06727805971206435,
        'Motor 8': 0.0929878987747117,
        'Motor 9': 0.014325738753558803,
        'Motor 4': 0.8185362197656616,
        'Motor 5': 0.6643614796103005,
        'Motor 6': 0.6479279384366304,
        'Motor 7': 0.3485172683358245,
        'Motor 0': 0.9858738343685299,
        'Motor 1': 0.9330130170323839,
        'Motor 2': 0.7550180320112966,
        'Motor 3': 0.8814284215685484
    }, {
        'Motor19': 0.39846564175862953,
        'Motor18': 0.2745751180457152,
        'Motor17': 0.42793840508599434,
        'Motor16': 0.5335910248322966,
        'Motor15': 0.14010423968992758,
        'Motor14': 0.27948624022431734,
        'Motor13': 0.1737756266389101,
        'Motor12': 0.6425110521350722,
        'Motor11': 0.9040646490476784,
        'Motor10': 0.22997142790156133,
        'Motor 8': 0.3520106476992403,
        'Motor 9': 0.37023110928070235,
        'Motor 4': 0.8110924828319052,
        'Motor 5': 0.854155188450653,
        'Motor 6': 0.12438157550841666,
        'Motor 7': 0.3303770832430888,
        'Motor 0': 0.4583273673870403,
        'Motor 1': 0.40863603059350373,
        'Motor 2': 0.7396799985670546,
        'Motor 3': 0.5532134465740317,
        'Motor22': 0.7154261407207922,
        'Motor20': 0.6735594219326284,
        'Motor21': 0.24068704947080943
    }, {
        'Motor18': 0.7501922139242619,
        'Motor17': 0.067572631661458,
        'Motor16': 0.23941863624378346,
        'Motor15': 0.543195970137226,
        'Motor14': 0.5045110454536483,
        'Motor13': 0.47129338234441986,
        'Motor12': 0.7039345533241258,
        'Motor11': 0.5496976809598649,
        'Motor10': 0.028685484457880994,
        'Motor 8': 0.3736138811685542,
        'Motor 9': 0.6200990287805606,
        'Motor 4': 0.30138047598948403,
        'Motor 5': 0.15683187764664286,
        'Motor 6': 0.061169736595949264,
        'Motor 7': 0.35931932492621954,
        'Motor 0': 0.7241839150429988,
        'Motor 1': 0.7985803970529565,
        'Motor 2': 0.5239059568843569,
        'Motor 3': 0.7404964999807312
    }, {
        'Motor10': 0.90828582481094,
        'Motor 8': 0.8424405354748069,
        'Motor 9': 0.021278797555318363,
        'Motor 4': 0.8593234401902958,
        'Motor 5': 0.2638651881043157,
        'Motor 6': 0.281687767263718,
        'Motor 7': 0.48283570902507555,
        'Motor 0': 0.659487116102895,
        'Motor 1': 24.591253182578376,
        'Motor 2': 3.032078904732739,
        'Motor 3': 0.17860013910027928
    }, {
        'Motor 8': 0.7246181445974952,
        'Motor 9': 0.5375876404160089,
        'Motor 4': 0.7608877399780997,
        'Motor 5': 0.6164359666836775,
        'Motor 6': 0.3910546574315933,
        'Motor 7': 0.5287834048239588,
        'Motor 0': 0.9700467881758079,
        'Motor 1': 0.9064128957850547,
        'Motor 2': 0.4434306640093745,
        'Motor 3': 0.2783396189782661
    }, {
        'Motor19': 0.4741833534896892,
        'Motor18': 0.1884371839846597,
        'Motor17': 0.660882814263354,
        'Motor16': 0.25871486157318313,
        'Motor15': 0.6181192138005907,
        'Motor14': 0.11534451504645371,
        'Motor13': 0.3356756251510249,
        'Motor12': 0.8578128852052718,
        'Motor11': 0.002943123668270098,
        'Motor10': 0.08980970319869397,
        'Motor 8': 0.40586648583549123,
        'Motor 9': 0.7700310455423328,
        'Motor 4': 0.8389920867382025,
        'Motor 5': 0.2560110245056251,
        'Motor 6': 0.671297941874289,
        'Motor 7': 0.7041220063735543,
        'Motor 0': 0.4865107750866541,
        'Motor 1': 0.8623573559114868,
        'Motor 2': 0.8378911209243649,
        'Motor 3': 0.056056301247044416,
        'Motor24': 0.8535082807686701,
        'Motor22': 0.4362354327544248,
        'Motor23': 0.17386904782647783,
        'Motor20': 0.11001296204329247,
        'Motor21': 0.5653716280128318
    }, {
        'Motor13': 0.5900826517637087,
        'Motor12': 0.2876746207456713,
        'Motor11': 0.1829075413610104,
        'Motor10': 0.9677552520998641,
        'Motor 8': 0.47506344789108046,
        'Motor 9': 0.32097198197020305,
        'Motor 4': 0.5708449042766175,
        'Motor 5': 0.06093583375842648,
        'Motor 6': 0.10172375432338043,
        'Motor 7': 0.989917381621416,
        'Motor 0': 0.8047039621208083,
        'Motor 1': 0.9477209087673744,
        'Motor 2': 0.46582818765280054,
        'Motor 3': 0.0511893987634543
    }, {
        'Motor12': 0.6504890336783156,
        'Motor11': 0.44400576643956124,
        'Motor10': 0.613870067851634,
        'Motor 8': 0.901968648110583,
        'Motor 9': 0.3197687710845185,
        'Motor 4': 0.5714322786278168,
        'Motor 5': 0.2786758361634877,
        'Motor 6': 0.15443677487828655,
        'Motor 7': 0.41623199933237764,
        'Motor 0': 0.294201017230741,
        'Motor 1': 0.813913587747513,
        'Motor 2': 0.5775729031053222,
        'Motor 3': 0.8690451825680668
    }, {
        'Motor13': 0.6491598094029021,
        'Motor12': 0.2975843286841311,
        'Motor11': 0.006312468992195397,
        'Motor10': 0.06727805971206435,
        'Motor 8': 0.0929878987747117,
        'Motor 9': 0.014325738753558803,
        'Motor 4': 0.8185362197656616,
        'Motor 5': 0.6643614796103005,
        'Motor 6': 0.6479279384366304,
        'Motor 7': 0.3485172683358245,
        'Motor 0': 0.9858738343685299,
        'Motor 1': 0.9330130170323839,
        'Motor 2': 0.7550180320112966,
        'Motor 3': 0.8814284215685484
    }, {
        'Motor12': 0.6504890336783156,
        'Motor11': 0.44400576643956124,
        'Motor10': 0.613870067851634,
        'Motor 8': 0.901968648110583,
        'Motor 9': 0.3197687710845185,
        'Motor 4': 0.5714322786278168,
        'Motor 5': 0.2786758361634877,
        'Motor 6': 0.15443677487828655,
        'Motor 7': 0.41623199933237764,
        'Motor 0': 0.294201017230741,
        'Motor 1': 0.813913587747513,
        'Motor 2': 0.5775729031053222,
        'Motor 3': 0.8690451825680668
    }, {
        'Motor13': 0.6491598094029021,
        'Motor12': 0.2975843286841311,
        'Motor11': 0.006312468992195397,
        'Motor10': 0.06727805971206435,
        'Motor 8': 0.0929878987747117,
        'Motor 9': 0.014325738753558803,
        'Motor 4': 0.8185362197656616,
        'Motor 5': 0.6643614796103005,
        'Motor 6': 0.6479279384366304,
        'Motor 7': 0.3485172683358245,
        'Motor 0': 0.9858738343685299,
        'Motor 1': 0.9330130170323839,
        'Motor 2': 0.7550180320112966,
        'Motor 3': 0.8814284215685484
    }]
    x = numpy.arange(1000.)
    y0 = 10 * x + 10000. * numpy.exp(-0.5 * (x - 500) * (x - 500) / 400)
    y1 = 10 * x + 10000. * numpy.exp(-0.5 * (x - 450) * (x - 450) / 400)
    y2 = 10 * x + 10000. * numpy.exp(-0.5 * (x - 400) * (x - 400) / 400)
    sw.addCurve(x, y0, legend="Curve0", replot=True, replace=False)
    sw.addCurve(x, y1, legend="Curve1", replot=True, replace=False)
    sw.addCurve(x, y2, legend="Curve2", replot=True, replace=False)
    #   w = SortPlotsWidget(None, legends,  motors,  sw)
    w = SortPlotsScanWindow(sw, name='foobar')
    w.show()
    app.exec_()
示例#15
0
MENU_TEXT = "XLD/XMCD Analysis"


def getPlugin1DInstance(plotWindow, **kw):
    ob = XMCDAnalysis(plotWindow)
    return ob


if __name__ == "__main__":
    from PyMca import ScanWindow
    from PyMca import PyMcaQt as qt
    import numpy
    app = qt.QApplication([])

    # Create dummy ScanWindow
    swin = ScanWindow.ScanWindow()
    info0 = {
        'xlabel': 'foo',
        'ylabel': 'arb',
        'MotorNames': 'oxPS Motor11 Motor10',
        'MotorValues': '1 8.69271399699 21.9836418539'
    }
    info1 = {
        'MotorNames':
        'PhaseD oxPS Motor16 Motor15',
        'MotorValues':
        '0.470746882688 -0.695816070299 0.825780811755 0.25876374531'
    }
    info2 = {
        'MotorNames': 'PhaseD oxPS Motor10 Motor8',
        'MotorValues': '2 0.44400576644 0.613870067852 0.901968648111'