check even window length in tg calc; part of #91

This commit is contained in:
Dominik Demuth 2023-06-26 20:34:52 +02:00
parent 567fcfe37e
commit 6bcf42d6a8
2 changed files with 5 additions and 3 deletions

View File

@ -129,7 +129,7 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
self.graphicsView_2.addItem(tnmh_fit)
self._plots[key] = (data_plot, tg_plot, glass, liquid, tangent, fictive_cp, tnmh_fit)
self._tg_value[key] = {'onset': (nan, nan), 'mid': (nan, nan), 'end': (nan, nan), 'inflection': (nan, nan)} # , 'fictive': (nan, nan)}
self._tg_value[key] = {'onset': (nan, nan), 'midpoint': (nan, nan), 'end': (nan, nan), 'inflection': (nan, nan)} # , 'fictive': (nan, nan)}
if self._limitless:
dist = max_x - min_x

View File

@ -47,7 +47,6 @@ class DSC(Points):
region.y -= glass_extrapolation
plt.plot(region.x, regress2.slope * region.x + regress2.intercept)
real_area = cumulative_trapezoid(region.y, region.x, initial=0)
real_area -= real_area[-1]
@ -100,7 +99,10 @@ class DSC(Points):
x = self.x[low_idx[0]:high_idx[1]]
y = self.y[low_idx[0]:high_idx[1]]
yy = savgol_filter(y, window_length=min(len(x) // 20, 50), polyorder=1, deriv=1) / np.mean(np.diff(x))
win_len = min(len(x) // 20, 51)
if win_len % 2 == 0:
win_len += 1
yy = savgol_filter(y, window_length=win_len, polyorder=1, deriv=1) / np.mean(np.diff(x))
high_idx = (high_idx[0] - low_idx[0], high_idx[1] - low_idx[0])
low_idx = (0, low_idx[1] - low_idx[0])