1
0
forked from IPKM/nmreval

add hodge fit

This commit is contained in:
Dominik Demuth 2023-06-27 18:23:41 +02:00
parent 8a96e0472d
commit 1d9bf600ba
4 changed files with 255 additions and 185 deletions

View File

@ -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(1041, 773) Dialog.resize(1094, 829)
self.gridLayout = QtWidgets.QGridLayout(Dialog) self.gridLayout = QtWidgets.QGridLayout(Dialog)
self.gridLayout.setObjectName("gridLayout") self.gridLayout.setObjectName("gridLayout")
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
@ -61,27 +61,30 @@ class Ui_Dialog(object):
self.dsc_plot.setSizePolicy(sizePolicy) self.dsc_plot.setSizePolicy(sizePolicy)
self.dsc_plot.setObjectName("dsc_plot") self.dsc_plot.setObjectName("dsc_plot")
self.gridLayout.addWidget(self.dsc_plot, 0, 1, 1, 1) self.gridLayout.addWidget(self.dsc_plot, 0, 1, 1, 1)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.verticalLayout_2.setObjectName("verticalLayout_2")
self.calctg_button = QtWidgets.QPushButton(Dialog) self.calctg_button = QtWidgets.QToolButton(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.calctg_button.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.calctg_button.sizePolicy().hasHeightForWidth())
self.calctg_button.setSizePolicy(sizePolicy) self.calctg_button.setSizePolicy(sizePolicy)
self.calctg_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self.calctg_button.setArrowType(QtCore.Qt.RightArrow)
self.calctg_button.setObjectName("calctg_button") self.calctg_button.setObjectName("calctg_button")
self.horizontalLayout_2.addWidget(self.calctg_button) self.verticalLayout_2.addWidget(self.calctg_button)
self.pushButton_2 = QtWidgets.QPushButton(Dialog) self.toolButton_2 = QtWidgets.QToolButton(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.pushButton_2.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.toolButton_2.sizePolicy().hasHeightForWidth())
self.pushButton_2.setSizePolicy(sizePolicy) self.toolButton_2.setSizePolicy(sizePolicy)
self.pushButton_2.setObjectName("pushButton_2") self.toolButton_2.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self.horizontalLayout_2.addWidget(self.pushButton_2) self.toolButton_2.setAutoRaise(False)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.toolButton_2.setArrowType(QtCore.Qt.RightArrow)
self.horizontalLayout_2.addItem(spacerItem) self.toolButton_2.setObjectName("toolButton_2")
self.gridLayout.addLayout(self.horizontalLayout_2, 2, 1, 1, 1) self.verticalLayout_2.addWidget(self.toolButton_2)
self.gridLayout.addLayout(self.verticalLayout_2, 0, 2, 1, 1)
self.tabWidget = QtWidgets.QTabWidget(Dialog) self.tabWidget = QtWidgets.QTabWidget(Dialog)
self.tabWidget.setTabPosition(QtWidgets.QTabWidget.East) self.tabWidget.setTabPosition(QtWidgets.QTabWidget.East)
self.tabWidget.setObjectName("tabWidget") self.tabWidget.setObjectName("tabWidget")
@ -89,37 +92,57 @@ class Ui_Dialog(object):
self.tabWidgetPage1.setObjectName("tabWidgetPage1") self.tabWidgetPage1.setObjectName("tabWidgetPage1")
self.gridLayout_3 = QtWidgets.QGridLayout(self.tabWidgetPage1) self.gridLayout_3 = QtWidgets.QGridLayout(self.tabWidgetPage1)
self.gridLayout_3.setObjectName("gridLayout_3") self.gridLayout_3.setObjectName("gridLayout_3")
self.tg_export_check = QtWidgets.QCheckBox(self.tabWidgetPage1)
self.tg_export_check.setChecked(True)
self.tg_export_check.setObjectName("tg_export_check")
self.gridLayout_3.addWidget(self.tg_export_check, 2, 1, 1, 1)
self.tglines_export_check = QtWidgets.QCheckBox(self.tabWidgetPage1) self.tglines_export_check = QtWidgets.QCheckBox(self.tabWidgetPage1)
self.tglines_export_check.setChecked(True) self.tglines_export_check.setChecked(True)
self.tglines_export_check.setObjectName("tglines_export_check") self.tglines_export_check.setObjectName("tglines_export_check")
self.gridLayout_3.addWidget(self.tglines_export_check, 2, 2, 1, 1) self.gridLayout_3.addWidget(self.tglines_export_check, 2, 3, 1, 1)
self.label_6 = QtWidgets.QLabel(self.tabWidgetPage1) self.checkBox_6 = QtWidgets.QCheckBox(self.tabWidgetPage1)
self.label_6.setObjectName("label_6") self.checkBox_6.setChecked(True)
self.gridLayout_3.addWidget(self.label_6, 4, 1, 1, 1) self.checkBox_6.setObjectName("checkBox_6")
self.gridLayout_3.addWidget(self.checkBox_6, 6, 3, 1, 1)
self.new_graph_tau_combo = QtWidgets.QComboBox(self.tabWidgetPage1) self.new_graph_tau_combo = QtWidgets.QComboBox(self.tabWidgetPage1)
self.new_graph_tau_combo.setObjectName("new_graph_tau_combo") self.new_graph_tau_combo.setObjectName("new_graph_tau_combo")
self.gridLayout_3.addWidget(self.new_graph_tau_combo, 5, 2, 1, 1) self.gridLayout_3.addWidget(self.new_graph_tau_combo, 8, 3, 1, 1)
self.new_graph_tau_check = QtWidgets.QCheckBox(self.tabWidgetPage1)
self.new_graph_tau_check.setChecked(True)
self.new_graph_tau_check.setObjectName("new_graph_tau_check")
self.gridLayout_3.addWidget(self.new_graph_tau_check, 5, 1, 1, 1)
self.line = QtWidgets.QFrame(self.tabWidgetPage1) self.line = QtWidgets.QFrame(self.tabWidgetPage1)
self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShape(QtWidgets.QFrame.HLine)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setObjectName("line") self.line.setObjectName("line")
self.gridLayout_3.addWidget(self.line, 3, 1, 1, 2) self.gridLayout_3.addWidget(self.line, 3, 2, 1, 2)
self.hodge_selection = CheckCombobox(self.tabWidgetPage1) self.checkBox = QtWidgets.QCheckBox(self.tabWidgetPage1)
self.hodge_selection.setObjectName("hodge_selection") self.checkBox.setChecked(True)
self.hodge_selection.addItem("") self.checkBox.setObjectName("checkBox")
self.hodge_selection.addItem("") self.gridLayout_3.addWidget(self.checkBox, 5, 2, 1, 1)
self.hodge_selection.addItem("") self.tg_export_check = QtWidgets.QCheckBox(self.tabWidgetPage1)
self.hodge_selection.addItem("") self.tg_export_check.setChecked(True)
self.hodge_selection.addItem("") self.tg_export_check.setObjectName("tg_export_check")
self.gridLayout_3.addWidget(self.hodge_selection, 4, 2, 1, 1) self.gridLayout_3.addWidget(self.tg_export_check, 2, 2, 1, 1)
self.new_graph_tau_check = QtWidgets.QCheckBox(self.tabWidgetPage1)
self.new_graph_tau_check.setChecked(True)
self.new_graph_tau_check.setObjectName("new_graph_tau_check")
self.gridLayout_3.addWidget(self.new_graph_tau_check, 8, 2, 1, 1)
self.checkBox_5 = QtWidgets.QCheckBox(self.tabWidgetPage1)
self.checkBox_5.setChecked(True)
self.checkBox_5.setObjectName("checkBox_5")
self.gridLayout_3.addWidget(self.checkBox_5, 6, 2, 1, 1)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_3.addItem(spacerItem, 10, 3, 1, 1)
self.label_6 = QtWidgets.QLabel(self.tabWidgetPage1)
self.label_6.setObjectName("label_6")
self.gridLayout_3.addWidget(self.label_6, 4, 2, 1, 2)
self.checkBox_4 = QtWidgets.QCheckBox(self.tabWidgetPage1)
self.checkBox_4.setChecked(True)
self.checkBox_4.setObjectName("checkBox_4")
self.gridLayout_3.addWidget(self.checkBox_4, 5, 3, 1, 1)
self.checkBox_7 = QtWidgets.QCheckBox(self.tabWidgetPage1)
self.checkBox_7.setChecked(True)
self.checkBox_7.setObjectName("checkBox_7")
self.gridLayout_3.addWidget(self.checkBox_7, 7, 2, 1, 1)
self.pushButton_4 = QtWidgets.QPushButton(self.tabWidgetPage1)
self.pushButton_4.setObjectName("pushButton_4")
self.gridLayout_3.addWidget(self.pushButton_4, 9, 2, 1, 2)
self.tghodge_graph = PlotWidget(self.tabWidgetPage1)
self.tghodge_graph.setObjectName("tghodge_graph")
self.gridLayout_3.addWidget(self.tghodge_graph, 2, 1, 9, 1)
self.tau_plot = PlotWidget(self.tabWidgetPage1) self.tau_plot = PlotWidget(self.tabWidgetPage1)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
@ -127,44 +150,39 @@ class Ui_Dialog(object):
sizePolicy.setHeightForWidth(self.tau_plot.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.tau_plot.sizePolicy().hasHeightForWidth())
self.tau_plot.setSizePolicy(sizePolicy) self.tau_plot.setSizePolicy(sizePolicy)
self.tau_plot.setObjectName("tau_plot") self.tau_plot.setObjectName("tau_plot")
self.gridLayout_3.addWidget(self.tau_plot, 0, 0, 8, 1) self.gridLayout_3.addWidget(self.tau_plot, 2, 0, 9, 1)
spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_3.addItem(spacerItem1, 7, 2, 1, 1)
self.pushButton_4 = QtWidgets.QPushButton(self.tabWidgetPage1)
self.pushButton_4.setObjectName("pushButton_4")
self.gridLayout_3.addWidget(self.pushButton_4, 6, 1, 1, 2)
self.tabWidget.addTab(self.tabWidgetPage1, "") self.tabWidget.addTab(self.tabWidgetPage1, "")
self.tabWidgetPage2 = QtWidgets.QWidget() self.tabWidgetPage2 = QtWidgets.QWidget()
self.tabWidgetPage2.setObjectName("tabWidgetPage2") self.tabWidgetPage2.setObjectName("tabWidgetPage2")
self.gridLayout_2 = QtWidgets.QGridLayout(self.tabWidgetPage2) self.gridLayout_2 = QtWidgets.QGridLayout(self.tabWidgetPage2)
self.gridLayout_2.setObjectName("gridLayout_2") self.gridLayout_2.setObjectName("gridLayout_2")
self.pushButton_3 = QtWidgets.QPushButton(self.tabWidgetPage2) self.fit_tnhm_fitbutton = QtWidgets.QPushButton(self.tabWidgetPage2)
self.pushButton_3.setObjectName("pushButton_3") self.fit_tnhm_fitbutton.setObjectName("fit_tnhm_fitbutton")
self.gridLayout_2.addWidget(self.pushButton_3, 1, 1, 1, 2) self.gridLayout_2.addWidget(self.fit_tnhm_fitbutton, 1, 1, 1, 2)
self.graphicsView_2 = PlotWidget(self.tabWidgetPage2) self.graphicsView_2 = PlotWidget(self.tabWidgetPage2)
self.graphicsView_2.setObjectName("graphicsView_2") self.graphicsView_2.setObjectName("graphicsView_2")
self.gridLayout_2.addWidget(self.graphicsView_2, 0, 0, 9, 1) self.gridLayout_2.addWidget(self.graphicsView_2, 0, 0, 9, 1)
self.checkBox = QtWidgets.QCheckBox(self.tabWidgetPage2) self.new_graph_tnmh_check = QtWidgets.QCheckBox(self.tabWidgetPage2)
self.checkBox.setChecked(True) self.new_graph_tnmh_check.setChecked(True)
self.checkBox.setObjectName("checkBox") self.new_graph_tnmh_check.setObjectName("new_graph_tnmh_check")
self.gridLayout_2.addWidget(self.checkBox, 5, 1, 1, 1) self.gridLayout_2.addWidget(self.new_graph_tnmh_check, 5, 1, 1, 1)
self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout") self.horizontalLayout.setObjectName("horizontalLayout")
self.label_2 = QtWidgets.QLabel(self.tabWidgetPage2) self.label_2 = QtWidgets.QLabel(self.tabWidgetPage2)
self.label_2.setObjectName("label_2") self.label_2.setObjectName("label_2")
self.horizontalLayout.addWidget(self.label_2) self.horizontalLayout.addWidget(self.label_2)
self.comboBox = QtWidgets.QComboBox(self.tabWidgetPage2) self.tnmh_tg_combo = QtWidgets.QComboBox(self.tabWidgetPage2)
self.comboBox.setObjectName("comboBox") self.tnmh_tg_combo.setObjectName("tnmh_tg_combo")
self.comboBox.addItem("") self.tnmh_tg_combo.addItem("")
self.comboBox.addItem("") self.tnmh_tg_combo.addItem("")
self.comboBox.addItem("") self.tnmh_tg_combo.addItem("")
self.comboBox.addItem("") self.tnmh_tg_combo.addItem("")
self.comboBox.addItem("") self.tnmh_tg_combo.addItem("")
self.horizontalLayout.addWidget(self.comboBox) self.horizontalLayout.addWidget(self.tnmh_tg_combo)
self.gridLayout_2.addLayout(self.horizontalLayout, 0, 1, 1, 2) self.gridLayout_2.addLayout(self.horizontalLayout, 0, 1, 1, 2)
self.comboBox_2 = QtWidgets.QComboBox(self.tabWidgetPage2) self.new_graph_tnmh_combo = QtWidgets.QComboBox(self.tabWidgetPage2)
self.comboBox_2.setObjectName("comboBox_2") self.new_graph_tnmh_combo.setObjectName("new_graph_tnmh_combo")
self.gridLayout_2.addWidget(self.comboBox_2, 5, 2, 1, 1) self.gridLayout_2.addWidget(self.new_graph_tnmh_combo, 5, 2, 1, 1)
self.line_2 = QtWidgets.QFrame(self.tabWidgetPage2) self.line_2 = QtWidgets.QFrame(self.tabWidgetPage2)
self.line_2.setMinimumSize(QtCore.QSize(0, 0)) self.line_2.setMinimumSize(QtCore.QSize(0, 0))
self.line_2.setFrameShape(QtWidgets.QFrame.HLine) self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
@ -177,13 +195,13 @@ class Ui_Dialog(object):
self.checkBox_3 = QtWidgets.QCheckBox(self.tabWidgetPage2) self.checkBox_3 = QtWidgets.QCheckBox(self.tabWidgetPage2)
self.checkBox_3.setObjectName("checkBox_3") self.checkBox_3.setObjectName("checkBox_3")
self.gridLayout_2.addWidget(self.checkBox_3, 4, 1, 1, 2) self.gridLayout_2.addWidget(self.checkBox_3, 4, 1, 1, 2)
spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_2.addItem(spacerItem2, 8, 1, 1, 1) self.gridLayout_2.addItem(spacerItem1, 8, 1, 1, 1)
self.pushButton = QtWidgets.QPushButton(self.tabWidgetPage2) self.pushButton = QtWidgets.QPushButton(self.tabWidgetPage2)
self.pushButton.setObjectName("pushButton") self.pushButton.setObjectName("pushButton")
self.gridLayout_2.addWidget(self.pushButton, 7, 1, 1, 2) self.gridLayout_2.addWidget(self.pushButton, 7, 1, 1, 2)
self.tabWidget.addTab(self.tabWidgetPage2, "") self.tabWidget.addTab(self.tabWidgetPage2, "")
self.gridLayout.addWidget(self.tabWidget, 4, 1, 1, 1) self.gridLayout.addWidget(self.tabWidget, 4, 1, 1, 2)
self.retranslateUi(Dialog) self.retranslateUi(Dialog)
self.tabWidget.setCurrentIndex(0) self.tabWidget.setCurrentIndex(0)
@ -197,29 +215,28 @@ class Ui_Dialog(object):
self.label.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">Tg values:</span></p></body></html>")) self.label.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">Tg values:</span></p></body></html>"))
self.label_4.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">TNMH parameter:</span></p></body></html>")) self.label_4.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">TNMH parameter:</span></p></body></html>"))
self.calctg_button.setText(_translate("Dialog", "Calculate Tg")) self.calctg_button.setText(_translate("Dialog", "Calculate Tg"))
self.pushButton_2.setText(_translate("Dialog", "Calculate fictive Cp")) self.toolButton_2.setText(_translate("Dialog", "Calculate fictive Cp"))
self.tg_export_check.setText(_translate("Dialog", "Export Tg"))
self.tglines_export_check.setText(_translate("Dialog", "Export lines")) self.tglines_export_check.setText(_translate("Dialog", "Export lines"))
self.label_6.setText(_translate("Dialog", "Export Hodge:")) self.checkBox_6.setText(_translate("Dialog", "End"))
self.checkBox.setText(_translate("Dialog", "Onset"))
self.tg_export_check.setText(_translate("Dialog", "Export Tg"))
self.new_graph_tau_check.setText(_translate("Dialog", "New graph")) self.new_graph_tau_check.setText(_translate("Dialog", "New graph"))
self.hodge_selection.setItemText(0, _translate("Dialog", "Onset")) self.checkBox_5.setText(_translate("Dialog", "Inflection"))
self.hodge_selection.setItemText(1, _translate("Dialog", "Midpoint")) self.label_6.setText(_translate("Dialog", "Export Hodge:"))
self.hodge_selection.setItemText(2, _translate("Dialog", "End")) self.checkBox_4.setText(_translate("Dialog", "Midpoint"))
self.hodge_selection.setItemText(3, _translate("Dialog", "Inflection")) self.checkBox_7.setText(_translate("Dialog", "Fictive"))
self.hodge_selection.setItemText(4, _translate("Dialog", "Fictive")) self.pushButton_4.setText(_translate("Dialog", "Export"))
self.pushButton_4.setText(_translate("Dialog", "Save"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage1), _translate("Dialog", "Tg / Hodge")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage1), _translate("Dialog", "Tg / Hodge"))
self.pushButton_3.setText(_translate("Dialog", "Fit TNMH model")) self.fit_tnhm_fitbutton.setText(_translate("Dialog", "Fit TNMH model"))
self.checkBox.setText(_translate("Dialog", "New graph")) self.new_graph_tnmh_check.setText(_translate("Dialog", "New graph"))
self.label_2.setText(_translate("Dialog", "Tg for TNMH")) self.label_2.setText(_translate("Dialog", "Tg for TNMH"))
self.comboBox.setItemText(0, _translate("Dialog", "Fictive")) self.tnmh_tg_combo.setItemText(0, _translate("Dialog", "Fictive"))
self.comboBox.setItemText(1, _translate("Dialog", "Onset")) self.tnmh_tg_combo.setItemText(1, _translate("Dialog", "Onset"))
self.comboBox.setItemText(2, _translate("Dialog", "Midpoint")) self.tnmh_tg_combo.setItemText(2, _translate("Dialog", "Midpoint"))
self.comboBox.setItemText(3, _translate("Dialog", "End")) self.tnmh_tg_combo.setItemText(3, _translate("Dialog", "End"))
self.comboBox.setItemText(4, _translate("Dialog", "Inflection")) self.tnmh_tg_combo.setItemText(4, _translate("Dialog", "Inflection"))
self.checkBox_2.setText(_translate("Dialog", "Export dTf / dT")) self.checkBox_2.setText(_translate("Dialog", "Export dTf / dT"))
self.checkBox_3.setText(_translate("Dialog", "Export fit")) self.checkBox_3.setText(_translate("Dialog", "Export fit"))
self.pushButton.setText(_translate("Dialog", "Save")) self.pushButton.setText(_translate("Dialog", "Export"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage2), _translate("Dialog", "TNMH")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage2), _translate("Dialog", "TNMH"))
from ..lib.forms import CheckCombobox
from pyqtgraph import PlotWidget from pyqtgraph import PlotWidget

