closes #53

Co-authored-by: Dominik Demuth <dominik.demuth@physik.tu-darmstadt.de>
Reviewed-on: #55
This commit is contained in:
2023-04-30 18:21:16 +00:00
parent 7671a56b6f
commit d8cc99cea4
10 changed files with 626 additions and 1066 deletions

View File

@ -97,7 +97,7 @@ class QDSCReader(QtWidgets.QDialog, Ui_Dialog):
if empty:
self.empty = self.calibrator.set_measurement(empty, mode='empty')
self.empty_label.setText(str(self.empty.fname.name))
self.empty_label.setText('~/' + str(self.empty.fname.relative_to(Path.home())))
self.update_plots()
@ -158,20 +158,28 @@ class QDSCReader(QtWidgets.QDialog, Ui_Dialog):
self.sample_idx = None
self.clear_plots()
def get_data(self, ):
def get_data(self):
if self.sample_idx is None:
return
rate = self.current_run[0]
slope_type = {self.none_radioButton: None,
self.isotherm_radioButton: 'iso',
self.slope_radioButton: 'curve'}[self.buttonGroup.checkedButton()]
slope_type = {
self.none_radioButton: None,
self.isotherm_radioButton: 'iso',
self.slope_radioButton: 'curve',
}[self.buttonGroup.checkedButton()]
limit = None
if slope_type == 'curve':
try:
limit = float(self.limit1_lineedit.text())*60, float(self.limit2_lineedit.text())*60
except ValueError:
limit = None
try:
raw_sample, drift_value, sample_data, empty_data, slope = self.calibrator.get_data(self.sample_idx,
slope=slope_type)
raw_sample, drift_value, sample_data, empty_data, slope = self.calibrator.get_data(self.sample_idx, slope=slope_type, limits=limit)
except ValueError as e:
_msg = QtWidgets.QMessageBox.warning(self, 'No rate found', e.args[0])
_msg = QtWidgets.QMessageBox.warning(self, f'Data collection with error', e.args[0])
return
self.calibrator.ref_list = []
@ -194,6 +202,8 @@ class QDSCReader(QtWidgets.QDialog, Ui_Dialog):
@QtCore.pyqtSlot(QtWidgets.QAbstractButton, name='on_buttonGroup_buttonClicked')
@QtCore.pyqtSlot(int, name='on_cp_checkBox_stateChanged')
@QtCore.pyqtSlot(str, name='on_limit1_lineedit_textChanged')
@QtCore.pyqtSlot(str, name='on_limit2_lineedit_textChanged')
def update_plots(self, _=None):
res = self.get_data()
if res is None:
@ -254,7 +264,7 @@ class QDSCReader(QtWidgets.QDialog, Ui_Dialog):
def button_clicked(self, bttn: QtWidgets.QAbstractButton):
bttn_value = self.buttonBox.standardButton(bttn)
if bttn_value in (self.buttonBox.Ok, self.buttonBox.Apply, self.buttonBox.Save):
self.export_data(filesave=bttn_value==self.buttonBox.Save, close_after=bttn_value==self.buttonBox.Ok)
self.export_data(filesave=bttn_value == self.buttonBox.Save, close_after=bttn_value == self.buttonBox.Ok)
else:
super().close()