start tg saving

This commit is contained in:
Dominik Demuth 2023-06-15 17:24:35 +02:00
parent 988d2ccbda
commit 7732544f69
7 changed files with 133 additions and 78 deletions

View File

@ -258,11 +258,11 @@ class Ui_ascii_reader(object):
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setContentsMargins(-1, 0, -1, -1)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem4)
self.skippy_checkbox = QtWidgets.QCheckBox(ascii_reader)
self.skippy_checkbox.setObjectName("skippy_checkbox")
self.horizontalLayout_2.addWidget(self.skippy_checkbox)
spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem4)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.buttonbox = QtWidgets.QDialogButtonBox(ascii_reader)
self.buttonbox.setStandardButtons(QtWidgets.QDialogButtonBox.Apply|QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
@ -274,8 +274,7 @@ class Ui_ascii_reader(object):
self.buttonbox.rejected.connect(ascii_reader.close) # type: ignore
QtCore.QMetaObject.connectSlotsByName(ascii_reader)
ascii_reader.setTabOrder(self.tabWidget, self.ascii_table)
ascii_reader.setTabOrder(self.ascii_table, self.skippy_checkbox)
ascii_reader.setTabOrder(self.skippy_checkbox, self.delay_textfield)
ascii_reader.setTabOrder(self.ascii_table, self.delay_textfield)
ascii_reader.setTabOrder(self.delay_textfield, self.delay_lineedit)
ascii_reader.setTabOrder(self.delay_lineedit, self.start_lineedit)
ascii_reader.setTabOrder(self.start_lineedit, self.end_lineedit)

View File

@ -370,6 +370,8 @@ class Ui_BaseWindow(object):
self.actionAbout.setObjectName("actionAbout")
self.actionTNMH_model = QtWidgets.QAction(BaseWindow)
self.actionTNMH_model.setObjectName("actionTNMH_model")
self.actionBinning = QtWidgets.QAction(BaseWindow)
self.actionBinning.setObjectName("actionBinning")
self.menuSave.addAction(self.actionSave)
self.menuSave.addAction(self.actionExportGraphic)
self.menuSave.addAction(self.action_save_fit_parameter)
@ -413,6 +415,7 @@ class Ui_BaseWindow(object):
self.menuExtra.addSeparator()
self.menuExtra.addAction(self.menuNormalize.menuAction())
self.menuExtra.addAction(self.actionInterpolation)
self.menuExtra.addAction(self.actionBinning)
self.menuExtra.addAction(self.actionRunning_values)
self.menuExtra.addAction(self.actionShift)
self.menuExtra.addSeparator()
@ -634,7 +637,8 @@ class Ui_BaseWindow(object):
self.actionShow_error_log.setText(_translate("BaseWindow", "Show error log"))
self.actionCreate_starter.setText(_translate("BaseWindow", "Create starter.."))
self.actionAbout.setText(_translate("BaseWindow", "About..."))
self.actionTNMH_model.setText(_translate("BaseWindow", "TNMH model..."))
self.actionTNMH_model.setText(_translate("BaseWindow", "Tg determination,,,"))
self.actionBinning.setText(_translate("BaseWindow", "Binning..."))
from ..data.datawidget.datawidget import DataWidget
from ..data.integral_widget import IntegralWidget
from ..data.point_select import PointSelectWidget

View File

@ -19,9 +19,9 @@ class Ui_Dialog(object):
self.gridLayout.setObjectName("gridLayout")
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Save)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 3, 1, 1, 1)
self.gridLayout.addWidget(self.buttonBox, 5, 1, 1, 1)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.listWidget = QtWidgets.QListWidget(Dialog)
@ -51,15 +51,7 @@ class Ui_Dialog(object):
self.label_5.setText("")
self.label_5.setObjectName("label_5")
self.verticalLayout.addWidget(self.label_5)
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 3, 1)
self.dsc_plot = PlotWidget(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.dsc_plot.sizePolicy().hasHeightForWidth())
self.dsc_plot.setSizePolicy(sizePolicy)
self.dsc_plot.setObjectName("dsc_plot")
self.gridLayout.addWidget(self.dsc_plot, 0, 1, 1, 1)
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)
@ -110,9 +102,6 @@ class Ui_Dialog(object):
self.page.setObjectName("page")
self.gridLayout_2 = QtWidgets.QGridLayout(self.page)
self.gridLayout_2.setObjectName("gridLayout_2")
self.pushButton_2 = QtWidgets.QPushButton(self.page)
self.pushButton_2.setObjectName("pushButton_2")
self.gridLayout_2.addWidget(self.pushButton_2, 0, 1, 1, 1)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_2 = QtWidgets.QLabel(self.page)
@ -134,7 +123,17 @@ class Ui_Dialog(object):
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, 2, 1, 1, 1)
self.gridLayout.addWidget(self.stackedWidget, 4, 1, 1, 1)
self.dsc_plot = PlotWidget(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.dsc_plot.sizePolicy().hasHeightForWidth())
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)
sizePolicy.setHorizontalStretch(0)
@ -142,7 +141,18 @@ class Ui_Dialog(object):
sizePolicy.setHeightForWidth(self.calctg_button.sizePolicy().hasHeightForWidth())
self.calctg_button.setSizePolicy(sizePolicy)
self.calctg_button.setObjectName("calctg_button")
self.gridLayout.addWidget(self.calctg_button, 1, 1, 1, 1)
self.horizontalLayout_2.addWidget(self.calctg_button)
self.pushButton_2 = QtWidgets.QPushButton(Dialog)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
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)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem1)
self.gridLayout.addLayout(self.horizontalLayout_2, 2, 1, 1, 1)
self.retranslateUi(Dialog)
self.stackedWidget.setCurrentIndex(0)
@ -164,7 +174,6 @@ class Ui_Dialog(object):
self.tglines_export_check.setText(_translate("Dialog", "Export lines"))
self.label_6.setText(_translate("Dialog", "Hodge:"))
self.new_graph_tau_check.setText(_translate("Dialog", "New graph"))
self.pushButton_2.setText(_translate("Dialog", "Fictive Cp"))
self.label_2.setText(_translate("Dialog", "Tg for TNMH"))
self.comboBox.setItemText(0, _translate("Dialog", "Fictive"))
self.comboBox.setItemText(1, _translate("Dialog", "Onset"))
@ -173,5 +182,6 @@ class Ui_Dialog(object):
self.comboBox.setItemText(4, _translate("Dialog", "Inflection"))
self.pushButton_3.setText(_translate("Dialog", "Fit TNMH model"))
self.calctg_button.setText(_translate("Dialog", "Calculate Tg"))
self.pushButton_2.setText(_translate("Dialog", "Calculate fictive Cp"))
from ..lib.forms import CheckCombobox
from pyqtgraph import PlotWidget

