Mercurial > hg > nsaunier > traffic-intelligence
comparison python/moving.py @ 660:994dd644f6ab
corrected impact of warmUpLastInstant
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 15 May 2015 23:09:49 +0200 |
| parents | 784298512b60 |
| children | dc70d9e711f5 |
comparison
equal
deleted
inserted
replaced
| 659:784298512b60 | 660:994dd644f6ab |
|---|---|
| 1079 if hasattr(self, 'curvilinearPositions'): | 1079 if hasattr(self, 'curvilinearPositions'): |
| 1080 from matplotlib.pylab import plot | 1080 from matplotlib.pylab import plot |
| 1081 from numpy import NaN | 1081 from numpy import NaN |
| 1082 if lane is None: | 1082 if lane is None: |
| 1083 plot(list(self.getTimeInterval()), self.curvilinearPositions.positions[0], options, **kwargs) | 1083 plot(list(self.getTimeInterval()), self.curvilinearPositions.positions[0], options, **kwargs) |
| 1084 if withOrigin: | |
| 1085 plot([self.getFirstInstant()], [self.curvilinearPositions.positions[0][0]], 'ro', **kwargs) | |
| 1084 else: | 1086 else: |
| 1085 instants = [] | 1087 instants = [] |
| 1086 coords = [] | 1088 coords = [] |
| 1087 for t, p in zip(self.getTimeInterval(), self.curvilinearPositions): | 1089 for t, p in zip(self.getTimeInterval(), self.curvilinearPositions): |
| 1088 if p[2] == lane: | 1090 if p[2] == lane: |
| 1090 coords.append(p[0]) | 1092 coords.append(p[0]) |
| 1091 else: | 1093 else: |
| 1092 instants.append(NaN) | 1094 instants.append(NaN) |
| 1093 coords.append(NaN) | 1095 coords.append(NaN) |
| 1094 plot(instants, coords, options, **kwargs) | 1096 plot(instants, coords, options, **kwargs) |
| 1095 if withOrigin: | 1097 if withOrigin and len(instants)>0: |
| 1096 plot([self.getFirstInstant()], [self.curvilinearPositions.positions[0][0]], 'ro', **kwargs) | 1098 plot([instants[0]], [coords[0]], 'ro', **kwargs) |
| 1097 else: | 1099 else: |
| 1098 print('Object {} has no curvilinear positions'.format(self.getNum())) | 1100 print('Object {} has no curvilinear positions'.format(self.getNum())) |
| 1099 | 1101 |
| 1100 def setUserType(self, userType): | 1102 def setUserType(self, userType): |
| 1101 self.userType = userType | 1103 self.userType = userType |
