From 1d9bf600babf9b965aacc6973317c975ff36bbbc Mon Sep 17 00:00:00 2001
From: Dominik Demuth
Date: Tue, 27 Jun 2023 18:23:41 +0200
Subject: [PATCH] add hodge fit
---
src/gui_qt/_py/tnmh_dialog.py | 181 ++++++++++++++-------------
src/gui_qt/dsc/glass_dialog.py | 51 ++++++--
src/nmreval/dsc/hodge.py | 5 +-
src/resources/_ui/tnmh_dialog.ui | 203 +++++++++++++++++--------------
4 files changed, 255 insertions(+), 185 deletions(-)
diff --git a/src/gui_qt/_py/tnmh_dialog.py b/src/gui_qt/_py/tnmh_dialog.py
index a48664f..a9924e4 100644
--- a/src/gui_qt/_py/tnmh_dialog.py
+++ b/src/gui_qt/_py/tnmh_dialog.py
@@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
- Dialog.resize(1041, 773)
+ Dialog.resize(1094, 829)
self.gridLayout = QtWidgets.QGridLayout(Dialog)
self.gridLayout.setObjectName("gridLayout")
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
@@ -61,27 +61,30 @@ class Ui_Dialog(object):
self.dsc_plot.setSizePolicy(sizePolicy)
self.dsc_plot.setObjectName("dsc_plot")
self.gridLayout.addWidget(self.dsc_plot, 0, 1, 1, 1)
- self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_2.setObjectName("horizontalLayout_2")
- self.calctg_button = QtWidgets.QPushButton(Dialog)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
+ self.verticalLayout_2 = QtWidgets.QVBoxLayout()
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.calctg_button = QtWidgets.QToolButton(Dialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.calctg_button.sizePolicy().hasHeightForWidth())
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.horizontalLayout_2.addWidget(self.calctg_button)
- self.pushButton_2 = QtWidgets.QPushButton(Dialog)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
+ self.verticalLayout_2.addWidget(self.calctg_button)
+ self.toolButton_2 = QtWidgets.QToolButton(Dialog)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.pushButton_2.sizePolicy().hasHeightForWidth())
- self.pushButton_2.setSizePolicy(sizePolicy)
- self.pushButton_2.setObjectName("pushButton_2")
- self.horizontalLayout_2.addWidget(self.pushButton_2)
- spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
- self.horizontalLayout_2.addItem(spacerItem)
- self.gridLayout.addLayout(self.horizontalLayout_2, 2, 1, 1, 1)
+ sizePolicy.setHeightForWidth(self.toolButton_2.sizePolicy().hasHeightForWidth())
+ self.toolButton_2.setSizePolicy(sizePolicy)
+ self.toolButton_2.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
+ self.toolButton_2.setAutoRaise(False)
+ self.toolButton_2.setArrowType(QtCore.Qt.RightArrow)
+ self.toolButton_2.setObjectName("toolButton_2")
+ self.verticalLayout_2.addWidget(self.toolButton_2)
+ self.gridLayout.addLayout(self.verticalLayout_2, 0, 2, 1, 1)
self.tabWidget = QtWidgets.QTabWidget(Dialog)
self.tabWidget.setTabPosition(QtWidgets.QTabWidget.East)
self.tabWidget.setObjectName("tabWidget")
@@ -89,37 +92,57 @@ class Ui_Dialog(object):
self.tabWidgetPage1.setObjectName("tabWidgetPage1")
self.gridLayout_3 = QtWidgets.QGridLayout(self.tabWidgetPage1)
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.setChecked(True)
self.tglines_export_check.setObjectName("tglines_export_check")
- self.gridLayout_3.addWidget(self.tglines_export_check, 2, 2, 1, 1)
- self.label_6 = QtWidgets.QLabel(self.tabWidgetPage1)
- self.label_6.setObjectName("label_6")
- self.gridLayout_3.addWidget(self.label_6, 4, 1, 1, 1)
+ self.gridLayout_3.addWidget(self.tglines_export_check, 2, 3, 1, 1)
+ self.checkBox_6 = QtWidgets.QCheckBox(self.tabWidgetPage1)
+ self.checkBox_6.setChecked(True)
+ 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.setObjectName("new_graph_tau_combo")
- self.gridLayout_3.addWidget(self.new_graph_tau_combo, 5, 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, 5, 1, 1, 1)
+ self.gridLayout_3.addWidget(self.new_graph_tau_combo, 8, 3, 1, 1)
self.line = QtWidgets.QFrame(self.tabWidgetPage1)
self.line.setFrameShape(QtWidgets.QFrame.HLine)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setObjectName("line")
- self.gridLayout_3.addWidget(self.line, 3, 1, 1, 2)
- self.hodge_selection = CheckCombobox(self.tabWidgetPage1)
- self.hodge_selection.setObjectName("hodge_selection")
- self.hodge_selection.addItem("")
- self.hodge_selection.addItem("")
- self.hodge_selection.addItem("")
- self.hodge_selection.addItem("")
- self.hodge_selection.addItem("")
- self.gridLayout_3.addWidget(self.hodge_selection, 4, 2, 1, 1)
+ self.gridLayout_3.addWidget(self.line, 3, 2, 1, 2)
+ self.checkBox = QtWidgets.QCheckBox(self.tabWidgetPage1)
+ self.checkBox.setChecked(True)
+ self.checkBox.setObjectName("checkBox")
+ self.gridLayout_3.addWidget(self.checkBox, 5, 2, 1, 1)
+ 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, 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)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
@@ -127,44 +150,39 @@ class Ui_Dialog(object):
sizePolicy.setHeightForWidth(self.tau_plot.sizePolicy().hasHeightForWidth())
self.tau_plot.setSizePolicy(sizePolicy)
self.tau_plot.setObjectName("tau_plot")
- self.gridLayout_3.addWidget(self.tau_plot, 0, 0, 8, 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.gridLayout_3.addWidget(self.tau_plot, 2, 0, 9, 1)
self.tabWidget.addTab(self.tabWidgetPage1, "")
self.tabWidgetPage2 = QtWidgets.QWidget()
self.tabWidgetPage2.setObjectName("tabWidgetPage2")
self.gridLayout_2 = QtWidgets.QGridLayout(self.tabWidgetPage2)
self.gridLayout_2.setObjectName("gridLayout_2")
- self.pushButton_3 = QtWidgets.QPushButton(self.tabWidgetPage2)
- self.pushButton_3.setObjectName("pushButton_3")
- self.gridLayout_2.addWidget(self.pushButton_3, 1, 1, 1, 2)
+ self.fit_tnhm_fitbutton = QtWidgets.QPushButton(self.tabWidgetPage2)
+ self.fit_tnhm_fitbutton.setObjectName("fit_tnhm_fitbutton")
+ self.gridLayout_2.addWidget(self.fit_tnhm_fitbutton, 1, 1, 1, 2)
self.graphicsView_2 = PlotWidget(self.tabWidgetPage2)
self.graphicsView_2.setObjectName("graphicsView_2")
self.gridLayout_2.addWidget(self.graphicsView_2, 0, 0, 9, 1)
- self.checkBox = QtWidgets.QCheckBox(self.tabWidgetPage2)
- self.checkBox.setChecked(True)
- self.checkBox.setObjectName("checkBox")
- self.gridLayout_2.addWidget(self.checkBox, 5, 1, 1, 1)
+ self.new_graph_tnmh_check = QtWidgets.QCheckBox(self.tabWidgetPage2)
+ self.new_graph_tnmh_check.setChecked(True)
+ self.new_graph_tnmh_check.setObjectName("new_graph_tnmh_check")
+ self.gridLayout_2.addWidget(self.new_graph_tnmh_check, 5, 1, 1, 1)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_2 = QtWidgets.QLabel(self.tabWidgetPage2)
self.label_2.setObjectName("label_2")
self.horizontalLayout.addWidget(self.label_2)
- self.comboBox = QtWidgets.QComboBox(self.tabWidgetPage2)
- self.comboBox.setObjectName("comboBox")
- self.comboBox.addItem("")
- self.comboBox.addItem("")
- self.comboBox.addItem("")
- self.comboBox.addItem("")
- self.comboBox.addItem("")
- self.horizontalLayout.addWidget(self.comboBox)
+ self.tnmh_tg_combo = QtWidgets.QComboBox(self.tabWidgetPage2)
+ self.tnmh_tg_combo.setObjectName("tnmh_tg_combo")
+ self.tnmh_tg_combo.addItem("")
+ self.tnmh_tg_combo.addItem("")
+ self.tnmh_tg_combo.addItem("")
+ self.tnmh_tg_combo.addItem("")
+ self.tnmh_tg_combo.addItem("")
+ self.horizontalLayout.addWidget(self.tnmh_tg_combo)
self.gridLayout_2.addLayout(self.horizontalLayout, 0, 1, 1, 2)
- self.comboBox_2 = QtWidgets.QComboBox(self.tabWidgetPage2)
- self.comboBox_2.setObjectName("comboBox_2")
- self.gridLayout_2.addWidget(self.comboBox_2, 5, 2, 1, 1)
+ self.new_graph_tnmh_combo = QtWidgets.QComboBox(self.tabWidgetPage2)
+ self.new_graph_tnmh_combo.setObjectName("new_graph_tnmh_combo")
+ self.gridLayout_2.addWidget(self.new_graph_tnmh_combo, 5, 2, 1, 1)
self.line_2 = QtWidgets.QFrame(self.tabWidgetPage2)
self.line_2.setMinimumSize(QtCore.QSize(0, 0))
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.setObjectName("checkBox_3")
self.gridLayout_2.addWidget(self.checkBox_3, 4, 1, 1, 2)
- spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
- self.gridLayout_2.addItem(spacerItem2, 8, 1, 1, 1)
+ spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
+ self.gridLayout_2.addItem(spacerItem1, 8, 1, 1, 1)
self.pushButton = QtWidgets.QPushButton(self.tabWidgetPage2)
self.pushButton.setObjectName("pushButton")
self.gridLayout_2.addWidget(self.pushButton, 7, 1, 1, 2)
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.tabWidget.setCurrentIndex(0)
@@ -197,29 +215,28 @@ class Ui_Dialog(object):
self.label.setText(_translate("Dialog", "
Tg values:
"))
self.label_4.setText(_translate("Dialog", "TNMH parameter:
"))
self.calctg_button.setText(_translate("Dialog", "Calculate Tg"))
- self.pushButton_2.setText(_translate("Dialog", "Calculate fictive Cp"))
- self.tg_export_check.setText(_translate("Dialog", "Export Tg"))
+ self.toolButton_2.setText(_translate("Dialog", "Calculate fictive Cp"))
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.hodge_selection.setItemText(0, _translate("Dialog", "Onset"))
- self.hodge_selection.setItemText(1, _translate("Dialog", "Midpoint"))
- self.hodge_selection.setItemText(2, _translate("Dialog", "End"))
- self.hodge_selection.setItemText(3, _translate("Dialog", "Inflection"))
- self.hodge_selection.setItemText(4, _translate("Dialog", "Fictive"))
- self.pushButton_4.setText(_translate("Dialog", "Save"))
+ self.checkBox_5.setText(_translate("Dialog", "Inflection"))
+ self.label_6.setText(_translate("Dialog", "Export Hodge:"))
+ self.checkBox_4.setText(_translate("Dialog", "Midpoint"))
+ self.checkBox_7.setText(_translate("Dialog", "Fictive"))
+ self.pushButton_4.setText(_translate("Dialog", "Export"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabWidgetPage1), _translate("Dialog", "Tg / Hodge"))
- self.pushButton_3.setText(_translate("Dialog", "Fit TNMH model"))
- self.checkBox.setText(_translate("Dialog", "New graph"))
+ self.fit_tnhm_fitbutton.setText(_translate("Dialog", "Fit TNMH model"))
+ self.new_graph_tnmh_check.setText(_translate("Dialog", "New graph"))
self.label_2.setText(_translate("Dialog", "Tg for TNMH"))
- self.comboBox.setItemText(0, _translate("Dialog", "Fictive"))
- self.comboBox.setItemText(1, _translate("Dialog", "Onset"))
- self.comboBox.setItemText(2, _translate("Dialog", "Midpoint"))
- self.comboBox.setItemText(3, _translate("Dialog", "End"))
- self.comboBox.setItemText(4, _translate("Dialog", "Inflection"))
+ self.tnmh_tg_combo.setItemText(0, _translate("Dialog", "Fictive"))
+ self.tnmh_tg_combo.setItemText(1, _translate("Dialog", "Onset"))
+ self.tnmh_tg_combo.setItemText(2, _translate("Dialog", "Midpoint"))
+ self.tnmh_tg_combo.setItemText(3, _translate("Dialog", "End"))
+ self.tnmh_tg_combo.setItemText(4, _translate("Dialog", "Inflection"))
self.checkBox_2.setText(_translate("Dialog", "Export dTf / dT"))
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"))
-from ..lib.forms import CheckCombobox
from pyqtgraph import PlotWidget
diff --git a/src/gui_qt/dsc/glass_dialog.py b/src/gui_qt/dsc/glass_dialog.py
index 2ece5d8..ede88f7 100644
--- a/src/gui_qt/dsc/glass_dialog.py
+++ b/src/gui_qt/dsc/glass_dialog.py
@@ -27,19 +27,46 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
self._plots = {}
self._tg_value = {}
self._fit = {}
- self._lines = {}
self._hodge = {
- 'onset': (PlotItem(x=[], y=[], pen=None, symbol='o', symbolBrush=Tab10.TabBlue.rgb(), name='Onset'), None),
- 'midpoint': (PlotItem(x=[], y=[], pen=None, symbol='s', symbolBrush=Tab10.TabOrange.rgb(), name='Midpoint'), None),
- 'end': (PlotItem(x=[], y=[], pen=None, symbol='t', symbolBrush=Tab10.TabGreen.rgb(), name='End'), None),
- 'inflection': (PlotItem(x=[], y=[], pen=None, symbol='d', symbolBrush=Tab10.TabRed.rgb(), name='Inflection'), None),
+ 'onset': (
+ PlotItem(x=[], y=[], pen=None, symbol='o', symbolBrush=Tab10.TabBlue.rgb(), name='Onset'),
+ 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'),
# 'TNMH': PlotItem(x=[], y=[], pen=None, symbol='star', symbolBrush=Tab10.TabPurple.rgb(), name='TNMH'),
}
+ self._lines = {}
self.tau_plot.getPlotItem().addLegend()
- for plt, _ in self._hodge.values():
+ for plt, _, fitplt, _ in self._hodge.values():
self.tau_plot.addItem(plt)
+ self.tghodge_graph.addItem(fitplt[0])
+ self.tghodge_graph.addItem(fitplt[1])
self.tau_plot.setLogMode(y=True)
+ self.tghodge_graph.setLogMode(y=True)
self.limits = RegionItem(), RegionItem()
for lim in self.limits:
@@ -69,7 +96,9 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
for key, plt in self._hodge.items():
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._plots = {}
@@ -242,7 +271,7 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
plot[-1].setData(res.x, res.y)
def hodge(self):
- for tg_type, (plot, data) in self._hodge.items():
+ for tg_type, (plot, data, fitplots, fit) in self._hodge.items():
m = []
for idx in range(self.listWidget.count()):
@@ -260,11 +289,13 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
m.append([tg_value, data.value])
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()})'
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:
self.clear()
diff --git a/src/nmreval/dsc/hodge.py b/src/nmreval/dsc/hodge.py
index b2dc3ba..2d5b716 100644
--- a/src/nmreval/dsc/hodge.py
+++ b/src/nmreval/dsc/hodge.py
@@ -3,12 +3,13 @@ from scipy.stats import linregress
from nmreval.data import Points
from nmreval.fit.minimizer import FitRoutine
+from nmreval.fit.result import FitResult
from nmreval.lib.utils import ArrayLike
from nmreval.models import Arrhenius
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
tg = np.asanyarray(tg)
fitter = FitRoutine()
@@ -23,4 +24,4 @@ def tau_hodge(tg: ArrayLike, rate: ArrayLike) -> Points:
de = res.parameter['E_{A}']
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
diff --git a/src/resources/_ui/tnmh_dialog.ui b/src/resources/_ui/tnmh_dialog.ui
index eee841e..00a3a78 100644
--- a/src/resources/_ui/tnmh_dialog.ui
+++ b/src/resources/_ui/tnmh_dialog.ui
@@ -6,8 +6,8 @@
0
0
- 1041
- 773
+ 1094
+ 829
@@ -85,12 +85,12 @@
- -
-
+
-
+
-
-
+
-
+
0
0
@@ -98,12 +98,18 @@
Calculate Tg
+
+ Qt::ToolButtonTextBesideIcon
+
+
+ Qt::RightArrow
+
-
-
+
-
+
0
0
@@ -111,47 +117,33 @@
Calculate fictive Cp
+
+ Qt::ToolButtonTextBesideIcon
+
+
+ false
+
+
+ Qt::RightArrow
+
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
+
-
QTabWidget::East
- 1
+ 0
Tg / Hodge
-
-
-
-
- Export Tg
-
-
- true
-
-
-
- -
+
-
Export lines
@@ -161,17 +153,47 @@
- -
-
+
-
+
- Export Hodge:
+ End
+
+
+ true
+
+
+
+ -
+
+
+ -
+
+
+ Qt::Horizontal
-
-
+
+
+ Onset
+
+
+ true
+
+
- -
+
-
+
+
+ Export Tg
+
+
+ true
+
+
+
+ -
New graph
@@ -181,53 +203,17 @@
- -
-
-
- Qt::Horizontal
+
-
+
+
+ Inflection
+
+
+ true
- -
-
-
-
-
- Onset
-
-
- -
-
- Midpoint
-
-
- -
-
- End
-
-
- -
-
- Inflection
-
-
- -
-
- Fictive
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
+
-
Qt::Vertical
@@ -240,10 +226,50 @@
- -
+
-
+
+
+ Export Hodge:
+
+
+
+ -
+
+
+ Midpoint
+
+
+ true
+
+
+
+ -
+
+
+ Fictive
+
+
+ true
+
+
+
+ -
- Save
+ Export
+
+
+
+ -
+
+
+ -
+
+
+
+ 0
+ 0
+
@@ -360,7 +386,7 @@
-
- Save
+ Export
@@ -376,11 +402,6 @@
QGraphicsView
-
- CheckCombobox
- QComboBox
-
-