Commit b757acc3 authored by payno's avatar payno
Browse files

[gui][autobk / xftf] rework plot between autobk and xftf

parent 2262a5c0
......@@ -42,7 +42,12 @@ from orangecontrib.est.process import _ProcessForOrangeMixIn
from orangecontrib.est.process import ProcessRunnable
from est.core.types import XASObject
from est.gui.XasObjectViewer import XasObjectViewer, ViewType
from est.gui.XasObjectViewer import _plot_bkg, _plot_spectrum, _plot_knots
from est.gui.XasObjectViewer import (
_plot_bkg,
_plot_spectrum,
_plot_knots,
_plot_chi,
)
from est.gui.larch.autobk import _AutobkParameters
from orangecontrib.est.progress import QProgress
from orangecontrib.est.utils import Converter
......@@ -59,7 +64,9 @@ class AutobkWindow(qt.QMainWindow):
# xas object viewer
mapKeys = ["mu", "bkg", "chie", "k", "chi", "e0"]
self.xasObjViewer = XasObjectViewer(mapKeys=mapKeys)
self.xasObjViewer = XasObjectViewer(
mapKeys=mapKeys, spectrumPlots=("background", "chi(k)")
)
self.xasObjViewer._spectrumViews[0]._plotWidget.getXAxis().setLabel(
"Energy (eV)"
)
......@@ -78,15 +85,25 @@ class AutobkWindow(qt.QMainWindow):
dockWidget.setAllowedAreas(qt.Qt.RightDockWidgetArea | qt.Qt.LeftDockWidgetArea)
dockWidget.setFeatures(qt.QDockWidget.NoDockWidgetFeatures)
# legend selector
self.legendDockWidget = LegendSelector.LegendsDockWidget(
# bkg legend selector
self.bkgLegendDockWidget = LegendSelector.LegendsDockWidget(
parent=self, plot=self.xasObjViewer._spectrumViews[0]._plotWidget
)
self.legendDockWidget.setAllowedAreas(
self.bkgLegendDockWidget.setAllowedAreas(
qt.Qt.RightDockWidgetArea | qt.Qt.LeftDockWidgetArea
)
self.bkgLegendDockWidget.setFeatures(qt.QDockWidget.NoDockWidgetFeatures)
self.addDockWidget(qt.Qt.RightDockWidgetArea, self.bkgLegendDockWidget)
# chi legend selector
self._chiLegendDockWidget = LegendSelector.LegendsDockWidget(
parent=self, plot=self.xasObjViewer._spectrumViews[1]._plotWidget
)
self._chiLegendDockWidget.setAllowedAreas(
qt.Qt.RightDockWidgetArea | qt.Qt.LeftDockWidgetArea
)
self.legendDockWidget.setFeatures(qt.QDockWidget.NoDockWidgetFeatures)
self.addDockWidget(qt.Qt.RightDockWidgetArea, self.legendDockWidget)
self._chiLegendDockWidget.setFeatures(qt.QDockWidget.NoDockWidgetFeatures)
self.addDockWidget(qt.Qt.RightDockWidgetArea, self._chiLegendDockWidget)
# volume key selection
self.addDockWidget(
......@@ -97,6 +114,8 @@ class AutobkWindow(qt.QMainWindow):
for ope in (_plot_bkg, _plot_spectrum, _plot_knots):
self.xasObjViewer._spectrumViews[0].addCurveOperation(ope)
self.xasObjViewer._spectrumViews[1].addCurveOperation(_plot_chi)
self.setWindowFlags(qt.Qt.Widget)
# connect signal / slot
......@@ -110,7 +129,12 @@ class AutobkWindow(qt.QMainWindow):
def _updateLegendView(self):
index, viewType = self.xasObjViewer.getViewType()
self.legendDockWidget.setVisible(viewType is ViewType.spectrum)
self.bkgLegendDockWidget.setVisible(
viewType is ViewType.spectrum and index == 0
)
self._chiLegendDockWidget.setVisible(
viewType is ViewType.spectrum and index == 1
)
self.xasObjViewer._mapView.keySelectionDocker.setVisible(
viewType is ViewType.map
)
......
......@@ -44,7 +44,6 @@ from est.core.types import XASObject
from est.gui.XasObjectViewer import (
XasObjectViewer,
ViewType,
_plot_chi,
_plot_chir_mag,
_plot_chir_re,
_plot_chir_imag,
......@@ -82,12 +81,10 @@ class XFTFWindow(qt.QMainWindow):
qt.QMainWindow.__init__(self, parent)
# xas object viewer
mapKeys = ["mu", "chir", "chir_mag", "chir_re", "chir_im", "chir_pha", "chi"]
self.xasObjViewer = XasObjectViewer(
mapKeys=mapKeys, spectrumPlots=("chi(k)", "FT")
)
self.xasObjViewer._spectrumViews[1]._plotWidget.getXAxis().setLabel(
"Energy (eV)"
mapKeys = ["mu", "chir", "chir_mag", "chir_re", "chir_im", "chir_pha"]
self.xasObjViewer = XasObjectViewer(mapKeys=mapKeys)
self.xasObjViewer._spectrumViews[0]._plotWidget.getXAxis().setLabel(
"Radial distance (angstrom)"
)
self.setCentralWidget(self.xasObjViewer)
self._parametersWindow = _ParameterWindowContainer(
......@@ -101,19 +98,9 @@ class XFTFWindow(qt.QMainWindow):
dockWidget.setAllowedAreas(qt.Qt.RightDockWidgetArea | qt.Qt.LeftDockWidgetArea)
dockWidget.setFeatures(qt.QDockWidget.NoDockWidgetFeatures)
# chi legend selector
self._chiLegendDockWidget = LegendSelector.LegendsDockWidget(
parent=self, plot=self.xasObjViewer._spectrumViews[0]._plotWidget
)
self._chiLegendDockWidget.setAllowedAreas(
qt.Qt.RightDockWidgetArea | qt.Qt.LeftDockWidgetArea
)
self._chiLegendDockWidget.setFeatures(qt.QDockWidget.NoDockWidgetFeatures)
self.addDockWidget(qt.Qt.RightDockWidgetArea, self._chiLegendDockWidget)
# FT legend selector
self._ftLegendDockWidget = LegendSelector.LegendsDockWidget(
parent=self, plot=self.xasObjViewer._spectrumViews[1]._plotWidget
parent=self, plot=self.xasObjViewer._spectrumViews[0]._plotWidget
)
self._ftLegendDockWidget.setAllowedAreas(
qt.Qt.RightDockWidgetArea | qt.Qt.LeftDockWidgetArea
......@@ -128,9 +115,7 @@ class XFTFWindow(qt.QMainWindow):
# plot settings
for ope in (_plot_chir_mag, _plot_chir_re, _plot_chir_imag):
self.xasObjViewer._spectrumViews[1].addCurveOperation(ope)
self.xasObjViewer._spectrumViews[0].addCurveOperation(_plot_chi)
self.xasObjViewer._spectrumViews[0].addCurveOperation(ope)
self.setWindowFlags(qt.Qt.Widget)
......@@ -143,9 +128,6 @@ class XFTFWindow(qt.QMainWindow):
def _updateLegendView(self):
index, viewType = self.xasObjViewer.getViewType()
self._ftLegendDockWidget.setVisible(
viewType is ViewType.spectrum and index == 1
)
self._chiLegendDockWidget.setVisible(
viewType is ViewType.spectrum and index == 0
)
self.xasObjViewer._mapView.keySelectionDocker.setVisible(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment