1
0
forked from IPKM/nmreval

DSC: remove non-finite values due mismatch in beginnings of sample and empty

This commit is contained in:
Dominik Demuth 2023-04-24 19:24:23 +02:00
parent eba7869c4d
commit ac4a4d3b8e
2 changed files with 8 additions and 1 deletions

View File

@ -195,7 +195,11 @@ class QDSCReader(QtWidgets.QDialog, Ui_Dialog):
@QtCore.pyqtSlot(QtWidgets.QAbstractButton, name='on_buttonGroup_buttonClicked') @QtCore.pyqtSlot(QtWidgets.QAbstractButton, name='on_buttonGroup_buttonClicked')
@QtCore.pyqtSlot(int, name='on_cp_checkBox_stateChanged') @QtCore.pyqtSlot(int, name='on_cp_checkBox_stateChanged')
def update_plots(self, _=None): def update_plots(self, _=None):
sample_data, raw_sample, empty_data, drift_value, slope, calib_x, calib_y, regions = self.get_data() res = self.get_data()
if res is None:
return
sample_data, raw_sample, empty_data, drift_value, slope, calib_x, calib_y, regions = res
self.raw_sample.setData(x=raw_sample[0], y=raw_sample[1]) self.raw_sample.setData(x=raw_sample[0], y=raw_sample[1])
self.drift_sample.setData(x=drift_value[0], y=drift_value[1]) self.drift_sample.setData(x=drift_value[0], y=drift_value[1])

View File

@ -284,6 +284,7 @@ class DSCCalibrator:
sample_data[1] -= empty_y sample_data[1] -= empty_y
drift_value = sample_data.copy()[(2, 1), :] drift_value = sample_data.copy()[(2, 1), :]
sample_data = sample_data[:, np.isfinite(sample_data[1, :])]
mean_isotherms = [] mean_isotherms = []
for offset in [-1, 1]: for offset in [-1, 1]:
@ -311,6 +312,8 @@ class DSCCalibrator:
# calculate mean slope of heat flow from points in the beginning # calculate mean slope of heat flow from points in the beginning
offset = sample_data[1, 200] offset = sample_data[1, 200]
grad = np.gradient(sample_data[1, :], sample_data[2, :]) grad = np.gradient(sample_data[1, :], sample_data[2, :])
grad = grad[~np.isnan(grad)]
m = grad[(grad < grad.mean()+grad.std()/5)*(grad > grad.mean()-grad.std()/5)].mean() m = grad[(grad < grad.mean()+grad.std()/5)*(grad > grad.mean()-grad.std()/5)].mean()
sample_data[1] -= m * (sample_data[2] - sample_data[2, 200]) + offset sample_data[1] -= m * (sample_data[2] - sample_data[2, 200]) + offset