Mercurial Hosting > traffic-intelligence
changeset 543:cb213269d330
defensive code for curvilinear trajectory initialization
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 07 Jul 2014 16:59:20 -0400 |
parents | a3add9f751ef |
children | 749672171789 |
files | python/moving.py |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
diff -r a3add9f751ef -r cb213269d330 python/moving.py --- a/python/moving.py Mon Jul 07 16:54:10 2014 -0400 +++ b/python/moving.py Mon Jul 07 16:59:20 2014 -0400 @@ -634,11 +634,13 @@ lateral coordiante is stored as second coordinate''' def __init__(self, S = None, Y = None, lanes = None): - if S == None or Y == None: + if S == None or Y == None or len(S) != len(Y): self.positions = [[],[]] + if len(S) != len(Y): + print("S and Y coordinates of different lengths\nInitializing to empty lists") else: self.positions = [S,Y] - if lanes == None: + if lanes == None or len(lanes) != self.length(): self.lanes = [] else: self.lanes = lanes