Mercurial Hosting > traffic-intelligence
diff python/moving.py @ 682:fbe29be25501 dev
corrected bug
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 05 Jun 2015 02:35:29 +0200 |
parents | da1352b89d02 |
children | 94b291a5f933 |
line wrap: on
line diff
--- a/python/moving.py Fri Jun 05 02:25:50 2015 +0200 +++ b/python/moving.py Fri Jun 05 02:35:29 2015 +0200 @@ -1129,8 +1129,12 @@ return None def getSpeeds(self, nInstantsIgnoredAtEnds = 0): - n = min(nInstantsIgnoredAtEnds, int(floor(self.length()/2.))) - return self.getVelocities().norm()[n:-n] + speeds = self.getVelocities().norm() + if nInstantsIgnoredAtEnds > 0: + n = min(nInstantsIgnoredAtEnds, int(floor(self.length()/2.))) + return speeds[n:-n] + else: + return speeds def getSpeedIndicator(self): from indicators import SeverityIndicator