Merge branch 'dsc'

# Conflicts:
#	src/gui_qt/_py/basewindow.py
#	src/gui_qt/_py/tnmh_dialog.py
#	src/gui_qt/dsc/glass_dialog.py
#	src/gui_qt/main/mainwindow.py
#	src/gui_qt/main/management.py
#	src/gui_qt/math/binning.py
#	src/nmreval/data/dsc.py
#	src/nmreval/dsc/hodge.py
#	src/resources/_ui/basewindow.ui
#	src/resources/_ui/tnmh_dialog.ui
This commit is contained in:
Dominik Demuth 2023-07-05 20:02:52 +02:00
commit 46ca50845b
13 changed files with 712 additions and 586 deletions

View File

@ -12,7 +12,7 @@ script:
# Copy the python application code into the AppDir # Copy the python application code into the AppDir
- cp bin/evaluate.py $TARGET_APPDIR/usr/bin/ - cp bin/evaluate.py $TARGET_APPDIR/usr/bin/
- cp -r src/* $TARGET_APPDIR/usr/src/ - cp -r src/* $TARGET_APPDIR/usr/src/
- cp src/pkm.vogel.nmreval.desktop $TARGET_APPDIR/usr/share/applications - cp src/resources/pkm.vogel.nmreval.desktop $TARGET_APPDIR/usr/share/applications
# set current date as version info # set current date as version info
- sed -i "s/CURRENT_DATE/$(date +'%Y-%m-%d')/" $TARGET_APPDIR/usr/src/nmreval/version.py - sed -i "s/CURRENT_DATE/$(date +'%Y-%m-%d')/" $TARGET_APPDIR/usr/src/nmreval/version.py

View File

@ -372,6 +372,8 @@ class Ui_BaseWindow(object):
self.actionTNMH_model.setObjectName("actionTNMH_model") self.actionTNMH_model.setObjectName("actionTNMH_model")
self.actionBinning = QtWidgets.QAction(BaseWindow) self.actionBinning = QtWidgets.QAction(BaseWindow)
self.actionBinning.setObjectName("actionBinning") self.actionBinning.setObjectName("actionBinning")
self.actionTNMH = QtWidgets.QAction(BaseWindow)
self.actionTNMH.setObjectName("actionTNMH")
self.menuSave.addAction(self.actionSave) self.menuSave.addAction(self.actionSave)
self.menuSave.addAction(self.actionExportGraphic) self.menuSave.addAction(self.actionExportGraphic)
self.menuSave.addAction(self.action_save_fit_parameter) self.menuSave.addAction(self.action_save_fit_parameter)
@ -637,8 +639,9 @@ class Ui_BaseWindow(object):
self.actionShow_error_log.setText(_translate("BaseWindow", "Show error log")) self.actionShow_error_log.setText(_translate("BaseWindow", "Show error log"))
self.actionCreate_starter.setText(_translate("BaseWindow", "Create starter..")) self.actionCreate_starter.setText(_translate("BaseWindow", "Create starter.."))
self.actionAbout.setText(_translate("BaseWindow", "About...")) self.actionAbout.setText(_translate("BaseWindow", "About..."))
self.actionTNMH_model.setText(_translate("BaseWindow", "Tg determination,,,")) self.actionTNMH_model.setText(_translate("BaseWindow", "Tg , Hodge, TNMH,,,"))
self.actionBinning.setText(_translate("BaseWindow", "Binning...")) self.actionBinning.setText(_translate("BaseWindow", "Binning..."))
self.actionTNMH.setText(_translate("BaseWindow", "TNMH..."))
from ..data.datawidget.datawidget import DataWidget from ..data.datawidget.datawidget import DataWidget
from ..data.integral_widget import IntegralWidget from ..data.integral_widget import IntegralWidget
from ..data.point_select import PointSelectWidget from ..data.point_select import PointSelectWidget

View File

@ -11,180 +11,185 @@
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object): class Ui_Wizard(object):
def setupUi(self, Dialog): def setupUi(self, Wizard):
Dialog.setObjectName("Dialog") Wizard.setObjectName("Wizard")
Dialog.resize(1042, 683) Wizard.resize(854, 619)
self.gridLayout = QtWidgets.QGridLayout(Dialog) self.wizardPage1 = QtWidgets.QWizardPage()
self.wizardPage1.setObjectName("wizardPage1")
self.gridLayout = QtWidgets.QGridLayout(self.wizardPage1)
self.gridLayout.setObjectName("gridLayout") self.gridLayout.setObjectName("gridLayout")
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) self.treeWidget = QtWidgets.QTreeWidget(self.wizardPage1)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.treeWidget.setObjectName("treeWidget")
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save) self.treeWidget.headerItem().setText(0, "1")
self.buttonBox.setObjectName("buttonBox") self.treeWidget.header().setVisible(False)
self.gridLayout.addWidget(self.buttonBox, 5, 1, 1, 1) self.gridLayout.addWidget(self.treeWidget, 2, 0, 1, 1)
self.verticalLayout = QtWidgets.QVBoxLayout() self.gridLayout_9 = QtWidgets.QGridLayout()
self.verticalLayout.setObjectName("verticalLayout") self.gridLayout_9.setObjectName("gridLayout_9")
self.listWidget = QtWidgets.QListWidget(Dialog) self.tg_export_check = QtWidgets.QCheckBox(self.wizardPage1)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.listWidget.sizePolicy().hasHeightForWidth())
self.listWidget.setSizePolicy(sizePolicy)
self.listWidget.setObjectName("listWidget")
self.verticalLayout.addWidget(self.listWidget)
self.label = QtWidgets.QLabel(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
self.label.setSizePolicy(sizePolicy)
self.label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label.setObjectName("label")
self.verticalLayout.addWidget(self.label)
self.tg_value_label = QtWidgets.QLabel(Dialog)
self.tg_value_label.setText("")
self.tg_value_label.setObjectName("tg_value_label")
self.verticalLayout.addWidget(self.tg_value_label)
self.label_4 = QtWidgets.QLabel(Dialog)
self.label_4.setObjectName("label_4")
self.verticalLayout.addWidget(self.label_4)
self.label_5 = QtWidgets.QLabel(Dialog)
self.label_5.setText("")
self.label_5.setObjectName("label_5")
self.verticalLayout.addWidget(self.label_5)
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 5, 1)
self.stackedWidget = QtWidgets.QStackedWidget(Dialog)
self.stackedWidget.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.stackedWidget.setFrameShadow(QtWidgets.QFrame.Raised)
self.stackedWidget.setObjectName("stackedWidget")
self.stackedWidgetPage1 = QtWidgets.QWidget()
self.stackedWidgetPage1.setObjectName("stackedWidgetPage1")
self.gridLayout_3 = QtWidgets.QGridLayout(self.stackedWidgetPage1)
self.gridLayout_3.setObjectName("gridLayout_3")
self.hodge_selection = CheckCombobox(self.stackedWidgetPage1)
self.hodge_selection.setObjectName("hodge_selection")
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.tau_plot = PlotWidget(self.stackedWidgetPage1)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
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, 7, 1)
self.tg_export_check = QtWidgets.QCheckBox(self.stackedWidgetPage1)
self.tg_export_check.setChecked(True) self.tg_export_check.setChecked(True)
self.tg_export_check.setObjectName("tg_export_check") self.tg_export_check.setObjectName("tg_export_check")
self.gridLayout_3.addWidget(self.tg_export_check, 2, 1, 1, 1) self.gridLayout_9.addWidget(self.tg_export_check, 0, 0, 1, 1)
self.tglines_export_check = QtWidgets.QCheckBox(self.stackedWidgetPage1) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_9.addItem(spacerItem, 3, 0, 1, 1)
self.tglines_export_check = QtWidgets.QCheckBox(self.wizardPage1)
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_9.addWidget(self.tglines_export_check, 0, 1, 1, 1)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.pushButton = QtWidgets.QPushButton(self.wizardPage1)
self.gridLayout_3.addItem(spacerItem, 6, 2, 1, 1) self.pushButton.setObjectName("pushButton")
self.new_graph_tau_combo = QtWidgets.QComboBox(self.stackedWidgetPage1) self.gridLayout_9.addWidget(self.pushButton, 2, 0, 1, 2)
self.new_graph_tau_combo.setObjectName("new_graph_tau_combo") self.gridLayout.addLayout(self.gridLayout_9, 2, 1, 1, 1)
self.gridLayout_3.addWidget(self.new_graph_tau_combo, 5, 2, 1, 1) self.dsc_plot = PlotWidget(self.wizardPage1)
self.label_6 = QtWidgets.QLabel(self.stackedWidgetPage1)
self.label_6.setObjectName("label_6")
self.gridLayout_3.addWidget(self.label_6, 4, 1, 1, 1)
self.new_graph_tau_check = QtWidgets.QCheckBox(self.stackedWidgetPage1)
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.stackedWidgetPage1)
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.stackedWidget.addWidget(self.stackedWidgetPage1)
self.page = QtWidgets.QWidget()
self.page.setObjectName("page")
self.gridLayout_2 = QtWidgets.QGridLayout(self.page)
self.gridLayout_2.setObjectName("gridLayout_2")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_2 = QtWidgets.QLabel(self.page)
self.label_2.setObjectName("label_2")
self.horizontalLayout.addWidget(self.label_2)
self.comboBox = QtWidgets.QComboBox(self.page)
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.gridLayout_2.addLayout(self.horizontalLayout, 1, 1, 1, 1)
self.pushButton_3 = QtWidgets.QPushButton(self.page)
self.pushButton_3.setObjectName("pushButton_3")
self.gridLayout_2.addWidget(self.pushButton_3, 2, 1, 1, 1)
self.graphicsView_2 = PlotWidget(self.page)
self.graphicsView_2.setObjectName("graphicsView_2")
self.gridLayout_2.addWidget(self.graphicsView_2, 0, 0, 3, 1)
self.stackedWidget.addWidget(self.page)
self.gridLayout.addWidget(self.stackedWidget, 4, 1, 1, 1)
self.dsc_plot = PlotWidget(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.dsc_plot.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(self.dsc_plot.sizePolicy().hasHeightForWidth())
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, 1, 0, 1, 2)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.calctg_button = QtWidgets.QToolButton(self.wizardPage1)
self.horizontalLayout_2.setObjectName("horizontalLayout_2") sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
self.calctg_button = QtWidgets.QPushButton(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
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.gridLayout.addWidget(self.calctg_button, 0, 0, 1, 2)
self.pushButton_2 = QtWidgets.QPushButton(Dialog) Wizard.addPage(self.wizardPage1)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) self.wizardPage2 = QtWidgets.QWizardPage()
self.wizardPage2.setObjectName("wizardPage2")
self.gridLayout_2 = QtWidgets.QGridLayout(self.wizardPage2)
self.gridLayout_2.setObjectName("gridLayout_2")
self.toolButton = QtWidgets.QToolButton(self.wizardPage2)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, 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.sizePolicy().hasHeightForWidth())
self.pushButton_2.setSizePolicy(sizePolicy) self.toolButton.setSizePolicy(sizePolicy)
self.toolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self.toolButton.setArrowType(QtCore.Qt.RightArrow)
self.toolButton.setObjectName("toolButton")
self.gridLayout_2.addWidget(self.toolButton, 0, 0, 1, 2)
self.tghodge_graph = PlotWidget(self.wizardPage2)
self.tghodge_graph.setObjectName("tghodge_graph")
self.gridLayout_2.addWidget(self.tghodge_graph, 2, 0, 1, 1)
self.tau_plot = PlotWidget(self.wizardPage2)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.tau_plot.sizePolicy().hasHeightForWidth())
self.tau_plot.setSizePolicy(sizePolicy)
self.tau_plot.setObjectName("tau_plot")
self.gridLayout_2.addWidget(self.tau_plot, 2, 1, 1, 1)
self.gridLayout_4 = QtWidgets.QGridLayout()
self.gridLayout_4.setObjectName("gridLayout_4")
self.checkBox_6 = QtWidgets.QCheckBox(self.wizardPage2)
self.checkBox_6.setChecked(True)
self.checkBox_6.setObjectName("checkBox_6")
self.gridLayout_4.addWidget(self.checkBox_6, 2, 0, 1, 1)
self.new_graph_tau_check = QtWidgets.QCheckBox(self.wizardPage2)
self.new_graph_tau_check.setChecked(True)
self.new_graph_tau_check.setObjectName("new_graph_tau_check")
self.gridLayout_4.addWidget(self.new_graph_tau_check, 0, 1, 1, 1)
self.checkBox_7 = QtWidgets.QCheckBox(self.wizardPage2)
self.checkBox_7.setChecked(True)
self.checkBox_7.setObjectName("checkBox_7")
self.gridLayout_4.addWidget(self.checkBox_7, 4, 0, 1, 1)
self.checkBox_5 = QtWidgets.QCheckBox(self.wizardPage2)
self.checkBox_5.setChecked(True)
self.checkBox_5.setObjectName("checkBox_5")
self.gridLayout_4.addWidget(self.checkBox_5, 3, 0, 1, 1)
self.new_graph_tau_combo = QtWidgets.QComboBox(self.wizardPage2)
self.new_graph_tau_combo.setEnabled(False)
self.new_graph_tau_combo.setObjectName("new_graph_tau_combo")
self.gridLayout_4.addWidget(self.new_graph_tau_combo, 0, 2, 1, 1)
self.checkBox_4 = QtWidgets.QCheckBox(self.wizardPage2)
self.checkBox_4.setChecked(True)
self.checkBox_4.setObjectName("checkBox_4")
self.gridLayout_4.addWidget(self.checkBox_4, 1, 0, 1, 1)
self.checkBox = QtWidgets.QCheckBox(self.wizardPage2)
self.checkBox.setChecked(True)
self.checkBox.setObjectName("checkBox")
self.gridLayout_4.addWidget(self.checkBox, 0, 0, 1, 1)
self.pushButton_4 = QtWidgets.QPushButton(self.wizardPage2)
self.pushButton_4.setObjectName("pushButton_4")
self.gridLayout_4.addWidget(self.pushButton_4, 4, 1, 1, 2)
self.gridLayout_2.addLayout(self.gridLayout_4, 3, 0, 1, 2)
Wizard.addPage(self.wizardPage2)
self.wizardPage = QtWidgets.QWizardPage()
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.wizardPage.sizePolicy().hasHeightForWidth())
self.wizardPage.setSizePolicy(sizePolicy)
self.wizardPage.setSubTitle("")
self.wizardPage.setObjectName("wizardPage")
self.gridLayout_6 = QtWidgets.QGridLayout(self.wizardPage)
self.gridLayout_6.setObjectName("gridLayout_6")
self.fit_tnhm_fitbutton = QtWidgets.QPushButton(self.wizardPage)
self.fit_tnhm_fitbutton.setObjectName("fit_tnhm_fitbutton")
self.gridLayout_6.addWidget(self.fit_tnhm_fitbutton, 0, 0, 1, 2)
self.treeWidget_2 = QtWidgets.QTreeWidget(self.wizardPage)
self.treeWidget_2.setObjectName("treeWidget_2")
self.treeWidget_2.headerItem().setText(0, "1")
self.treeWidget_2.header().setVisible(False)
self.gridLayout_6.addWidget(self.treeWidget_2, 2, 0, 1, 1)
self.gridLayout_5 = QtWidgets.QGridLayout()
self.gridLayout_5.setObjectName("gridLayout_5")
self.new_graph_tnmh_check_2 = QtWidgets.QCheckBox(self.wizardPage)
self.new_graph_tnmh_check_2.setChecked(True)
self.new_graph_tnmh_check_2.setObjectName("new_graph_tnmh_check_2")
self.gridLayout_5.addWidget(self.new_graph_tnmh_check_2, 1, 0, 1, 1)
self.checkBox_14 = QtWidgets.QCheckBox(self.wizardPage)
self.checkBox_14.setChecked(True)
self.checkBox_14.setObjectName("checkBox_14")
self.gridLayout_5.addWidget(self.checkBox_14, 0, 0, 1, 1)
self.pushButton_2 = QtWidgets.QPushButton(self.wizardPage)
self.pushButton_2.setObjectName("pushButton_2") self.pushButton_2.setObjectName("pushButton_2")
self.horizontalLayout_2.addWidget(self.pushButton_2) self.gridLayout_5.addWidget(self.pushButton_2, 2, 0, 1, 2)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.checkBox_13 = QtWidgets.QCheckBox(self.wizardPage)
self.horizontalLayout_2.addItem(spacerItem1) self.checkBox_13.setChecked(True)
self.gridLayout.addLayout(self.horizontalLayout_2, 2, 1, 1, 1) self.checkBox_13.setObjectName("checkBox_13")
self.gridLayout_5.addWidget(self.checkBox_13, 0, 1, 1, 1)
self.new_graph_tnmh_combo_2 = QtWidgets.QComboBox(self.wizardPage)
self.new_graph_tnmh_combo_2.setEnabled(False)
self.new_graph_tnmh_combo_2.setObjectName("new_graph_tnmh_combo_2")
self.gridLayout_5.addWidget(self.new_graph_tnmh_combo_2, 1, 1, 1, 1)
spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_5.addItem(spacerItem1, 3, 0, 1, 1)
self.gridLayout_6.addLayout(self.gridLayout_5, 2, 1, 1, 1)
self.graphicsView_3 = PlotWidget(self.wizardPage)
self.graphicsView_3.setObjectName("graphicsView_3")
self.gridLayout_6.addWidget(self.graphicsView_3, 1, 0, 1, 2)
Wizard.addPage(self.wizardPage)
self.retranslateUi(Dialog) self.retranslateUi(Wizard)
self.stackedWidget.setCurrentIndex(0) QtCore.QMetaObject.connectSlotsByName(Wizard)
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog): def retranslateUi(self, Wizard):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "SImba, everything the light touches is our kingdom")) Wizard.setWindowTitle(_translate("Wizard", "Wizard"))
self.label.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">Tg values:</span></p></body></html>")) self.wizardPage1.setTitle(_translate("Wizard", "Glass transition"))
self.label_4.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">TNMH parameter:</span></p></body></html>")) self.tg_export_check.setText(_translate("Wizard", "Export Tg"))
self.hodge_selection.setItemText(0, _translate("Dialog", "Onset")) self.tglines_export_check.setText(_translate("Wizard", "Export lines"))
self.hodge_selection.setItemText(1, _translate("Dialog", "Midpoint")) self.pushButton.setText(_translate("Wizard", "Export"))
self.hodge_selection.setItemText(2, _translate("Dialog", "End")) self.calctg_button.setText(_translate("Wizard", "Calculate Tg"))
self.hodge_selection.setItemText(3, _translate("Dialog", "Inflection")) self.wizardPage2.setTitle(_translate("Wizard", "Hodge"))
self.tg_export_check.setText(_translate("Dialog", "Export Tg")) self.toolButton.setText(_translate("Wizard", "Calculate Hodge"))
self.tglines_export_check.setText(_translate("Dialog", "Export lines")) self.checkBox_6.setText(_translate("Wizard", "End"))
self.label_6.setText(_translate("Dialog", "Hodge:")) self.new_graph_tau_check.setText(_translate("Wizard", "New graph"))
self.new_graph_tau_check.setText(_translate("Dialog", "New graph")) self.checkBox_7.setText(_translate("Wizard", "Fictive"))
self.label_2.setText(_translate("Dialog", "Tg for TNMH")) self.checkBox_5.setText(_translate("Wizard", "Inflection"))
self.comboBox.setItemText(0, _translate("Dialog", "Fictive")) self.checkBox_4.setText(_translate("Wizard", "Midpoint"))
self.comboBox.setItemText(1, _translate("Dialog", "Onset")) self.checkBox.setText(_translate("Wizard", "Onset"))
self.comboBox.setItemText(2, _translate("Dialog", "Midpoint")) self.pushButton_4.setText(_translate("Wizard", "Export"))
self.comboBox.setItemText(3, _translate("Dialog", "End")) self.wizardPage.setTitle(_translate("Wizard", "TNMH"))
self.comboBox.setItemText(4, _translate("Dialog", "Inflection")) self.fit_tnhm_fitbutton.setText(_translate("Wizard", "Fit TNMH model"))
self.pushButton_3.setText(_translate("Dialog", "Fit TNMH model")) self.new_graph_tnmh_check_2.setText(_translate("Wizard", "New graph"))
self.calctg_button.setText(_translate("Dialog", "Calculate Tg")) self.checkBox_14.setText(_translate("Wizard", "Export fit"))
self.pushButton_2.setText(_translate("Dialog", "Calculate fictive Cp")) self.pushButton_2.setText(_translate("Wizard", "Export"))
from ..lib.forms import CheckCombobox self.checkBox_13.setText(_translate("Wizard", "Export dTf / dT"))
from pyqtgraph import PlotWidget from pyqtgraph import PlotWidget

View File

@ -6,20 +6,27 @@ from pyqtgraph import mkPen, mkBrush, LegendItem
from nmreval.dsc.hodge import tau_hodge from nmreval.dsc.hodge import tau_hodge
from nmreval.lib.colors import Tab10 from nmreval.lib.colors import Tab10
from ..Qt import QtWidgets, QtCore from ..Qt import QtWidgets, QtCore, QtGui
from .._py.tnmh_dialog import Ui_Dialog from .._py.tnmh_dialog import Ui_Wizard
from ..lib.listwidget import QListWidgetSelect
from ..lib.pg_objects import PlotItem, RegionItem from ..lib.pg_objects import PlotItem, RegionItem
from nmreval.data import DSC, Points from nmreval.data import DSC, Points
class TgCalculator(QtWidgets.QDialog, Ui_Dialog): class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
newTg = QtCore.pyqtSignal(dict, list, str) newData = QtCore.pyqtSignal(dict, str)
def __init__(self, management, parent=None): def __init__(self, management, parent=None):
super().__init__(parent=parent) super().__init__(parent=parent)
self.setupUi(self) self.setupUi(self)
self.listWidget = QListWidgetSelect(parent=self)
self.listWidget.setSelectionMode(self.listWidget.ExtendedSelection)
self.listWidget.itemChanged.connect(self.change_visibility)
self.setSideWidget(self.listWidget)
self.listWidget.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding))
self._management = management self._management = management
self._colors = cycle(Tab10) self._colors = cycle(Tab10)
@ -27,22 +34,51 @@ 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()})),
# 'fictive': PlotItem(x=[], y=[], pen=None, symbol='t1', symbolBrush=Tab10.TabPurple.rgb(), name='Fictive'), PlotItem(x=[], y=[], pen=None, symbol='o', symbolBrush=Tab10.TabBlue.rgb())),
# 'TNMH': PlotItem(x=[], y=[], pen=None, symbol='star', symbolBrush=Tab10.TabPurple.rgb(), name='TNMH'), 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'),
None,
(PlotItem(x=[], y=[], pen=mkPen({'color': Tab10.TabPurple.rgb()})),
PlotItem(x=[], y=[], pen=None, symbol='t1', symbolBrush=Tab10.TabPurple.rgb())),
None,
),
} }
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.pushButton_2.hide() self.tghodge_graph.setLogMode(y=True)
self.label_4.hide()
self.label_5.hide()
self.limits = RegionItem(), RegionItem() self.limits = RegionItem(), RegionItem()
for lim in self.limits: for lim in self.limits:
@ -51,10 +87,8 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
self.add_sets() self.add_sets()
self.listWidget.itemClicked.connect(self.show_tg_values)
self.new_graph_tau_combo.setEnabled(False)
self.new_graph_tau_check.stateChanged.connect(lambda state: self.new_graph_tau_combo.setEnabled(not bool(state))) self.new_graph_tau_check.stateChanged.connect(lambda state: self.new_graph_tau_combo.setEnabled(not bool(state)))
self.new_graph_tau_check.stateChanged.connect(lambda state: self.new_graph_tnmh_combo_2.setEnabled(not bool(state)))
def __call__(self): def __call__(self):
self.clear() self.clear()
@ -68,11 +102,12 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
for plots in self._plots.values(): for plots in self._plots.values():
for val in plots: for val in plots:
self.dsc_plot.removeItem(val) self.dsc_plot.removeItem(val)
self.graphicsView_2.removeItem(val)
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 = {}
@ -84,6 +119,7 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
self.new_graph_tau_combo.clear() self.new_graph_tau_combo.clear()
for graphs in self._management.graphs.list(): for graphs in self._management.graphs.list():
self.new_graph_tau_combo.addItem(graphs[1], userData=graphs[0]) self.new_graph_tau_combo.addItem(graphs[1], userData=graphs[0])
self.new_graph_tnmh_combo_2.addItem(graphs[1], userData=graphs[0])
min_x = 10_000_000 min_x = 10_000_000
max_x = -10_000_000 max_x = -10_000_000
@ -122,14 +158,20 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
self.dsc_plot.addItem(tg_plot) self.dsc_plot.addItem(tg_plot)
fictive_cp = PlotItem(pen=mkPen(c.rgb())) fictive_cp = PlotItem(pen=mkPen(c.rgb()))
self.graphicsView_2.addItem(fictive_cp) self.graphicsView_3.addItem(fictive_cp)
tnmh_fit = PlotItem() tnmh_fit = PlotItem()
tnmh_fit.set_line(style=2, color=c) tnmh_fit.set_line(style=2, color=c)
self.graphicsView_2.addItem(tnmh_fit) self.graphicsView_3.addItem(tnmh_fit)
self._plots[key] = (data_plot, tg_plot, glass, liquid, tangent, fictive_cp, tnmh_fit) self._plots[key] = (data_plot, tg_plot, glass, liquid, tangent, fictive_cp, tnmh_fit)
self._tg_value[key] = {'onset': (nan, nan), 'midpoint': (nan, nan), 'end': (nan, nan), 'inflection': (nan, nan)} # , 'fictive': (nan, nan)} self._tg_value[key] = {
'onset': (nan, nan),
'midpoint': (nan, nan),
'end': (nan, nan),
'inflection': (nan, nan),
# 'fictive': (nan, nan),
}
if self._limitless: if self._limitless:
dist = max_x - min_x dist = max_x - min_x
@ -162,104 +204,174 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
self._update_tg_plots() self._update_tg_plots()
def show_tg_values(self, item):
values = self._tg_value.get(item.data(QtCore.Qt.UserRole))
if values is not None:
label = '\n'.join((f'{name.capitalize()}: {pos[0]:.2f} K' for name, pos in values.items()))
self.tg_value_label.setText(label)
fit = self._fit.get(item.data(QtCore.Qt.UserRole))
if fit is not None:
self.label_5.setText(fit._parameter_string())
def _update_tg_plots(self): def _update_tg_plots(self):
self.treeWidget.clear()
for idx in range(self.listWidget.count()): for idx in range(self.listWidget.count()):
item = self.listWidget.item(idx) item = self.listWidget.item(idx)
tree_item = QtWidgets.QTreeWidgetItem([item.text()])
values = self._tg_value.get(item.data(QtCore.Qt.UserRole))
if values is not None:
for name, pos in values.items():
child_item = QtWidgets.QTreeWidgetItem([f'{name.capitalize()}: {pos[0]:.2f} K'])
tree_item.addChild(child_item)
self.treeWidget.addTopLevelItem(tree_item)
key = item.data(QtCore.Qt.UserRole) key = item.data(QtCore.Qt.UserRole)
plot = self._plots[key] plot = self._plots[key]
data, _ = self._dsc[key] data, _ = self._dsc[key]
plot[1].setData(array(list(self._tg_value[key].values()))) plot[1].setData(array(list(self._tg_value[key].values())))
self.hodge() @QtCore.pyqtSlot(name='on_pushButton_clicked')
def export_tg(self):
ret_dic = {}
for key, tg in self._tg_value.items():
tgx = [x for x, y in tg.values()]
tgy = [y for x, y in tg.values()]
if self.tg_export_check.isChecked():
tg_pts = Points(x=tgx, y=tgy, name=self._management[key].name + ' (Tg)', value=self._management[key].value)
else:
tg_pts = None
@QtCore.pyqtSlot(QtWidgets.QListWidgetItem, name='on_listWidget_itemChanged') if self.tglines_export_check.isChecked():
line = self._lines[key]
else:
line = []
ret_dic[key] = (tg_pts, line)
self.newData.emit(ret_dic, 'tg')
@QtCore.pyqtSlot(QtWidgets.QListWidgetItem)
def change_visibility(self, item: QtWidgets.QListWidgetItem): def change_visibility(self, item: QtWidgets.QListWidgetItem):
is_checked = bool(item.checkState()) is_checked = bool(item.checkState())
plot = self._plots[item.data(QtCore.Qt.UserRole)] plot = self._plots[item.data(QtCore.Qt.UserRole)]
for val in plot: for val in plot:
val.setVisible(is_checked) val.setVisible(is_checked)
@QtCore.pyqtSlot(name='on_pushButton_2_clicked') def get_fictive(self, key, baselines):
def get_fictive(self): plot = self._plots[key]
baselines = tuple(lim.getRegion() for lim in self.limits) data, _ = self._dsc[key]
if baselines[0][0] > baselines[1][0]:
baselines = baselines[1], baselines[0]
for idx in range(self.listWidget.count()): cp, tg = data.get_fictive_cp(*baselines)
item = self.listWidget.item(idx)
if item.checkState() == QtCore.Qt.Unchecked:
continue
key = item.data(QtCore.Qt.UserRole) plot[5].setData(cp.x, cp.y)
plot = self._plots[key] self._dsc[key] = (data, cp)
data, _ = self._dsc[key]
cp, tg = data.get_fictive_cp(*baselines) return cp
plot[5].setData(cp.x, cp.y) @QtCore.pyqtSlot(name='on_fit_tnhm_fitbutton_clicked')
self._dsc[key] = (data, cp)
self._tg_value[key]['fictive'] = (tg, 0)
self._update_tg_plots()
@QtCore.pyqtSlot(name='on_pushButton_3_clicked')
def make_tnmh(self): def make_tnmh(self):
baselines = tuple(lim.getRegion() for lim in self.limits) baselines = tuple(lim.getRegion() for lim in self.limits)
if baselines[0][0] > baselines[1][0]: if baselines[0][0] > baselines[1][0]:
baselines = baselines[1], baselines[0] baselines = baselines[1], baselines[0]
self.treeWidget_2.clear()
for idx in range(self.listWidget.count()): for idx in range(self.listWidget.count()):
item = self.listWidget.item(idx) item = self.listWidget.item(idx)
if item.checkState() == QtCore.Qt.Unchecked: if item.checkState() == QtCore.Qt.Unchecked:
continue continue
key = item.data(QtCore.Qt.UserRole) key = item.data(QtCore.Qt.UserRole)
plot = self._plots[key]
_, data = self._dsc[key]
if data is None: data = self.get_fictive(key, baselines)
continue
res = data.calculate_tnmh([60, 0.5, 1, 2e5], *baselines, return_fictive=False) res = data.calculate_tnmh([60, 0.5, 1, 2e5], *baselines, return_fictive=False)
self._fit[key] = res self._fit[key] = res
plot = self._plots[key]
plot[-1].setData(res.x, res.y) plot[-1].setData(res.x, res.y)
for idx in range(self.listWidget.count()):
item = self.listWidget.item(idx)
tree_item = QtWidgets.QTreeWidgetItem([item.text()])
values = self._fit.get(item.data(QtCore.Qt.UserRole))
if values is not None:
child_item = QtWidgets.QTreeWidgetItem([values.parameter_string()])
tree_item.addChild(child_item)
self.treeWidget_2.addTopLevelItem(tree_item)
@QtCore.pyqtSlot(name='on_pushButton_2_clicked')
def export_tnmh(self):
ret_dic = {}
for idx in range(self.listWidget.count()):
item = self.listWidget.item(idx)
if item.checkState() == QtCore.Qt.Unchecked:
continue
key = item.data(QtCore.Qt.UserRole)
if self.checkBox_13.isChecked():
_, cp = self._dsc[key]
else:
cp = None
if self.checkBox_14.isChecked():
line = self._fit[key]
else:
line = None
ret_dic[key] = (cp, line)
if self.new_graph_tnmh_check_2.isChecked():
ret_dic['graph'] = ''
else:
ret_dic['graph'] = self.new_graph_tnmh_combo_2.currentData()
self.newData.emit(ret_dic, 'tnmh')
@QtCore.pyqtSlot(name='on_toolButton_clicked')
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()):
item = self.listWidget.item(idx) item = self.listWidget.item(idx)
if item.checkState() == QtCore.Qt.Unchecked:
continue
key = item.data(QtCore.Qt.UserRole) key = item.data(QtCore.Qt.UserRole)
data, _ = self._dsc[key] data, _ = self._dsc[key]
try:
tg_value = self._tg_value[key][tg_type][0] tg_value = self._tg_value[key][tg_type][0]
if isnan(tg_value): if isnan(tg_value):
continue
except KeyError:
continue continue
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(fit.x, fit.y)
fitplots[1].setData(fit.x_data, fit.y_data)
self._hodge[tg_type] = (plot, data) self._hodge[tg_type] = (plot, data, fitplots, fit)
@QtCore.pyqtSlot(name='on_pushButton_4_clicked')
def export_hodge(self):
ret_dic2 = {}
for cb in (self.checkBox, self.checkBox_4, self.checkBox_6, self.checkBox_5, self.checkBox_7):
if cb.isChecked():
item = cb.text().lower()
data = self._hodge.get(item)
if data[1] is not None:
ret_dic2[item] = data[1]
if self.new_graph_tau_check.isChecked():
ret_dic2['graph'] = ''
else:
ret_dic2['graph'] = self.new_graph_tau_combo.currentData()
self.newData.emit(ret_dic2, 'hodge')
def close(self) -> bool: def close(self) -> bool:
self.clear() self.clear()
@ -287,13 +399,5 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
ret_dic[key] = (tg_pts, line) ret_dic[key] = (tg_pts, line)
ret_dic2 = []
for i in range(self.hodge_selection.count()):
if self.hodge_selection.isChecked(i):
item = self.hodge_selection.itemText(i).lower()
v = self._hodge.get(item)
ret_dic2.append(v[1])
self.newTg.emit(ret_dic, ret_dic2, graph_id) self.newTg.emit(ret_dic, ret_dic2, graph_id)
self.close() self.close()

View File

@ -1084,7 +1084,7 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
def report_bug(self): def report_bug(self):
import webbrowser import webbrowser
webbrowser.open('https://gitea.pkm.physik.tu-darmstadt.de/IPKM/nmreval/issues/new') webbrowser.open('https://gitea.pkm.physik.tu-darmstadt.de/IPKM-Public/nmreval/issues/new')
@QtCore.pyqtSlot(name='on_actionUpdate_triggered') @QtCore.pyqtSlot(name='on_actionUpdate_triggered')
def look_for_update(self): def look_for_update(self):
@ -1139,10 +1139,11 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
QtWidgets.QMessageBox.about(self, 'Version', f'Build date of AppImage: {__version__}') QtWidgets.QMessageBox.about(self, 'Version', f'Build date of AppImage: {__version__}')
@QtCore.pyqtSlot(name='on_actionTNMH_model_triggered') @QtCore.pyqtSlot(name='on_actionTNMH_model_triggered')
@QtCore.pyqtSlot(name='on_actionTNMH_triggered')
def show_tg_dialog(self): def show_tg_dialog(self):
if self._tg_dialog is None: if self._tg_dialog is None:
self._tg_dialog = TgCalculator(self.management, parent=self) self._tg_dialog = TgCalculator(self.management, parent=self)
self._tg_dialog.newTg.connect(self.management.addTg) self._tg_dialog.newData.connect(self.management.addTg)
else: else:
self._tg_dialog() self._tg_dialog()
self._tg_dialog.show() self._tg_dialog.show()

View File

@ -773,29 +773,51 @@ class UpperManagement(QtCore.QObject):
self.newData.emit(new_data, self.current_graph) self.newData.emit(new_data, self.current_graph)
@QtCore.pyqtSlot(dict, list, str) @QtCore.pyqtSlot(dict, str)
def addTg(self, dic1: dict, dic2: list, graph_id: str): def addTg(self, dic1: dict, dtype: str):
for k, (tg, lines) in dic1.items(): if dtype == 'tg':
p: ExperimentContainer = self[k] for k, (tg, lines) in dic1.items():
col = p.plot_real.linecolor p: ExperimentContainer = self[k]
col = p.plot_real.linecolor
tg_data_id = [] tg_data_id = []
if tg is not None: if tg is not None:
tg_data_id.append(self.add(tg, color=col)) tg_data_id.append(self.add(tg, color=col))
for line in lines: for line in lines:
set_id = self.add(line, color=col) set_id = self.add(line, color=col)
self[set_id].setLine(style=LineStyle.Dashed)
self[set_id].setSymbol(symbol=SymbolStyle.No)
tg_data_id.append(set_id)
self.newData.emit(tg_data_id, self.current_graph)
elif dtype == 'hodge':
set_id_list = []
graph_id = dic1.pop('graph')
for v in dic1.values():
set_id_list.append(self.add(v))
self.newData.emit(set_id_list, graph_id)
elif dtype == 'tnmh':
set_id_list = []
graph_id = dic1.pop('graph')
for k, (tg, fit) in dic1.items():
p: ExperimentContainer = self[k]
col = p.plot_real.linecolor
tg_data_id = []
if tg is not None:
set_id_list.append(self.add(tg, color=col))
set_id = self.add(fit, color=col)
self[set_id].setLine(style=LineStyle.Dashed) self[set_id].setLine(style=LineStyle.Dashed)
self[set_id].setSymbol(symbol=SymbolStyle.No) self[set_id].setSymbol(symbol=SymbolStyle.No)
tg_data_id.append(set_id) set_id_list.append(set_id)
self.newData.emit(tg_data_id, self.current_graph) self.newData.emit(set_id_list, graph_id)
set_id_list = []
for v in dic2:
set_id_list.append(self.add(v))
self.newData.emit(set_id_list, graph_id)
@QtCore.pyqtSlot(int, dict) @QtCore.pyqtSlot(int, dict)
def smooth_data(self, npoints, param_kwargs): def smooth_data(self, npoints, param_kwargs):

View File

@ -7,7 +7,7 @@ class BinningWindow(QtWidgets.QDialog):
layout = QtWidgets.QFormLayout() layout = QtWidgets.QFormLayout()
self.label = QtWidgets.QLabel('Bin width') self.label = QtWidgets.QLabel('Digits (negative values position left of decimal point)')
self.spinbox = QtWidgets.QLineEdit() self.spinbox = QtWidgets.QLineEdit()
self.spinbox.setValidator(QtGui.QDoubleValidator()) self.spinbox.setValidator(QtGui.QDoubleValidator())
self.spinbox.setText('1') self.spinbox.setText('1')

View File

@ -46,7 +46,6 @@ class DSC(Points):
regress2 = linregress(region.x[liquid_regime], region.y[liquid_regime]) regress2 = linregress(region.x[liquid_regime], region.y[liquid_regime])
region.y -= glass_extrapolation region.y -= glass_extrapolation
real_area = cumulative_trapezoid(region.y, region.x, initial=0) real_area = cumulative_trapezoid(region.y, region.x, initial=0)
real_area -= real_area[-1] real_area -= real_area[-1]
@ -99,10 +98,7 @@ class DSC(Points):
x = self.x[low_idx[0]:high_idx[1]] x = self.x[low_idx[0]:high_idx[1]]
y = self.y[low_idx[0]:high_idx[1]] y = self.y[low_idx[0]:high_idx[1]]
win_len = min(len(x) // 20, 51) yy = savgol_filter(y, window_length=min(len(x) // 20, 50), polyorder=1, deriv=1) / np.mean(np.diff(x))
if win_len % 2 == 0:
win_len += 1
yy = savgol_filter(y, window_length=win_len, polyorder=1, deriv=1) / np.mean(np.diff(x))
high_idx = (high_idx[0] - low_idx[0], high_idx[1] - low_idx[0]) high_idx = (high_idx[0] - low_idx[0], high_idx[1] - low_idx[0])
low_idx = (0, low_idx[1] - low_idx[0]) low_idx = (0, low_idx[1] - low_idx[0])

View File

@ -3,24 +3,25 @@ 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)
tg = np.asanyarray(tg) tg = np.asanyarray(tg)
fitter = FitRoutine() fitter = FitRoutine()
fitter.set_model(Arrhenius) fitter.set_model(Arrhenius)
d = fitter.add_data(tg, rate) d = fitter.add_data(1000/tg, rate, we='y')
init = linregress(1/tg, np.log(rate)) init = linregress(1000/tg, np.log(rate))
d.set_parameter([np.exp(init.intercept), init.slope*kB], fun_kwargs={'invt': None}) d.set_parameter([np.exp(init.intercept), 1000*init.slope*kB], fun_kwargs={'invt': 'invt1000'})
res = fitter.run()[0] res = fitter.run()[0]
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*60
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

@ -228,7 +228,7 @@ class FitResult(Points):
print(' #data :', self.nobs) print(' #data :', self.nobs)
print(' #var :', self.nvar) print(' #var :', self.nvar)
print('\nParameter') print('\nParameter')
print(self._parameter_string()) print(self.parameter_string())
if statistics: if statistics:
print('Statistics') print('Statistics')
@ -240,7 +240,7 @@ class FitResult(Points):
print(self._correlation_string()) print(self._correlation_string())
print() print()
def _parameter_string(self): def parameter_string(self):
ret_val = '' ret_val = ''
for pval in self.parameter.values(): for pval in self.parameter.values():

View File

@ -1032,7 +1032,7 @@
</action> </action>
<action name="actionTNMH_model"> <action name="actionTNMH_model">
<property name="text"> <property name="text">
<string>Tg determination,,,</string> <string>Tg , Hodge, TNMH,,,</string>
</property> </property>
</action> </action>
<action name="actionBinning"> <action name="actionBinning">
@ -1040,6 +1040,11 @@
<string>Binning...</string> <string>Binning...</string>
</property> </property>
</action> </action>
<action name="actionTNMH">
<property name="text">
<string>TNMH...</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View File

@ -1,299 +1,326 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>Dialog</class> <class>Wizard</class>
<widget class="QDialog" name="Dialog"> <widget class="QWizard" name="Wizard">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1042</width> <width>854</width>
<height>683</height> <height>619</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>SImba, everything the light touches is our kingdom</string> <string>Wizard</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <widget class="QWizardPage" name="wizardPage1">
<item row="5" column="1"> <property name="title">
<widget class="QDialogButtonBox" name="buttonBox"> <string>Glass transition</string>
<property name="orientation"> </property>
<enum>Qt::Horizontal</enum> <layout class="QGridLayout" name="gridLayout">
</property> <item row="2" column="0">
<property name="standardButtons"> <widget class="QTreeWidget" name="treeWidget">
<set>QDialogButtonBox::Close|QDialogButtonBox::Save</set> <attribute name="headerVisible">
</property> <bool>false</bool>
</widget> </attribute>
</item> <column>
<item row="0" column="0" rowspan="5">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Tg values:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string notr="true">1</string>
</property> </property>
<property name="alignment"> </column>
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="tg_value_label">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;TNMH parameter:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="1">
<widget class="QStackedWidget" name="stackedWidget">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="stackedWidgetPage1">
<layout class="QGridLayout" name="gridLayout_3">
<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">
<string>Inflection</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0" rowspan="7">
<widget class="PlotWidget" name="tau_plot">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="1">
<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">
<property name="text">
<string>Export lines</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="2">
<widget class="QComboBox" name="new_graph_tau_combo"/>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Hodge:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="new_graph_tau_check">
<property name="text">
<string>New graph</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget> </widget>
<widget class="QWidget" name="page"> </item>
<layout class="QGridLayout" name="gridLayout_2"> <item row="2" column="1">
<item row="1" column="1"> <layout class="QGridLayout" name="gridLayout_9">
<layout class="QHBoxLayout" name="horizontalLayout"> <item row="0" column="0">
<item> <widget class="QCheckBox" name="tg_export_check">
<widget class="QLabel" name="label_2"> <property name="text">
<property name="text"> <string>Export Tg</string>
<string>Tg for TNMH</string> </property>
</property> <property name="checked">
</widget> <bool>true</bool>
</item> </property>
<item> </widget>
<widget class="QComboBox" name="comboBox"> </item>
<item> <item row="3" column="0">
<property name="text"> <spacer name="verticalSpacer_3">
<string>Fictive</string> <property name="orientation">
</property> <enum>Qt::Vertical</enum>
</item> </property>
<item> <property name="sizeHint" stdset="0">
<property name="text"> <size>
<string>Onset</string> <width>20</width>
</property> <height>40</height>
</item> </size>
<item> </property>
<property name="text"> </spacer>
<string>Midpoint</string> </item>
</property> <item row="0" column="1">
</item> <widget class="QCheckBox" name="tglines_export_check">
<item> <property name="text">
<property name="text"> <string>Export lines</string>
<string>End</string> </property>
</property> <property name="checked">
</item> <bool>true</bool>
<item> </property>
<property name="text"> </widget>
<string>Inflection</string> </item>
</property> <item row="2" column="0" colspan="2">
</item> <widget class="QPushButton" name="pushButton">
</widget> <property name="text">
</item> <string>Export</string>
</layout> </property>
</item> </widget>
<item row="2" column="1"> </item>
<widget class="QPushButton" name="pushButton_3"> </layout>
<property name="text"> </item>
<string>Fit TNMH model</string> <item row="1" column="0" colspan="2">
</property> <widget class="PlotWidget" name="dsc_plot">
</widget> <property name="sizePolicy">
</item> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<item row="0" column="0" rowspan="3"> <horstretch>0</horstretch>
<widget class="PlotWidget" name="graphicsView_2"/> <verstretch>0</verstretch>
</item> </sizepolicy>
</layout> </property>
</widget> </widget>
</widget> </item>
</item> <item row="0" column="0" colspan="2">
<item row="0" column="1"> <widget class="QToolButton" name="calctg_button">
<widget class="PlotWidget" name="dsc_plot"> <property name="sizePolicy">
<property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <horstretch>0</horstretch>
<horstretch>0</horstretch> <verstretch>0</verstretch>
<verstretch>0</verstretch> </sizepolicy>
</sizepolicy> </property>
</property> <property name="text">
</widget> <string>Calculate Tg</string>
</item> </property>
<item row="2" column="1"> <property name="toolButtonStyle">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <enum>Qt::ToolButtonTextBesideIcon</enum>
<item> </property>
<widget class="QPushButton" name="calctg_button"> <property name="arrowType">
<property name="sizePolicy"> <enum>Qt::RightArrow</enum>
<sizepolicy hsizetype="Maximum" vsizetype="Fixed"> </property>
<horstretch>0</horstretch> </widget>
<verstretch>0</verstretch> </item>
</sizepolicy> </layout>
</property> </widget>
<widget class="QWizardPage" name="wizardPage2">
<property name="title">
<string>Hodge</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<widget class="QToolButton" name="toolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Calculate Hodge</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="arrowType">
<enum>Qt::RightArrow</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="PlotWidget" name="tghodge_graph"/>
</item>
<item row="2" column="1">
<widget class="PlotWidget" name="tau_plot">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_6">
<property name="text">
<string>End</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="new_graph_tau_check">
<property name="text">
<string>New graph</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBox_7">
<property name="text">
<string>Fictive</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBox_5">
<property name="text">
<string>Inflection</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="new_graph_tau_combo">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_4">
<property name="text">
<string>Midpoint</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Onset</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QPushButton" name="pushButton_4">
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWizardPage" name="wizardPage">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>TNMH</string>
</property>
<property name="subTitle">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0" colspan="2">
<widget class="QPushButton" name="fit_tnhm_fitbutton">
<property name="text">
<string>Fit TNMH model</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QTreeWidget" name="treeWidget_2">
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text"> <property name="text">
<string>Calculate Tg</string> <string notr="true">1</string>
</property> </property>
</widget> </column>
</item> </widget>
<item> </item>
<widget class="QPushButton" name="pushButton_2"> <item row="2" column="1">
<property name="sizePolicy"> <layout class="QGridLayout" name="gridLayout_5">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed"> <item row="1" column="0">
<horstretch>0</horstretch> <widget class="QCheckBox" name="new_graph_tnmh_check_2">
<verstretch>0</verstretch> <property name="text">
</sizepolicy> <string>New graph</string>
</property> </property>
<property name="text"> <property name="checked">
<string>Calculate fictive Cp</string> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="0">
<spacer name="horizontalSpacer"> <widget class="QCheckBox" name="checkBox_14">
<property name="orientation"> <property name="text">
<enum>Qt::Horizontal</enum> <string>Export fit</string>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="checked">
<size> <bool>true</bool>
<width>40</width> </property>
<height>20</height> </widget>
</size> </item>
</property> <item row="2" column="0" colspan="2">
</spacer> <widget class="QPushButton" name="pushButton_2">
</item> <property name="text">
</layout> <string>Export</string>
</item> </property>
</layout> </widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkBox_13">
<property name="text">
<string>Export dTf / dT</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="new_graph_tnmh_combo_2">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="PlotWidget" name="graphicsView_3"/>
</item>
</layout>
</widget>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
@ -301,45 +328,7 @@
<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/>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>