I am applying savog filter from the scipy library, the method is applied to lists of different sizes. So I would like to automate the window size, I show it in the following example:
n = np.random.randint(0, 10)
mad = np.random.randint(0, 10, n)
grade = 5 if len(mad)//2 > 5 else (len(mad)//2)-1# Max polyorder with top 5.
madFilter = savgol_filter(x=mad, window_length=len(mad)//2, polyorder=grade)
But, I have this error:
ValueError: window_length must be odd.
Aucun commentaire:
Enregistrer un commentaire