Mercurial Hosting > traffic-intelligence
comparison python/indicators.py @ 340:1046b7346886
work in progress on storing indicator values
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 19 Jun 2013 23:35:24 -0400 |
parents | 28661c5887d3 |
children | 2f39c4ed0b62 |
comparison
equal
deleted
inserted
replaced
339:9c1818a71c9c | 340:1046b7346886 |
---|---|
69 def getTimeInterval(self): | 69 def getTimeInterval(self): |
70 return self.timeInterval | 70 return self.timeInterval |
71 | 71 |
72 def getValues(self): | 72 def getValues(self): |
73 return [self.__getitem__(t) for t in self.timeInterval] | 73 return [self.__getitem__(t) for t in self.timeInterval] |
74 | |
75 def getAngleValues(self): | |
76 '''if the indicator is a function of an angle, | |
77 transform it to an angle (eg cos) | |
78 (no transformation otherwise)''' | |
79 from numpy import arccos | |
80 values = self.getValues() | |
81 if self.isCosine: | |
82 return [arccos(c) for c in values] | |
83 else: | |
84 return values | |
85 | 74 |
86 def plot(self, options = '', xfactor = 1., **kwargs): | 75 def plot(self, options = '', xfactor = 1., **kwargs): |
87 from matplotlib.pylab import plot,ylim | 76 from matplotlib.pylab import plot,ylim |
88 if self.getTimeInterval().length() == 1: | 77 if self.getTimeInterval().length() == 1: |
89 marker = 'o' | 78 marker = 'o' |