From ef21d7c7f2d640aa431b4d0aed4ef2ded547797a Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Tue, 11 Jul 2023 20:31:21 +0200 Subject: [PATCH] use time for interpolation pf empty dsc reference to avoid infs --- src/gui_qt/dsc/__init__.py | 0 src/gui_qt/dsc/glass_dialog.py | 2 ++ src/gui_qt/io/dscreader.py | 2 +- src/nmreval/io/dsc.py | 4 +--- 4 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 src/gui_qt/dsc/__init__.py diff --git a/src/gui_qt/dsc/__init__.py b/src/gui_qt/dsc/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/gui_qt/dsc/glass_dialog.py b/src/gui_qt/dsc/glass_dialog.py index 4cac3c0..f815b7a 100644 --- a/src/gui_qt/dsc/glass_dialog.py +++ b/src/gui_qt/dsc/glass_dialog.py @@ -86,6 +86,8 @@ class TgCalculator(QtWidgets.QWizard, Ui_DSCEvalDialog): self.next_button.clicked.connect(lambda: self.stackedWidget.setCurrentIndex((self.stackedWidget.currentIndex() + 1) % 3)) self.back_button.clicked.connect(lambda: self.stackedWidget.setCurrentIndex((self.stackedWidget.currentIndex() + 2) % 3)) + self.listWidget.itemChanged.connect(self.change_visibility) + def __call__(self): self.clear() self._colors = cycle(Tab10) diff --git a/src/gui_qt/io/dscreader.py b/src/gui_qt/io/dscreader.py index b672a78..b3b0768 100644 --- a/src/gui_qt/io/dscreader.py +++ b/src/gui_qt/io/dscreader.py @@ -83,7 +83,7 @@ class QDSCReader(QtWidgets.QDialog, Ui_Dialog): if opts[0] == 'i': item.setFlags(QtCore.Qt.NoItemFlags) - item.setText(f'{opts[1]:.2f} K for {opts[1] / 60:.0f} min') + item.setText(f'{opts[1]:.2f} K for {opts[2] / 60:.0f} min') else: item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsUserCheckable) item.setText(f'{opts[2]:.2f} K to {opts[3]:.2f} K with {opts[1]} K/min') diff --git a/src/nmreval/io/dsc.py b/src/nmreval/io/dsc.py index e64c60f..2be1fa4 100644 --- a/src/nmreval/io/dsc.py +++ b/src/nmreval/io/dsc.py @@ -46,11 +46,9 @@ class DSCSample: if 'Heat from' in line: match = DSCSample.NUMBER_RE.findall(line) self.steps.append(('h', float(match[3]), float(match[1])+273.15, float(match[2])+273.15)) - elif 'Cool from' in line: match = DSCSample.NUMBER_RE.findall(line) self.steps.append(('c', float(match[3]), float(match[1])+273.15, float(match[2])+273.15)) - elif 'Hold for' in line: match = DSCSample.NUMBER_RE.findall(line) self.steps.append(('i', float(match[2])+273.15, float(match[1])*60)) @@ -294,7 +292,7 @@ class DSCCalibrator: empty_y = empty_data[1] if self.sample.length(idx) != self.empty.length(idx_empty): with np.errstate(all='ignore'): - empty_y = interp1d(empty_data[0], empty_data[1], fill_value='extrapolate')(sample_data[0]) + empty_y = interp1d(empty_data[2], empty_data[1], fill_value='extrapolate')(sample_data[2]) sample_data[1] -= empty_y drift_value = sample_data.copy()[(2, 1), :]