Mercurial > hg > nsaunier > traffic-intelligence
comparison python/pavement.py @ 433:d40ad901b272
added kernel smoothing
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 29 Nov 2013 02:38:41 -0500 |
| parents | 4970fa64f636 |
| children | 9a714f32fc9f |
comparison
equal
deleted
inserted
replaced
| 432:4970fa64f636 | 433:d40ad901b272 |
|---|---|
| 21 def plot(self, measure, options = 'o', dayRatio = 1., **kwargs): | 21 def plot(self, measure, options = 'o', dayRatio = 1., **kwargs): |
| 22 from matplotlib.pyplot import plot | 22 from matplotlib.pyplot import plot |
| 23 plot(self.data['jours']/float(dayRatio), | 23 plot(self.data['jours']/float(dayRatio), |
| 24 self.data[measure], options, **kwargs) | 24 self.data[measure], options, **kwargs) |
| 25 | 25 |
| 26 def plotRetroreflectivity(self, options = 'o', dayRatio = 1., **kwargs): | 26 def getMarkingMeasures(self, measure, ligneNum): |
| 27 from numpy import isnan | |
| 28 dataLabel = '{}_{}'.format(measure, ligneNum) | |
| 29 nonZeroIndices = ~isnan(self.data[dataLabel]) | |
| 30 return self.data[nonZeroIndices]['jours'], self.data[nonZeroIndices][dataLabel] | |
| 31 | |
| 32 def plotMarkingMeasures(self, measure, options = 'o', dayRatio = 1., **kwargs): | |
| 27 for i in range(1,7): | 33 for i in range(1,7): |
| 28 self.plot('retro_{}'.format(i), options, dayRatio, **kwargs) | 34 self.plot('{}_{}'.format(measure, i), options, dayRatio, **kwargs) |
| 29 | |
| 30 def plotDurability(self, options = 'o', dayRatio = 1., **kwargs): | |
| 31 for i in range(1,7): | |
| 32 self.plot('dur_{}'.format(i), options, dayRatio, **kwargs) |