View File

@ -27,19 +27,46 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
self._plots = {} self._plots = {}
self._tg_value = {} self._tg_value = {}
self._fit = {} self._fit = {}
self._lines = {}
self._hodge = { self._hodge = {
'onset': (PlotItem(x=[], y=[], pen=None, symbol='o', symbolBrush=Tab10.TabBlue.rgb(), name='Onset'), None), 'onset': (
'midpoint': (PlotItem(x=[], y=[], pen=None, symbol='s', symbolBrush=Tab10.TabOrange.rgb(), name='Midpoint'), None), PlotItem(x=[], y=[], pen=None, symbol='o', symbolBrush=Tab10.TabBlue.rgb(), name='Onset'),
'end': (PlotItem(x=[], y=[], pen=None, symbol='t', symbolBrush=Tab10.TabGreen.rgb(), name='End'), None), None,
'inflection': (PlotItem(x=[], y=[], pen=None, symbol='d', symbolBrush=Tab10.TabRed.rgb(), name='Inflection'), None), (PlotItem(x=[], y=[], pen=mkPen({'color': Tab10.TabBlue.rgb()})),
PlotItem(x=[], y=[], pen=None, symbol='o', symbolBrush=Tab10.TabBlue.rgb())),
None,
),
'midpoint': (
PlotItem(x=[], y=[], pen=None, symbol='s', symbolBrush=Tab10.TabOrange.rgb(), name='Midpoint'),
None,
(PlotItem(x=[], y=[], pen=mkPen({'color': Tab10.TabOrange.rgb()})),
PlotItem(x=[], y=[], pen=None, symbol='s', symbolBrush=Tab10.TabOrange.rgb())),
None,
),
'end': (
PlotItem(x=[], y=[], pen=None, symbol='t', symbolBrush=Tab10.TabGreen.rgb(), name='End'),
None,
(PlotItem(x=[], y=[], pen=mkPen({'color': Tab10.TabGreen.rgb()})),
PlotItem(x=[], y=[], pen=None, symbol='t', symbolBrush=Tab10.TabGreen.rgb())),
None,
),
'inflection': (
PlotItem(x=[], y=[], pen=None, symbol='d', symbolBrush=Tab10.TabRed.rgb(), name='Inflection'),
None,
(PlotItem(x=[], y=[], pen=mkPen({'color': Tab10.TabRed.rgb()})),
PlotItem(x=[], y=[], pen=None, symbol='d', symbolBrush=Tab10.TabRed.rgb())),
None,
),
# 'fictive': PlotItem(x=[], y=[], pen=None, symbol='t1', symbolBrush=Tab10.TabPurple.rgb(), name='Fictive'), # 'fictive': PlotItem(x=[], y=[], pen=None, symbol='t1', symbolBrush=Tab10.TabPurple.rgb(), name='Fictive'),
# 'TNMH': PlotItem(x=[], y=[], pen=None, symbol='star', symbolBrush=Tab10.TabPurple.rgb(), name='TNMH'), # 'TNMH': PlotItem(x=[], y=[], pen=None, symbol='star', symbolBrush=Tab10.TabPurple.rgb(), name='TNMH'),
} }
self._lines = {}
self.tau_plot.getPlotItem().addLegend() self.tau_plot.getPlotItem().addLegend()
for plt, _ in self._hodge.values(): for plt, _, fitplt, _ in self._hodge.values():
self.tau_plot.addItem(plt) self.tau_plot.addItem(plt)
self.tghodge_graph.addItem(fitplt[0])
self.tghodge_graph.addItem(fitplt[1])
self.tau_plot.setLogMode(y=True) self.tau_plot.setLogMode(y=True)
self.tghodge_graph.setLogMode(y=True)
self.limits = RegionItem(), RegionItem() self.limits = RegionItem(), RegionItem()
for lim in self.limits: for lim in self.limits:
@ -69,7 +96,9 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
for key, plt in self._hodge.items(): for key, plt in self._hodge.items():
plt[0].setData(x=[], y=[]) plt[0].setData(x=[], y=[])
self._hodge[key] = (plt[0], None) plt[2][0].setData(x=[], y=[])
plt[2][1].setData(x=[], y=[])
self._hodge[key] = (plt[0], None, plt[2], None)
self._dsc = {} self._dsc = {}
self._plots = {} self._plots = {}
@ -242,7 +271,7 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
plot[-1].setData(res.x, res.y) plot[-1].setData(res.x, res.y)
def hodge(self): def hodge(self):
for tg_type, (plot, data) in self._hodge.items(): for tg_type, (plot, data, fitplots, fit) in self._hodge.items():
m = [] m = []
for idx in range(self.listWidget.count()): for idx in range(self.listWidget.count()):
@ -260,11 +289,13 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
m.append([tg_value, data.value]) m.append([tg_value, data.value])
if len(m) > 1: if len(m) > 1:
data = tau_hodge(*array(m).T) data, fit = tau_hodge(*array(m).T)
data.name = f'{data.name} ({tg_type.capitalize()})' data.name = f'{data.name} ({tg_type.capitalize()})'
plot.setData(data.x, data.y) plot.setData(data.x, data.y)
fitplots[0].setData(1000/fit.x, fit.y)
fitplots[1].setData(1000/fit.x_data, fit.y_data)
self._hodge[tg_type] = (plot, data) self._hodge[tg_type] = (plot, data, fitplots, fit)
def close(self) -> bool: def close(self) -> bool:
self.clear() self.clear()

