added tnmh; some bugfixes
This commit is contained in:
@ -87,8 +87,8 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
|
||||
|
||||
self.add_sets()
|
||||
|
||||
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_tnmh_combo_2.setEnabled(not bool(state)))
|
||||
|
||||
def __call__(self):
|
||||
self.clear()
|
||||
@ -119,6 +119,7 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
|
||||
self.new_graph_tau_combo.clear()
|
||||
for graphs in self._management.graphs.list():
|
||||
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
|
||||
max_x = -10_000_000
|
||||
@ -157,11 +158,11 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
|
||||
self.dsc_plot.addItem(tg_plot)
|
||||
|
||||
fictive_cp = PlotItem(pen=mkPen(c.rgb()))
|
||||
# self.graphicsView_2.addItem(fictive_cp)
|
||||
self.graphicsView_3.addItem(fictive_cp)
|
||||
|
||||
tnmh_fit = PlotItem()
|
||||
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._tg_value[key] = {
|
||||
@ -251,29 +252,16 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
|
||||
for val in plot:
|
||||
val.setVisible(is_checked)
|
||||
|
||||
@QtCore.pyqtSlot(name='on_pushButton_2_clicked')
|
||||
def get_fictive(self):
|
||||
baselines = tuple(lim.getRegion() for lim in self.limits)
|
||||
if baselines[0][0] > baselines[1][0]:
|
||||
baselines = baselines[1], baselines[0]
|
||||
def get_fictive(self, key, baselines):
|
||||
plot = self._plots[key]
|
||||
data, _ = self._dsc[key]
|
||||
|
||||
for idx in range(self.listWidget.count()):
|
||||
item = self.listWidget.item(idx)
|
||||
if item.checkState() == QtCore.Qt.Unchecked:
|
||||
continue
|
||||
cp, tg = data.get_fictive_cp(*baselines)
|
||||
|
||||
key = item.data(QtCore.Qt.UserRole)
|
||||
plot = self._plots[key]
|
||||
data, _ = self._dsc[key]
|
||||
plot[5].setData(cp.x, cp.y)
|
||||
self._dsc[key] = (data, cp)
|
||||
|
||||
cp, tg = data.get_fictive_cp(*baselines)
|
||||
|
||||
plot[5].setData(cp.x, cp.y)
|
||||
self._dsc[key] = (data, cp)
|
||||
|
||||
self._tg_value[key]['fictive'] = (tg, 0)
|
||||
|
||||
self._update_tg_plots()
|
||||
return cp
|
||||
|
||||
@QtCore.pyqtSlot(name='on_fit_tnhm_fitbutton_clicked')
|
||||
def make_tnmh(self):
|
||||
@ -281,22 +269,62 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
|
||||
if baselines[0][0] > baselines[1][0]:
|
||||
baselines = baselines[1], baselines[0]
|
||||
|
||||
self.treeWidget_2.clear()
|
||||
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)
|
||||
plot = self._plots[key]
|
||||
_, data = self._dsc[key]
|
||||
|
||||
if data is None:
|
||||
continue
|
||||
data = self.get_fictive(key, baselines)
|
||||
|
||||
res = data.calculate_tnmh([60, 0.5, 1, 2e5], *baselines, return_fictive=False)
|
||||
self._fit[key] = res
|
||||
|
||||
plot = self._plots[key]
|
||||
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):
|
||||
for tg_type, (plot, data, fitplots, fit) in self._hodge.items():
|
||||
@ -334,15 +362,14 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
|
||||
for cb in (self.checkBox, self.checkBox_4, self.checkBox_6, self.checkBox_5, self.checkBox_7):
|
||||
if cb.isChecked():
|
||||
item = cb.text().lower()
|
||||
v = self._hodge.get(item)
|
||||
ret_dic2[item] = v[1]
|
||||
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'] = self.new_graph_tau_combo.currentData()
|
||||
else:
|
||||
ret_dic2['graph'] = ''
|
||||
|
||||
print(ret_dic2)
|
||||
else:
|
||||
ret_dic2['graph'] = self.new_graph_tau_combo.currentData()
|
||||
|
||||
self.newData.emit(ret_dic2, 'hodge')
|
||||
|
||||
|
Reference in New Issue
Block a user