changeset 1184:f9cf827a73a6

minor bug with window length for savgol
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 01 Apr 2022 15:41:24 -0400
parents 38f0d0ceac3f
children d381a06e2d9e
files trafficintelligence/moving.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/trafficintelligence/moving.py	Fri Apr 01 15:39:04 2022 -0400
+++ b/trafficintelligence/moving.py	Fri Apr 01 15:41:24 2022 -0400
@@ -1574,7 +1574,7 @@
                 wlength -=1
         else:
             wlength = window_length
-        return savgol_filter(speeds, wlength, polyorder, 1, delta, axis, mode, cval)
+        return savgol_filter(speeds, wlength, min(wlength, polyorder), 1, delta, axis, mode, cval)
 
     def getSpeedIndicator(self):
         from indicators import SeverityIndicator