Mercurial Hosting > traffic-intelligence
changeset 869:eb2f8ce2b39d
added method for longest feature
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 03 Feb 2017 14:16:36 -0500 |
parents | 1fdafa9f6bf4 |
children | 1535251a1f40 |
files | python/moving.py |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
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'''