diff --git a/src/gui_qt/_py/dscfile_dialog.py b/src/gui_qt/_py/dscfile_dialog.py
index 3169e44..a0f3242 100644
--- a/src/gui_qt/_py/dscfile_dialog.py
+++ b/src/gui_qt/_py/dscfile_dialog.py
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'src/resources/_ui/dscfile_dialog.ui'
#
-# Created by: PyQt5 UI code generator 5.15.2
+# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
@@ -161,12 +161,12 @@ class Ui_Dialog(object):
self.buttonBox.setCenterButtons(True)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout_4.addWidget(self.buttonBox)
- self.widget1 = QtWidgets.QWidget(self.splitter)
- self.widget1.setObjectName("widget1")
- self.gridLayout = QtWidgets.QGridLayout(self.widget1)
+ self.layoutWidget = QtWidgets.QWidget(self.splitter)
+ self.layoutWidget.setObjectName("layoutWidget")
+ self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName("gridLayout")
- self.raw_graph = PlotWidget(self.widget1)
+ self.raw_graph = PlotWidget(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -175,7 +175,7 @@ class Ui_Dialog(object):
self.raw_graph.setMinimumSize(QtCore.QSize(300, 200))
self.raw_graph.setObjectName("raw_graph")
self.gridLayout.addWidget(self.raw_graph, 0, 0, 1, 1)
- self.calib_graph = PlotWidget(self.widget1)
+ self.calib_graph = PlotWidget(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -184,7 +184,7 @@ class Ui_Dialog(object):
self.calib_graph.setMinimumSize(QtCore.QSize(300, 200))
self.calib_graph.setObjectName("calib_graph")
self.gridLayout.addWidget(self.calib_graph, 1, 0, 1, 1)
- self.baseline_graph = PlotWidget(self.widget1)
+ self.baseline_graph = PlotWidget(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -193,7 +193,7 @@ class Ui_Dialog(object):
self.baseline_graph.setMinimumSize(QtCore.QSize(300, 200))
self.baseline_graph.setObjectName("baseline_graph")
self.gridLayout.addWidget(self.baseline_graph, 0, 1, 1, 1)
- self.end_graph = PlotWidget(self.widget1)
+ self.end_graph = PlotWidget(self.layoutWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -205,8 +205,8 @@ class Ui_Dialog(object):
self.verticalLayout_5.addWidget(self.splitter)
self.retranslateUi(Dialog)
- self.buttonBox.accepted.connect(Dialog.accept)
- self.buttonBox.rejected.connect(Dialog.reject)
+ self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
+ self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
@@ -221,7 +221,7 @@ class Ui_Dialog(object):
self.groupBox_5.setTitle(_translate("Dialog", "Slope correction"))
self.none_radioButton.setText(_translate("Dialog", "None"))
self.isotherm_radioButton.setText(_translate("Dialog", "Isotherms"))
- self.slope_radioButton.setText(_translate("Dialog", "Initial slope"))
+ self.slope_radioButton.setText(_translate("Dialog", "Curve slope"))
self.limit1_lineedit.setPlaceholderText(_translate("Dialog", "start (in min)"))
self.limit2_lineedit.setPlaceholderText(_translate("Dialog", "stop (in min)"))
self.groupBox_3.setTitle(_translate("Dialog", "References"))
diff --git a/src/nmreval/io/dsc.py b/src/nmreval/io/dsc.py
index be6cff4..ca72d3c 100644
--- a/src/nmreval/io/dsc.py
+++ b/src/nmreval/io/dsc.py
@@ -305,10 +305,11 @@ class DSCCalibrator:
drift_value = np.c_[drift_value, isotherm_sample]
if slope is not None:
- offset = sample_data[1, 200]
+
if slope == 'iso':
# calculate slope from difference between isotherms
m = (mean_isotherms[1] - mean_isotherms[0]) / (sample_data[2, -1] - sample_data[2, 0])
+ region = sample_data[1:, 200:201]
else:
# calculate mean slope of heat flow from points in the beginning
@@ -326,16 +327,17 @@ class DSCCalibrator:
if region is None:
# if no limits, use all
- region = sample_data[1:, :]
+ region = sample_data[1:, 200:-200]
grad = np.gradient(region[0, :], region[1, :])
grad = grad[~np.isnan(grad)]
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
+ offset = region[0, 0]
+ sample_data[1] -= m * (sample_data[2] - region[1, 0]) + offset
line = np.array([[sample_data[2, 0], sample_data[2, -1]],
- [m * (sample_data[2, 0] - sample_data[2, 200]) + offset,
- m * (sample_data[2, -1] - sample_data[2, 200]) + offset]])
+ [m * (sample_data[2, 0] - region[1, 0]) + offset,
+ m * (sample_data[2, -1] - region[1, 0]) + offset]])
else:
line = np.array([[sample_data[2, 0], sample_data[2, -1]], [0, 0]])
diff --git a/src/resources/_ui/dscfile_dialog.ui b/src/resources/_ui/dscfile_dialog.ui
index 2276ceb..c3ead1a 100644
--- a/src/resources/_ui/dscfile_dialog.ui
+++ b/src/resources/_ui/dscfile_dialog.ui
@@ -187,7 +187,7 @@
-
- Initial slope
+ Curve slope
buttonGroup
@@ -375,7 +375,7 @@
-
+
-