Mercurial Hosting > traffic-intelligence
comparison python/indicators.py @ 692:9a258687af4c dev
corrected some errors for ttc
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 29 Jun 2015 23:09:58 -0400 |
parents | fa9aa5f08210 |
children | 5ee22bf7e4d5 |
comparison
equal
deleted
inserted
replaced
691:fa9aa5f08210 | 692:9a258687af4c |
---|---|
150 values = sorted(values[indices], reverse = self.mostSevereIsMax) # inverted if most severe is max -> take the first values | 150 values = sorted(values[indices], reverse = self.mostSevereIsMax) # inverted if most severe is max -> take the first values |
151 return mean(values[:minNInstants]) | 151 return mean(values[:minNInstants]) |
152 else: | 152 else: |
153 return None | 153 return None |
154 | 154 |
155 def getInstantOfMostSevereValue(self): | |
156 '''Returns the instant at which the indicator reaches its most severe value''' | |
157 if self.mostSevereIsMax: | |
158 return max(self.values, key=self.values.get) | |
159 else: | |
160 return min(self.values, key=self.values.get) | |
161 | |
155 # functions to aggregate discretized maps of indicators | 162 # functions to aggregate discretized maps of indicators |
156 # TODO add values in the cells between the positions (similar to discretizing vector graphics to bitmap) | 163 # TODO add values in the cells between the positions (similar to discretizing vector graphics to bitmap) |
157 | 164 |
158 def indicatorMap(indicatorValues, trajectory, squareSize): | 165 def indicatorMap(indicatorValues, trajectory, squareSize): |
159 '''Returns a dictionary | 166 '''Returns a dictionary |