# HG changeset patch # User Nicolas Saunier # Date 1486149396 18000 # Node ID eb2f8ce2b39da3e709af94ebf3728d7fb55dbfa3 # Parent 1fdafa9f6bf4bdab5d2e9212cd8edc1a3e0be8d0 added method for longest feature diff -r 1fdafa9f6bf4 -r eb2f8ce2b39d python/moving.py --- 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'''