forked from IPKM/nmreval
Tg export finalized
This commit is contained in:
parent
032ffb72b1
commit
c9ea32629d
@ -42,6 +42,7 @@ class Ui_Dialog(object):
|
|||||||
self.label.setObjectName("label")
|
self.label.setObjectName("label")
|
||||||
self.verticalLayout.addWidget(self.label)
|
self.verticalLayout.addWidget(self.label)
|
||||||
self.tg_value_label = QtWidgets.QLabel(Dialog)
|
self.tg_value_label = QtWidgets.QLabel(Dialog)
|
||||||
|
self.tg_value_label.setText("")
|
||||||
self.tg_value_label.setObjectName("tg_value_label")
|
self.tg_value_label.setObjectName("tg_value_label")
|
||||||
self.verticalLayout.addWidget(self.tg_value_label)
|
self.verticalLayout.addWidget(self.tg_value_label)
|
||||||
self.label_4 = QtWidgets.QLabel(Dialog)
|
self.label_4 = QtWidgets.QLabel(Dialog)
|
||||||
@ -76,9 +77,11 @@ class Ui_Dialog(object):
|
|||||||
self.tau_plot.setObjectName("tau_plot")
|
self.tau_plot.setObjectName("tau_plot")
|
||||||
self.gridLayout_3.addWidget(self.tau_plot, 0, 0, 7, 1)
|
self.gridLayout_3.addWidget(self.tau_plot, 0, 0, 7, 1)
|
||||||
self.tg_export_check = QtWidgets.QCheckBox(self.stackedWidgetPage1)
|
self.tg_export_check = QtWidgets.QCheckBox(self.stackedWidgetPage1)
|
||||||
|
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_3.addWidget(self.tg_export_check, 2, 1, 1, 1)
|
||||||
self.tglines_export_check = QtWidgets.QCheckBox(self.stackedWidgetPage1)
|
self.tglines_export_check = QtWidgets.QCheckBox(self.stackedWidgetPage1)
|
||||||
|
self.tglines_export_check.setChecked(True)
|
||||||
self.tglines_export_check.setObjectName("tglines_export_check")
|
self.tglines_export_check.setObjectName("tglines_export_check")
|
||||||
self.gridLayout_3.addWidget(self.tglines_export_check, 2, 2, 1, 1)
|
self.gridLayout_3.addWidget(self.tglines_export_check, 2, 2, 1, 1)
|
||||||
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
@ -90,6 +93,7 @@ class Ui_Dialog(object):
|
|||||||
self.label_6.setObjectName("label_6")
|
self.label_6.setObjectName("label_6")
|
||||||
self.gridLayout_3.addWidget(self.label_6, 4, 1, 1, 1)
|
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 = QtWidgets.QCheckBox(self.stackedWidgetPage1)
|
||||||
|
self.new_graph_tau_check.setChecked(True)
|
||||||
self.new_graph_tau_check.setObjectName("new_graph_tau_check")
|
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_check, 5, 1, 1, 1)
|
||||||
self.line = QtWidgets.QFrame(self.stackedWidgetPage1)
|
self.line = QtWidgets.QFrame(self.stackedWidgetPage1)
|
||||||
@ -164,7 +168,6 @@ class Ui_Dialog(object):
|
|||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
Dialog.setWindowTitle(_translate("Dialog", "SImba, everything the light touches is our kingdom"))
|
Dialog.setWindowTitle(_translate("Dialog", "SImba, everything the light touches is our kingdom"))
|
||||||
self.label.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">Tg values:</span></p></body></html>"))
|
self.label.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">Tg values:</span></p></body></html>"))
|
||||||
self.tg_value_label.setText(_translate("Dialog", "TextLabel"))
|
|
||||||
self.label_4.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">TNMH parameter:</span></p></body></html>"))
|
self.label_4.setText(_translate("Dialog", "<html><head/><body><p><span style=\" font-weight:600;\">TNMH parameter:</span></p></body></html>"))
|
||||||
self.hodge_selection.setItemText(0, _translate("Dialog", "Onset"))
|
self.hodge_selection.setItemText(0, _translate("Dialog", "Onset"))
|
||||||
self.hodge_selection.setItemText(1, _translate("Dialog", "Midpoint"))
|
self.hodge_selection.setItemText(1, _translate("Dialog", "Midpoint"))
|
||||||
|
@ -317,7 +317,7 @@ class ExperimentContainer(QtCore.QObject):
|
|||||||
if mode in ['imag', 'all'] and self.plot_imag is not None:
|
if mode in ['imag', 'all'] and self.plot_imag is not None:
|
||||||
self.plot_imag.set_color(color, symbol=symbol, line=line)
|
self.plot_imag.set_color(color, symbol=symbol, line=line)
|
||||||
|
|
||||||
def setSymbol(self, symbol=None, color=None, size=None, mode='real'):
|
def setSymbol(self, *, symbol=None, color=None, size=None, mode='real'):
|
||||||
if mode in ['real', 'all']:
|
if mode in ['real', 'all']:
|
||||||
self.plot_real.set_symbol(symbol=symbol, size=size, color=color)
|
self.plot_real.set_symbol(symbol=symbol, size=size, color=color)
|
||||||
if color is not None and self.plot_error is not None and self.plot_real.symbol != SymbolStyle.No:
|
if color is not None and self.plot_error is not None and self.plot_real.symbol != SymbolStyle.No:
|
||||||
@ -329,7 +329,7 @@ class ExperimentContainer(QtCore.QObject):
|
|||||||
else:
|
else:
|
||||||
print('Updating symbol failed for ' + str(self.id))
|
print('Updating symbol failed for ' + str(self.id))
|
||||||
|
|
||||||
def setLine(self, width=None, style=None, color=None, mode='real'):
|
def setLine(self, *, width=None, style=None, color=None, mode='real'):
|
||||||
if mode in ['real', 'all']:
|
if mode in ['real', 'all']:
|
||||||
self.plot_real.set_line(width=width, style=style, color=color)
|
self.plot_real.set_line(width=width, style=style, color=color)
|
||||||
if color is not None and self.plot_error is not None and self.plot_real.symbol == SymbolStyle.No:
|
if color is not None and self.plot_error is not None and self.plot_real.symbol == SymbolStyle.No:
|
||||||
|
@ -14,7 +14,7 @@ from nmreval.data import DSC, Points
|
|||||||
|
|
||||||
|
|
||||||
class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
|
class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
|
||||||
newTg = QtCore.pyqtSignal(dict, dict, str)
|
newTg = QtCore.pyqtSignal(dict, list, str)
|
||||||
|
|
||||||
def __init__(self, management, parent=None):
|
def __init__(self, management, parent=None):
|
||||||
super().__init__(parent=parent)
|
super().__init__(parent=parent)
|
||||||
@ -30,7 +30,7 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
self._lines = {}
|
self._lines = {}
|
||||||
self._hodge = {
|
self._hodge = {
|
||||||
'onset': (PlotItem(x=[], y=[], pen=None, symbol='o', symbolBrush=Tab10.TabBlue.rgb(), name='Onset'), None),
|
'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),
|
'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),
|
'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),
|
'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'),
|
# 'fictive': PlotItem(x=[], y=[], pen=None, symbol='t1', symbolBrush=Tab10.TabPurple.rgb(), name='Fictive'),
|
||||||
@ -40,6 +40,9 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
for plt, _ in self._hodge.values():
|
for plt, _ in self._hodge.values():
|
||||||
self.tau_plot.addItem(plt)
|
self.tau_plot.addItem(plt)
|
||||||
self.tau_plot.setLogMode(y=True)
|
self.tau_plot.setLogMode(y=True)
|
||||||
|
self.pushButton_2.hide()
|
||||||
|
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:
|
||||||
@ -253,6 +256,7 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
if len(m) > 1:
|
if len(m) > 1:
|
||||||
data = tau_hodge(*array(m).T)
|
data = tau_hodge(*array(m).T)
|
||||||
|
data.name = f'{data.name} ({tg_type.capitalize()})'
|
||||||
plot.setData(data.x, data.y)
|
plot.setData(data.x, data.y)
|
||||||
|
|
||||||
self._hodge[tg_type] = (plot, data)
|
self._hodge[tg_type] = (plot, data)
|
||||||
@ -271,15 +275,25 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
for key, tg in self._tg_value.items():
|
for key, tg in self._tg_value.items():
|
||||||
tgx = [x for x, y in tg.values()]
|
tgx = [x for x, y in tg.values()]
|
||||||
tgy = [y for x, y in tg.values()]
|
tgy = [y for x, y in tg.values()]
|
||||||
tg_pts = Points(x=tgx, y=tgy, name=self._management[key].name, value=self._management[key].value)
|
if self.tg_export_check.isChecked():
|
||||||
ret_dic[key] = (
|
tg_pts = Points(x=tgx, y=tgy, name=self._management[key].name + ' (Tg)', value=self._management[key].value)
|
||||||
tg_pts,
|
else:
|
||||||
self._lines[key],
|
tg_pts = None
|
||||||
)
|
|
||||||
|
|
||||||
ret_dic2 = {}
|
if self.tglines_export_check.isChecked():
|
||||||
for k, (_, v) in self._hodge.items():
|
line = self._lines[key]
|
||||||
ret_dic2[k] = v
|
else:
|
||||||
|
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()
|
||||||
|
@ -280,7 +280,7 @@ class PlotItem(PlotDataItem):
|
|||||||
else:
|
else:
|
||||||
self.scatter.hide()
|
self.scatter.hide()
|
||||||
|
|
||||||
def set_symbol(self, symbol=None, size=None, color=None):
|
def set_symbol(self, *, symbol=None, size=None, color=None):
|
||||||
if symbol is not None:
|
if symbol is not None:
|
||||||
if isinstance(symbol, int):
|
if isinstance(symbol, int):
|
||||||
self.setSymbol(SymbolStyle(symbol).to_str())
|
self.setSymbol(SymbolStyle(symbol).to_str())
|
||||||
@ -314,7 +314,7 @@ class PlotItem(PlotDataItem):
|
|||||||
self.opts['pen'] = pen
|
self.opts['pen'] = pen
|
||||||
self.updateItems()
|
self.updateItems()
|
||||||
|
|
||||||
def set_line(self, style=None, width=None, color=None):
|
def set_line(self, *, style=None, width=None, color=None):
|
||||||
pen = self.opts['pen']
|
pen = self.opts['pen']
|
||||||
if pen is None:
|
if pen is None:
|
||||||
pen = mkPen(style=QtCore.Qt.NoPen)
|
pen = mkPen(style=QtCore.Qt.NoPen)
|
||||||
|
@ -773,21 +773,29 @@ class UpperManagement(QtCore.QObject):
|
|||||||
|
|
||||||
self.newData.emit(new_data, self.current_graph)
|
self.newData.emit(new_data, self.current_graph)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(dict, dict, str)
|
@QtCore.pyqtSlot(dict, list, str)
|
||||||
def addTg(self, dic1: dict, dic2: dict, graph_id: str):
|
def addTg(self, dic1: dict, dic2: list, graph_id: str):
|
||||||
for k, v in dic1.items():
|
for k, (tg, lines) in dic1.items():
|
||||||
p: ExperimentContainer = self[k]
|
p: ExperimentContainer = self[k]
|
||||||
col = p.plot_real.linecolor
|
col = p.plot_real.linecolor
|
||||||
set_id = self.add(v[0], color=col)
|
|
||||||
self.newData.emit([set_id], self.current_graph)
|
tg_data_id = []
|
||||||
for line in v[1]:
|
|
||||||
|
if tg is not None:
|
||||||
|
tg_data_id.append(self.add(tg, color=col))
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
set_id = self.add(line, color=col)
|
set_id = self.add(line, color=col)
|
||||||
self.newData.emit([set_id], self.current_graph)
|
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)
|
||||||
|
|
||||||
set_id_list = []
|
set_id_list = []
|
||||||
for v in dic2.values():
|
for v in dic2:
|
||||||
set_id_list.append(self.add(v))
|
set_id_list.append(self.add(v))
|
||||||
self.newData.emit(set_id_list, '')
|
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):
|
||||||
|
@ -121,13 +121,13 @@ class DSC(Points):
|
|||||||
midpoint = np.argmin(np.abs(y - 0.5 * (liquid_baseline[end] - glass_baseline[onset])))
|
midpoint = np.argmin(np.abs(y - 0.5 * (liquid_baseline[end] - glass_baseline[onset])))
|
||||||
cut_tangent = np.where((tangent_line > y.min() - 1) & (tangent_line < y.max() + 1))
|
cut_tangent = np.where((tangent_line > y.min() - 1) & (tangent_line < y.max() + 1))
|
||||||
|
|
||||||
glass = Points(x, glass_baseline, name='Glass baseline', value=self.value)
|
glass = Points(x, glass_baseline, name=f'Glass baseline ({self.name})', value=self.value)
|
||||||
tangent = Points(x[cut_tangent], tangent_line[cut_tangent], name='Tangent', value=self.value)
|
tangent = Points(x[cut_tangent], tangent_line[cut_tangent], name=f'Tangent ({self.name})', value=self.value)
|
||||||
liquid = Points(x, liquid_baseline, name='Liquid baseline', value=self.value)
|
liquid = Points(x, liquid_baseline, name=f'Liquid baseline ({self.name})', value=self.value)
|
||||||
|
|
||||||
ret_dic = {
|
ret_dic = {
|
||||||
'onset': (x[onset], glass_baseline[onset]),
|
'onset': (x[onset], glass_baseline[onset]),
|
||||||
'mid': (x[midpoint], y[midpoint]),
|
'midpoint': (x[midpoint], y[midpoint]),
|
||||||
'end': (x[end], liquid_baseline[end]),
|
'end': (x[end], liquid_baseline[end]),
|
||||||
'inflection': (x[inflection], y[inflection]),
|
'inflection': (x[inflection], y[inflection]),
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="tg_value_label">
|
<widget class="QLabel" name="tg_value_label">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -127,6 +127,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Export Tg</string>
|
<string>Export Tg</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="2" column="2">
|
||||||
@ -134,6 +137,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Export lines</string>
|
<string>Export lines</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2">
|
<item row="6" column="2">
|
||||||
@ -164,6 +170,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>New graph</string>
|
<string>New graph</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1" colspan="2">
|
<item row="3" column="1" colspan="2">
|
||||||
|
Loading…
Reference in New Issue
Block a user