forked from IPKM/nmreval
plot fit and residual together with bigger fit
This commit is contained in:
parent
49101565a3
commit
67d60949b5
@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
|||||||
class Ui_Dialog(object):
|
class Ui_Dialog(object):
|
||||||
def setupUi(self, Dialog):
|
def setupUi(self, Dialog):
|
||||||
Dialog.setObjectName("Dialog")
|
Dialog.setObjectName("Dialog")
|
||||||
Dialog.resize(864, 712)
|
Dialog.resize(969, 974)
|
||||||
self.gridLayout = QtWidgets.QGridLayout(Dialog)
|
self.gridLayout = QtWidgets.QGridLayout(Dialog)
|
||||||
self.gridLayout.setObjectName("gridLayout")
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
@ -153,18 +153,10 @@ class Ui_Dialog(object):
|
|||||||
self.logx_box.setLayoutDirection(QtCore.Qt.RightToLeft)
|
self.logx_box.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||||
self.logx_box.setObjectName("logx_box")
|
self.logx_box.setObjectName("logx_box")
|
||||||
self.gridLayout_3.addWidget(self.logx_box, 2, 0, 1, 1)
|
self.gridLayout_3.addWidget(self.logx_box, 2, 0, 1, 1)
|
||||||
self.fit_plot = PlotWidget(self.stackPage1)
|
self.graphicsView = GraphicsLayoutWidget(self.stackPage1)
|
||||||
self.fit_plot.setObjectName("fit_plot")
|
self.graphicsView.setObjectName("graphicsView")
|
||||||
self.gridLayout_3.addWidget(self.fit_plot, 0, 0, 1, 2)
|
self.gridLayout_3.addWidget(self.graphicsView, 0, 0, 1, 2)
|
||||||
self.stack.addTab(self.stackPage1, "")
|
self.stack.addTab(self.stackPage1, "")
|
||||||
self.tab = QtWidgets.QWidget()
|
|
||||||
self.tab.setObjectName("tab")
|
|
||||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.tab)
|
|
||||||
self.verticalLayout.setObjectName("verticalLayout")
|
|
||||||
self.resid_plot = PlotWidget(self.tab)
|
|
||||||
self.resid_plot.setObjectName("resid_plot")
|
|
||||||
self.verticalLayout.addWidget(self.resid_plot)
|
|
||||||
self.stack.addTab(self.tab, "")
|
|
||||||
self.stackPage2 = QtWidgets.QWidget()
|
self.stackPage2 = QtWidgets.QWidget()
|
||||||
self.stackPage2.setObjectName("stackPage2")
|
self.stackPage2.setObjectName("stackPage2")
|
||||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.stackPage2)
|
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.stackPage2)
|
||||||
@ -232,7 +224,6 @@ class Ui_Dialog(object):
|
|||||||
self.logy_box.setText(_translate("Dialog", "logarithmic y axis"))
|
self.logy_box.setText(_translate("Dialog", "logarithmic y axis"))
|
||||||
self.logx_box.setText(_translate("Dialog", "logarithmic x axis"))
|
self.logx_box.setText(_translate("Dialog", "logarithmic x axis"))
|
||||||
self.stack.setTabText(self.stack.indexOf(self.stackPage1), _translate("Dialog", "Plot"))
|
self.stack.setTabText(self.stack.indexOf(self.stackPage1), _translate("Dialog", "Plot"))
|
||||||
self.stack.setTabText(self.stack.indexOf(self.tab), _translate("Dialog", "Residuals"))
|
|
||||||
self.stack.setTabText(self.stack.indexOf(self.stackPage2), _translate("Dialog", "Statistics"))
|
self.stack.setTabText(self.stack.indexOf(self.stackPage2), _translate("Dialog", "Statistics"))
|
||||||
item = self.corr_tableWidget.horizontalHeaderItem(0)
|
item = self.corr_tableWidget.horizontalHeaderItem(0)
|
||||||
item.setText(_translate("Dialog", "Parameter 1"))
|
item.setText(_translate("Dialog", "Parameter 1"))
|
||||||
@ -244,4 +235,4 @@ class Ui_Dialog(object):
|
|||||||
item.setText(_translate("Dialog", "Partial Corr."))
|
item.setText(_translate("Dialog", "Partial Corr."))
|
||||||
self.stack.setTabText(self.stack.indexOf(self.stackPage3), _translate("Dialog", "Correlations"))
|
self.stack.setTabText(self.stack.indexOf(self.stackPage3), _translate("Dialog", "Correlations"))
|
||||||
from ..lib.forms import ElideComboBox
|
from ..lib.forms import ElideComboBox
|
||||||
from pyqtgraph import PlotWidget
|
from pyqtgraph import GraphicsLayoutWidget
|
||||||
|
@ -33,6 +33,12 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
self.graph_opts = {}
|
self.graph_opts = {}
|
||||||
self.last_idx = None
|
self.last_idx = None
|
||||||
|
|
||||||
|
self.resid_plot = self.graphicsView.addPlot(row=0, col=0, title='Residual')
|
||||||
|
self.fit_plot = self.graphicsView.addPlot(row=1, col=0, title='Fit')
|
||||||
|
|
||||||
|
self.graphicsView.ci.layout.setRowStretchFactor(0, 1)
|
||||||
|
self.graphicsView.ci.layout.setRowStretchFactor(1, 2)
|
||||||
|
|
||||||
self.resid_graph = PlotItem(x=[], y=[],
|
self.resid_graph = PlotItem(x=[], y=[],
|
||||||
symbol='o', symbolPen=None, symbolBrush=mkBrush(color=(31, 119, 180)),
|
symbol='o', symbolPen=None, symbolBrush=mkBrush(color=(31, 119, 180)),
|
||||||
pen=None)
|
pen=None)
|
||||||
@ -41,7 +47,6 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
pen=None)
|
pen=None)
|
||||||
self.resid_plot.addItem(self.resid_graph)
|
self.resid_plot.addItem(self.resid_graph)
|
||||||
self.resid_plot.addItem(self.resid_graph_imag)
|
self.resid_plot.addItem(self.resid_graph_imag)
|
||||||
self.resid_plot.setLabel('left', 'Residual')
|
|
||||||
|
|
||||||
self.data_graph = PlotItem(x=[], y=[],
|
self.data_graph = PlotItem(x=[], y=[],
|
||||||
symbol='o', symbolPen=None, symbolBrush=mkBrush(color=(31, 119, 180)),
|
symbol='o', symbolPen=None, symbolBrush=mkBrush(color=(31, 119, 180)),
|
||||||
@ -51,7 +56,6 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
pen=None)
|
pen=None)
|
||||||
self.fit_plot.addItem(self.data_graph)
|
self.fit_plot.addItem(self.data_graph)
|
||||||
self.fit_plot.addItem(self.data_graph_imag)
|
self.fit_plot.addItem(self.data_graph_imag)
|
||||||
self.fit_plot.setLabel('left', 'Function')
|
|
||||||
|
|
||||||
self.fit_graph = PlotItem(x=[], y=[])
|
self.fit_graph = PlotItem(x=[], y=[])
|
||||||
self.fit_graph_imag = PlotItem(x=[], y=[])
|
self.fit_graph_imag = PlotItem(x=[], y=[])
|
||||||
@ -159,7 +163,7 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
iscomplex = res.iscomplex
|
iscomplex = res.iscomplex
|
||||||
|
|
||||||
sub_funcs = res.sub(res.x)
|
sub_funcs = res.sub(res.x)
|
||||||
for item in self.fit_plot.plotItem.items[::-1]:
|
for item in self.fit_plot.items[::-1]:
|
||||||
if item not in [self.data_graph, self.data_graph_imag, self.fit_graph, self.fit_graph_imag]:
|
if item not in [self.data_graph, self.data_graph_imag, self.fit_graph, self.fit_graph_imag]:
|
||||||
self.fit_plot.removeItem(item)
|
self.fit_plot.removeItem(item)
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>864</width>
|
<width>969</width>
|
||||||
<height>712</height>
|
<height>974</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -307,17 +307,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="PlotWidget" name="fit_plot"/>
|
<widget class="GraphicsLayoutWidget" name="graphicsView"/>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Residuals</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="PlotWidget" name="resid_plot"/>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -435,7 +425,7 @@
|
|||||||
<header>..lib.forms</header>
|
<header>..lib.forms</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>PlotWidget</class>
|
<class>GraphicsLayoutWidget</class>
|
||||||
<extends>QGraphicsView</extends>
|
<extends>QGraphicsView</extends>
|
||||||
<header>pyqtgraph</header>
|
<header>pyqtgraph</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
Loading…
Reference in New Issue
Block a user