Mercurial > hg > nsaunier > traffic-intelligence
comparison python/moving.py @ 379:f1a1923ddff9
minor
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 19 Jul 2013 00:37:02 -0400 |
| parents | 3805b9639647 |
| children | 387cc0142211 |
comparison
equal
deleted
inserted
replaced
| 378:3805b9639647 | 379:f1a1923ddff9 |
|---|---|
| 711 def speedDiagnostics(self, framerate = 1., display = False): | 711 def speedDiagnostics(self, framerate = 1., display = False): |
| 712 from numpy import std | 712 from numpy import std |
| 713 from scipy.stats import scoreatpercentile | 713 from scipy.stats import scoreatpercentile |
| 714 speeds = framerate*self.getSpeeds() | 714 speeds = framerate*self.getSpeeds() |
| 715 coef = utils.linearRegression(range(len(speeds)), speeds) | 715 coef = utils.linearRegression(range(len(speeds)), speeds) |
| 716 print(min(speeds), scoreatpercentile(speeds, 5), speeds[-2]-speeds[1], std(speeds), coef[0]) | 716 print('min/5th perc speed: {} / {}\nspeed diff: {}\nspeed stdev: {}\nregression: {}'.format(min(speeds), scoreatpercentile(speeds, 5), speeds[-2]-speeds[1], std(speeds), coef[0])) |
| 717 if display: | 717 if display: |
| 718 from matplotlib.pyplot import figure, plot | 718 from matplotlib.pyplot import figure, plot, axis |
| 719 figure(1) | 719 figure(1) |
| 720 self.draw() | 720 self.draw() |
| 721 axis('equal') | |
| 721 figure(2) | 722 figure(2) |
| 722 plot(list(self.getTimeInterval()), speeds) | 723 plot(list(self.getTimeInterval()), speeds) |
| 723 | 724 |
| 724 @staticmethod | 725 @staticmethod |
| 725 def distances(obj1, obj2, instant): | 726 def distances(obj1, obj2, instant): |