View File

@ -24,16 +24,16 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
self._plots = {}
self._tg_value = {}
self._fit = {}
self._hodge_plots = {
'onset': PlotItem(x=[], y=[], pen=None, symbol='o', symbolBrush=Tab10.TabBlue.rgb(), name='Onset'),
'mid': PlotItem(x=[], y=[], pen=None, symbol='s', symbolBrush=Tab10.TabOrange.rgb(), name='Midpoint'),
'end': PlotItem(x=[], y=[], pen=None, symbol='t', symbolBrush=Tab10.TabGreen.rgb(), name='End'),
'inflection': PlotItem(x=[], y=[], pen=None, symbol='d', symbolBrush=Tab10.TabRed.rgb(), name='Inflection'),
self._hodge = {
'onset': (PlotItem(x=[], y=[], pen=None, symbol='o', symbolBrush=Tab10.TabBlue.rgb(), name='Onset'), None),
'mid': (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),
# '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.tau_plot.getPlotItem().addLegend()
for plt in self._hodge_plots.values():
for plt, _ in self._hodge.values():
self.tau_plot.addItem(plt)
self.tau_plot.setLogMode(y=True)
@ -46,18 +46,14 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
self.listWidget.itemClicked.connect(self.show_tg_values)
# for x in self._hodge_plots:
# self.hodge_selection.addItem(x)
self.new_graph_tau_combo.setEnabled(False)
self.new_graph_tau_check.stateChanged.connect(lambda state: self.new_graph_tau_combo.setEnabled(bool(state)))
def __call__(self):
print('call')
self.clear()
self._colors = cycle(Tab10)
self.add_sets()
for g in self._management.graphs.list():
print(g)
return self
def clear(self):
@ -67,16 +63,19 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
self.dsc_plot.removeItem(val)
self.graphicsView_2.removeItem(val)
for plt in self._hodge_plots.values():
for plt in self._hodge.values():
plt.setData(x=[], y=[])
self._dsc = {}
self._plots = {}
self._tg_value = {}
self._fit = {}
self.gra
def add_sets(self):
self.new_graph_tau_combo.clear()
for graphs in self._management.graphs.list():
self.new_graph_tau_combo.addItem(graphs[1], userData=graphs[0])
min_x = 10_000_000
max_x = -10_000_000
for (key, name), c in zip(self._management.active_sets, self._colors):
@ -230,7 +229,8 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
plot[-1].setData(res.x, res.y)
def hodge(self):
for tg_type, plot in self._hodge_plots.items():
for tg_type, (plot, data) in self._hodge.items():
m = []
for idx in range(self.listWidget.count()):
item = self.listWidget.item(idx)
@ -245,9 +245,23 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
m.append([tg_value, data.value])
if len(m) > 1:
r = tau_hodge(*array(m).T)
plot.setData(r.x, r.y)
data = tau_hodge(*array(m).T)
plot.setData(data.x, data.y)
def close(self) -> bool:
self.clear()
return super().close()
def accept(self) -> None:
if self.new_graph_tau_check.isChecked():
graph_id = ''
else:
graph_id = self.new_graph_tau_combo.currentData()
print(graph_id)
print(self._tg_value)
print(self._hodge)
for v in self._plots.values():
# (data_plot, tg_plot, glass, liquid, tangent, fictive_cp, tnmh_fit)
print(v.getData())
print(self._plots)

View File

@ -512,16 +512,6 @@
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="skippy_checkbox">
<property name="toolTip">
<string>Use selection for next files. Deletes possible delay values.</string>
</property>
<property name="text">
<string>Skip next dialogues?</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
@ -535,6 +525,16 @@
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="skippy_checkbox">
<property name="toolTip">
<string>Use selection for next files. Deletes possible delay values.</string>
</property>
<property name="text">
<string>Skip next dialogues?</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -557,7 +557,6 @@
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>ascii_table</tabstop>
<tabstop>skippy_checkbox</tabstop>
<tabstop>delay_textfield</tabstop>
<tabstop>delay_lineedit</tabstop>
<tabstop>start_lineedit</tabstop>

View File

@ -222,6 +222,7 @@
<addaction name="separator"/>
<addaction name="menuNormalize"/>
<addaction name="actionInterpolation"/>
<addaction name="actionBinning"/>
<addaction name="actionRunning_values"/>
<addaction name="actionShift"/>
<addaction name="separator"/>
@ -1031,7 +1032,12 @@
</action>
<action name="actionTNMH_model">
<property name="text">
<string>TNMH model...</string>
<string>Tg determination,,,</string>
</property>
</action>
<action name="actionBinning">
<property name="text">
<string>Binning...</string>
</property>
</action>
</widget>

View File

@ -14,17 +14,17 @@
<string>SImba, everything the light touches is our kingdom</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1">
<item row="5" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Save</set>
<set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="3">
<item row="0" column="0" rowspan="5">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="listWidget">
@ -75,17 +75,7 @@
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="PlotWidget" name="dsc_plot">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="4" column="1">
<widget class="QStackedWidget" name="stackedWidget">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@ -187,13 +177,6 @@
</widget>
<widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Fictive Cp</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@ -248,19 +231,59 @@
</widget>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="calctg_button">
<item row="0" column="1">
<widget class="PlotWidget" name="dsc_plot">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Calculate Tg</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="calctg_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Calculate Tg</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Calculate fictive Cp</string>
</property>
</widget>
</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>
</item>
</layout>
</widget>
<customwidgets>