View File

@ -3,12 +3,13 @@ from scipy.stats import linregress
from nmreval.data import Points from nmreval.data import Points
from nmreval.fit.minimizer import FitRoutine from nmreval.fit.minimizer import FitRoutine
from nmreval.fit.result import FitResult
from nmreval.lib.utils import ArrayLike from nmreval.lib.utils import ArrayLike
from nmreval.models import Arrhenius from nmreval.models import Arrhenius
from nmreval.utils import kB from nmreval.utils import kB
def tau_hodge(tg: ArrayLike, rate: ArrayLike) -> Points: def tau_hodge(tg: ArrayLike, rate: ArrayLike) -> (Points, FitResult):
rate = np.asanyarray(rate) / 60 rate = np.asanyarray(rate) / 60
tg = np.asanyarray(tg) tg = np.asanyarray(tg)
fitter = FitRoutine() fitter = FitRoutine()
@ -23,4 +24,4 @@ def tau_hodge(tg: ArrayLike, rate: ArrayLike) -> Points:
de = res.parameter['E_{A}'] de = res.parameter['E_{A}']
tau = kB*tg**2/np.abs(de.value)/rate tau = kB*tg**2/np.abs(de.value)/rate
return Points(x=1000/tg, y=tau, y_err=tau*de.error/np.abs(de.value), name='Hodge') return Points(x=1000/tg, y=tau, y_err=tau*de.error/np.abs(de.value), name='Hodge'), res

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1041</width> <width>1094</width>
<height>773</height> <height>829</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -85,12 +85,12 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QPushButton" name="calctg_button"> <widget class="QToolButton" name="calctg_button">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -98,12 +98,18 @@
<property name="text"> <property name="text">
<string>Calculate Tg</string> <string>Calculate Tg</string>
</property> </property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="arrowType">
<enum>Qt::RightArrow</enum>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButton_2"> <widget class="QToolButton" name="toolButton_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -111,47 +117,33 @@
<property name="text"> <property name="text">
<string>Calculate fictive Cp</string> <string>Calculate fictive Cp</string>
</property> </property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>false</bool>
</property>
<property name="arrowType">
<enum>Qt::RightArrow</enum>
</property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item row="4" column="1"> <item row="4" column="1" colspan="2">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="tabPosition"> <property name="tabPosition">
<enum>QTabWidget::East</enum> <enum>QTabWidget::East</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tabWidgetPage1"> <widget class="QWidget" name="tabWidgetPage1">
<attribute name="title"> <attribute name="title">
<string>Tg / Hodge</string> <string>Tg / Hodge</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="1"> <item row="2" column="3">
<widget class="QCheckBox" name="tg_export_check">
<property name="text">
<string>Export Tg</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="tglines_export_check"> <widget class="QCheckBox" name="tglines_export_check">
<property name="text"> <property name="text">
<string>Export lines</string> <string>Export lines</string>
@ -161,17 +153,47 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="6" column="3">
<widget class="QLabel" name="label_6"> <widget class="QCheckBox" name="checkBox_6">
<property name="text"> <property name="text">
<string>Export Hodge:</string> <string>End</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="3">
<widget class="QComboBox" name="new_graph_tau_combo"/>
</item>
<item row="3" column="2" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="2"> <item row="5" column="2">
<widget class="QComboBox" name="new_graph_tau_combo"/> <widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Onset</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item> </item>
<item row="5" column="1"> <item row="2" column="2">
<widget class="QCheckBox" name="tg_export_check">
<property name="text">
<string>Export Tg</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QCheckBox" name="new_graph_tau_check"> <widget class="QCheckBox" name="new_graph_tau_check">
<property name="text"> <property name="text">
<string>New graph</string> <string>New graph</string>
@ -181,53 +203,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1" colspan="2"> <item row="6" column="2">
<widget class="Line" name="line"> <widget class="QCheckBox" name="checkBox_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="CheckCombobox" name="hodge_selection">
<item>
<property name="text">
<string>Onset</string>
</property>
</item>
<item>
<property name="text">
<string>Midpoint</string>
</property>
</item>
<item>
<property name="text">
<string>End</string>
</property>
</item>
<item>
<property name="text"> <property name="text">
<string>Inflection</string> <string>Inflection</string>
</property> </property>
</item> <property name="checked">
<item> <bool>true</bool>
<property name="text">
<string>Fictive</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0" rowspan="8">
<widget class="PlotWidget" name="tau_plot">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="2"> <item row="10" column="3">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -240,10 +226,50 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="6" column="1" colspan="2"> <item row="4" column="2" colspan="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Export Hodge:</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QCheckBox" name="checkBox_4">
<property name="text">
<string>Midpoint</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QCheckBox" name="checkBox_7">
<property name="text">
<string>Fictive</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="2" colspan="2">
<widget class="QPushButton" name="pushButton_4"> <widget class="QPushButton" name="pushButton_4">
<property name="text"> <property name="text">
<string>Save</string> <string>Export</string>
</property>
</widget>
</item>
<item row="2" column="1" rowspan="9">
<widget class="PlotWidget" name="tghodge_graph"/>
</item>
<item row="2" column="0" rowspan="9">
<widget class="PlotWidget" name="tau_plot">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
</widget> </widget>
</item> </item>
@ -360,7 +386,7 @@
<item row="7" column="1" colspan="2"> <item row="7" column="1" colspan="2">
<widget class="QPushButton" name="pushButton"> <widget class="QPushButton" name="pushButton">
<property name="text"> <property name="text">
<string>Save</string> <string>Export</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -376,11 +402,6 @@
<extends>QGraphicsView</extends> <extends>QGraphicsView</extends>
<header>pyqtgraph</header> <header>pyqtgraph</header>
</customwidget> </customwidget>
<customwidget>
<class>CheckCombobox</class>
<extends>QComboBox</extends>
<header>..lib.forms</header>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections> <connections>