comparison python/indicators.py @ 265:7a3bf04cf016

added plotting of indicators
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 26 Jul 2012 19:46:36 -0400
parents 8f0ed138d373
children a9988971aac8
comparison
equal deleted inserted replaced
264:a04a6af4b810 265:7a3bf04cf016
72 values = self.getValues() 72 values = self.getValues()
73 if self.isCosine >= 0: 73 if self.isCosine >= 0:
74 return [arccos(c) for c in values] 74 return [arccos(c) for c in values]
75 else: 75 else:
76 return values 76 return values
77
78 def plot(self, options = '', **kwargs):
79 from matplotlib.pylab import plot
80 if not self.timeInterval and type(self.values)==dict:
81 time = sorted(self.values.keys())
82 plot(time, [self.values[i] for i in time], options, **kwargs)
83 else:
84 plot(list(getTimeInterval()), self.values, options, **kwargs)
77 85
78 class SeverityIndicator(TemporalIndicator): 86 class SeverityIndicator(TemporalIndicator):
79 '''Class for severity indicators 87 '''Class for severity indicators
80 field mostSevereIsMax is True 88 field mostSevereIsMax is True
81 if the most severe value taken by the indicator is the maximum''' 89 if the most severe value taken by the indicator is the maximum'''