示例#1
0
    def __init__(self):
        super(ExperimentTask, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-experiment.ui"), self)
        self.initNextStep()
        self.__dialogState = None

        self._imageLoader.clicked.connect(self.loadImage)
        self._maskLoader.clicked.connect(self.loadMask)
        self._darkLoader.clicked.connect(self.loadDark)
        self._splineLoader.clicked.connect(self.loadSpline)

        self.__plot2D = silx.gui.plot.Plot2D(parent=self._imageHolder)
        self.__plot2D.setKeepDataAspectRatio(True)
        self.__plot2D.getMaskAction().setVisible(False)
        self.__plot2D.getProfileToolbar().setVisible(False)

        colormap = {
            'name': "inferno",
            'normalization': 'log',
            'autoscale': True,
        }
        self.__plot2D.setDefaultColormap(colormap)

        layout = qt.QVBoxLayout(self._imageHolder)
        layout.addWidget(self.__plot2D)
        layout.setContentsMargins(1, 1, 1, 1)
        self._imageHolder.setLayout(layout)
示例#2
0
    def __init__(self):
        super(PeakPickingTask, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-peakpicking.ui"), self)
        self.initNextStep()
        self.__dialogState = None

        layout = qt.QVBoxLayout(self._imageHolder)
        self.__plot = _PeakPickingPlot(parent=self._imageHolder)
        toolBar = self.__createPlotToolBar(self.__plot)
        self.__plot.addToolBar(toolBar)
        statusBar = self.__createPlotStatusBar(self.__plot)
        self.__plot.setStatusBar(statusBar)

        layout.addWidget(self.__plot)
        layout.setContentsMargins(1, 1, 1, 1)
        self._imageHolder.setLayout(layout)

        self._ringSelectionMode.setIcon(icons.getQIcon("search-ring"))
        self._peakSelectionMode.setIcon(icons.getQIcon("search-peak"))
        self.__peakSelectionView = None
        self.__plot.sigPlotSignal.connect(self.__onPlotEvent)

        self.__undoStack = qt.QUndoStack(self)
        self._undoButton.setDefaultAction(
            self.__undoStack.createUndoAction(self, "Undo"))
        self._redoButton.setDefaultAction(
            self.__undoStack.createRedoAction(self, "Redo"))

        self.__mode = qt.QButtonGroup()
        self.__mode.setExclusive(True)
        self.__mode.addButton(self._peakSelectionMode)
        self.__mode.addButton(self._ringSelectionMode)
        self._ringSelectionMode.setChecked(True)

        self._extract.clicked.connect(self.__autoExtractRings)
示例#3
0
    def __init__(self):
        super(GeometryTask, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-geometry.ui"), self)
        self.initNextStep()

        self.__plot = self.__createPlot()

        layout = qt.QVBoxLayout(self._imageHolder)
        layout.addWidget(self.__plot)
        layout.setContentsMargins(1, 1, 1, 1)
        self._imageHolder.setLayout(layout)

        layout = qt.QGridLayout(self._settings)
        self.__wavelength = FitParamView(self, "Wavelength:", u"Å")
        self.addParameterToLayout(layout, self.__wavelength)

        layout = qt.QGridLayout(self._geometry)
        self.__distance = FitParamView(self, "Distance:", "m")
        self.__poni1 = FitParamView(self, "PONI1:", u"m")
        self.__poni2 = FitParamView(self, "PONI2:", u"m")
        self.__rotation1 = FitParamView(self, "Rotation 1:", u"rad")
        self.__rotation2 = FitParamView(self, "Rotation 2:", u"rad")
        self.__rotation3 = FitParamView(self, "Rotation 3:", u"rad")
        self.addParameterToLayout(layout, self.__distance)
        self.addParameterToLayout(layout, self.__poni1)
        self.addParameterToLayout(layout, self.__poni2)
        self.addParameterToLayout(layout, self.__rotation1)
        self.addParameterToLayout(layout, self.__rotation2)
        self.addParameterToLayout(layout, self.__rotation3)

        self._fitButton.clicked.connect(self.__fitGeometry)
        self._fitButton.setDisabledWhenWaiting(True)
        self._resetButton.clicked.connect(self.__resetGeometry)
        self.__calibration = None
示例#4
0
    def __init__(self):
        super(PeakPickingTask, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-peakpicking.ui"), self)
        self.initNextStep()
        self.__dialogState = None

        layout = qt.QVBoxLayout(self._imageHolder)
        self.__plot = _PeakPickingPlot(parent=self._imageHolder)
        toolBar = self.__createPlotToolBar(self.__plot)
        self.__plot.addToolBar(toolBar)
        statusBar = self.__createPlotStatusBar(self.__plot)
        self.__plot.setStatusBar(statusBar)

        layout.addWidget(self.__plot)
        layout.setContentsMargins(1, 1, 1, 1)
        self._imageHolder.setLayout(layout)

        self._ringSelectionMode.setIcon(icons.getQIcon("search-ring"))
        self._peakSelectionMode.setIcon(icons.getQIcon("search-peak"))
        self.__peakSelectionView = None
        self.__plot.sigPlotSignal.connect(self.__onPlotEvent)

        self.__undoStack = qt.QUndoStack(self)
        self._undoButton.setDefaultAction(self.__undoStack.createUndoAction(self, "Undo"))
        self._redoButton.setDefaultAction(self.__undoStack.createRedoAction(self, "Redo"))

        self.__mode = qt.QButtonGroup()
        self.__mode.setExclusive(True)
        self.__mode.addButton(self._peakSelectionMode)
        self.__mode.addButton(self._ringSelectionMode)
        self._ringSelectionMode.setChecked(True)

        self._extract.clicked.connect(self.__autoExtractRings)
示例#5
0
    def __init__(self):
        super(MaskTask, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-mask.ui"), self)
        self.initNextStep()

        self.__plot = self.__createPlot()
        self.__maskPanel = silx.gui.plot.MaskToolsWidget.MaskToolsWidget(parent=self._toolHolder, plot=self.__plot)
        self.__maskPanel.setDirection(qt.QBoxLayout.TopToBottom)
        self.__maskPanel.setMultipleMasks("single")

        layout = qt.QVBoxLayout(self._toolHolder)
        layout.addWidget(self.__maskPanel)
        layout.setContentsMargins(0, 0, 0, 0)
        self._toolHolder.setLayout(layout)

        layout = qt.QVBoxLayout(self._imageHolder)
        layout.addWidget(self.__plot)
        layout.setContentsMargins(1, 1, 1, 1)
        self._imageHolder.setLayout(layout)

        # FIXME ask for a stable API
        self.__maskPanel._mask.sigChanged.connect(self.__maskFromPlotChanged)
        self.widgetShow.connect(self.__widgetShow)
        self.widgetHide.connect(self.__widgetHide)

        self.__plotMaskChanged = False
        self.__modelMaskChanged = False
示例#6
0
    def __init__(self):
        super(ExperimentTask, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-experiment.ui"), self)
        self.initNextStep()
        self.__dialogState = None

        self._imageLoader.clicked.connect(self.loadImage)
        self._maskLoader.clicked.connect(self.loadMask)
        self._darkLoader.clicked.connect(self.loadDark)
        self._splineLoader.clicked.connect(self.loadSpline)

        self.__plot2D = silx.gui.plot.Plot2D(parent=self._imageHolder)
        self.__plot2D.setKeepDataAspectRatio(True)
        self.__plot2D.getMaskAction().setVisible(False)
        self.__plot2D.getProfileToolbar().setVisible(False)
        self.__plot2D.setDataMargins(0.1, 0.1, 0.1, 0.1)
        self.__plot2D.setGraphXLabel("Y")
        self.__plot2D.setGraphYLabel("X")

        colormap = {
            'name': "inferno",
            'normalization': 'log',
            'autoscale': True,
        }
        self.__plot2D.setDefaultColormap(colormap)

        layout = qt.QVBoxLayout(self._imageHolder)
        layout.addWidget(self.__plot2D)
        layout.setContentsMargins(1, 1, 1, 1)
        self._imageHolder.setLayout(layout)
示例#7
0
文件: MaskTask.py 项目: vallsv/pyFAI
    def __init__(self):
        super(MaskTask, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-mask.ui"), self)
        self.initNextStep()

        self.__plot = self.__createPlot()
        self.__maskPanel = silx.gui.plot.MaskToolsWidget.MaskToolsWidget(parent=self._toolHolder, plot=self.__plot)
        self.__maskPanel.setDirection(qt.QBoxLayout.TopToBottom)
        self.__maskPanel.setMultipleMasks("single")

        layout = qt.QVBoxLayout(self._toolHolder)
        layout.addWidget(self.__maskPanel)
        layout.setContentsMargins(0, 0, 0, 0)
        self._toolHolder.setLayout(layout)

        layout = qt.QVBoxLayout(self._imageHolder)
        layout.addWidget(self.__plot)
        layout.setContentsMargins(1, 1, 1, 1)
        self._imageHolder.setLayout(layout)

        # FIXME ask for a stable API
        self.__maskPanel._mask.sigChanged.connect(self.__maskFromPlotChanged)
        self.widgetShow.connect(self.__widgetShow)
        self.widgetHide.connect(self.__widgetHide)

        self.__plotMaskChanged = False
        self.__modelMaskChanged = False
示例#8
0
    def __init__(self):
        super(CalibrationWindow, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-main.ui"), self)
        self.__model = CalibrationModel()

        self.__tasks = self.createTasks()
        for task in self.__tasks:
            task.setModel(self.__model)
            task.nextTaskRequested.connect(self.nextTask)
            self._list.addItem(task.windowTitle())
            self._stack.addWidget(task)
        if len(self.__tasks) > 0:
            self._list.setCurrentRow(0)
示例#9
0
    def __init__(self):
        super(CalibrationWindow, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-main.ui"), self)
        self.__model = CalibrationModel()

        self.__tasks = self.createTasks()
        for task in self.__tasks:
            task.setModel(self.__model)
            task.nextTaskRequested.connect(self.nextTask)
            self._list.addItem(task.windowTitle())
            self._stack.addWidget(task)
        if len(self.__tasks) > 0:
            self._list.setCurrentRow(0)
示例#10
0
    def __init__(self):
        super(IntegrationTask, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-result.ui"), self)
        self.initNextStep()

        self.__integrationUpToDate = True
        self.__ringLegends = []
        self.__plot1d = silx.gui.plot.Plot1D(self)
        self.__plot1d.setGraphXLabel("Radial")
        self.__plot1d.setGraphYLabel("Intensity")
        self.__plot1d.setGraphGrid(True)
        self.__plot2d = silx.gui.plot.Plot2D(self)
        self.__plot2d.setGraphXLabel("Radial")
        self.__plot2d.setGraphYLabel("Azimuthal")

        self.__defaultColorMap = {
            'name': "inferno",
            'normalization': 'log',
            'autoscale': True,
        }
        self.__plot2d.setDefaultColormap(self.__defaultColorMap)

        layout = qt.QVBoxLayout(self._imageHolder)
        layout.setContentsMargins(1, 1, 1, 1)
        layout.addWidget(self.__plot2d)
        layout.addWidget(self.__plot1d)
        self._radialUnit.setUnits(pyFAI.units.RADIAL_UNITS.values())
        self.__polarizationModel = None
        self._polarizationFactorCheck.clicked[bool].connect(
            self.__polarizationFactorChecked)
        self.widgetShow.connect(self.__widgetShow)

        self._integrateButton.beforeExecuting.connect(self.__integrate)
        self._integrateButton.setDisabledWhenWaiting(True)
        self._integrateButton.finished.connect(self.__integratingFinished)

        self._savePoniButton.clicked.connect(self.__saveAsPoni)
        self._saveJsonButton.clicked.connect(self.__saveAsJson)
示例#11
0
    def __init__(self):
        super(GeometryTask, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-geometry.ui"), self)
        self.initNextStep()
        self.widgetShow.connect(self.__widgetShow)

        self.__plot = self.__createPlot()

        layout = qt.QVBoxLayout(self._imageHolder)
        layout.addWidget(self.__plot)
        layout.setContentsMargins(1, 1, 1, 1)
        self._imageHolder.setLayout(layout)

        layout = qt.QGridLayout(self._settings)
        self.__wavelength = FitParamView(self, "Wavelength:", u"Å")
        self.addParameterToLayout(layout, self.__wavelength)

        layout = qt.QGridLayout(self._geometry)
        self.__distance = FitParamView(self, "Distance:", "m")
        self.__poni1 = FitParamView(self, "PONI1:", u"m")
        self.__poni2 = FitParamView(self, "PONI2:", u"m")
        self.__rotation1 = FitParamView(self, "Rotation 1:", u"rad")
        self.__rotation2 = FitParamView(self, "Rotation 2:", u"rad")
        self.__rotation3 = FitParamView(self, "Rotation 3:", u"rad")
        self.addParameterToLayout(layout, self.__distance)
        self.addParameterToLayout(layout, self.__poni1)
        self.addParameterToLayout(layout, self.__poni2)
        self.addParameterToLayout(layout, self.__rotation1)
        self.addParameterToLayout(layout, self.__rotation2)
        self.addParameterToLayout(layout, self.__rotation3)

        self._fitButton.clicked.connect(self.__fitGeometry)
        self._fitButton.setDisabledWhenWaiting(True)
        self._resetButton.clicked.connect(self.__resetGeometry)
        self.__calibration = None
        self.__peaksInvalidated = False
        self.__fitting = False
示例#12
0
    def __init__(self):
        super(IntegrationTask, self).__init__()
        qt.loadUi(pyFAI.utils.get_ui_file("calibration-result.ui"), self)
        self.initNextStep()

        self.__integrationUpToDate = True
        self.__ringLegends = []
        self.__plot1d = silx.gui.plot.Plot1D(self)
        self.__plot1d.setGraphXLabel("Radial")
        self.__plot1d.setGraphYLabel("Intensity")
        self.__plot1d.setGraphGrid(True)
        self.__plot2d = silx.gui.plot.Plot2D(self)
        self.__plot2d.setGraphXLabel("Radial")
        self.__plot2d.setGraphYLabel("Azimuthal")

        self.__defaultColorMap = {
            'name': "inferno",
            'normalization': 'log',
            'autoscale': True,
        }
        self.__plot2d.setDefaultColormap(self.__defaultColorMap)

        layout = qt.QVBoxLayout(self._imageHolder)
        layout.setContentsMargins(1, 1, 1, 1)
        layout.addWidget(self.__plot2d)
        layout.addWidget(self.__plot1d)
        self._radialUnit.setUnits(pyFAI.units.RADIAL_UNITS.values())
        self.__polarizationModel = None
        self._polarizationFactorCheck.clicked[bool].connect(self.__polarizationFactorChecked)
        self.widgetShow.connect(self.__widgetShow)

        self._integrateButton.beforeExecuting.connect(self.__integrate)
        self._integrateButton.setDisabledWhenWaiting(True)
        self._integrateButton.finished.connect(self.__integratingFinished)

        self._savePoniButton.clicked.connect(self.__saveAsPoni)
        self._saveJsonButton.clicked.connect(self.__saveAsJson)