fix even savgol window length manuallz

This commit is contained in:
Dominik Demuth 2023-07-11 18:06:17 +02:00
parent fbf4246c7e
commit 3ed7368bb0

View File

@ -98,7 +98,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])