Mercurial Hosting > traffic-intelligence
diff python/moving.py @ 869:eb2f8ce2b39d
added method for longest feature
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 03 Feb 2017 14:16:36 -0500 |
parents | a8ca72dc1564 |
children | d1ff6917d082 |
line wrap: on
line diff
--- a/python/moving.py Wed Feb 01 11:58:04 2017 -0500 +++ b/python/moving.py Fri Feb 03 14:16:36 2017 -0500 @@ -1266,6 +1266,13 @@ else: return None + def getNLongestFeatures(self, nFeatures = 1): + if self.features is None: + return [] + else: + tmp = utils.sortByLength(self.getFeatures(), reverse = True) + return tmp[:min(len(tmp), nFeatures)] + def getFeatureNumbers(self): '''Returns the number of features at each instant dict instant -> number of features'''