Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/moving.py @ 1185:d381a06e2d9e
minor bug with window length for savgol
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 01 Apr 2022 15:44:33 -0400 |
parents | f9cf827a73a6 |
children | d24d57e4de24 |
comparison
equal
deleted
inserted
replaced
1184:f9cf827a73a6 | 1185:d381a06e2d9e |
---|---|
1572 wlength = min(window_length, len(speeds)) | 1572 wlength = min(window_length, len(speeds)) |
1573 if wlength % 2 == 0: | 1573 if wlength % 2 == 0: |
1574 wlength -=1 | 1574 wlength -=1 |
1575 else: | 1575 else: |
1576 wlength = window_length | 1576 wlength = window_length |
1577 return savgol_filter(speeds, wlength, min(wlength, polyorder), 1, delta, axis, mode, cval) | 1577 return savgol_filter(speeds, wlength, min(wlength-1, polyorder), 1, delta, axis, mode, cval) |
1578 | 1578 |
1579 def getSpeedIndicator(self): | 1579 def getSpeedIndicator(self): |
1580 from indicators import SeverityIndicator | 1580 from indicators import SeverityIndicator |
1581 return SeverityIndicator('Speed', {t:self.getVelocityAtInstant(t).norm2() for t in self.getTimeInterval()}) | 1581 return SeverityIndicator('Speed', {t:self.getVelocityAtInstant(t).norm2() for t in self.getTimeInterval()}) |
1582 | 1582 |