# HG changeset patch # User Nicolas Saunier # Date 1648356852 14400 # Node ID dc28364f34b956f9cc1e91923e83a2858a629eec # Parent 2039df59c47b6a3af7f6e1636b5eeabc66dc3bd3 minor cleanup diff -r 2039df59c47b -r dc28364f34b9 trafficintelligence/moving.py --- a/trafficintelligence/moving.py Sun Mar 27 00:20:24 2022 -0400 +++ b/trafficintelligence/moving.py Sun Mar 27 00:54:12 2022 -0400 @@ -1326,8 +1326,8 @@ else: newNum = num commonTimeInterval = obj1.commonTimeInterval(obj2) - emptyInterval = TimeInterval(min(obj1.getLastInstant(),obj2.getLastInstant()), max(obj1.getFirstInstant(),obj2.getFirstInstant())) - if commonTimeInterval.empty() and emptyInterval.length() >= 2: # 2 to include situations successive positions, but issues with missing last velocity and reloading + if commonTimeInterval.empty(): # and emptyInterval.length() >= 2: not needed 2 to include situations successive positions, but issues with missing last velocity and reloading + emptyInterval = TimeInterval(min(obj1.getLastInstant(),obj2.getLastInstant()), max(obj1.getFirstInstant(),obj2.getFirstInstant())) if newFeatureNum is None: print('Not merging objects {} and {}, missing new feature number'.format(obj1.getNum(),obj2.getNum())) return None, None diff -r 2039df59c47b -r dc28364f34b9 trafficintelligence/tests/moving.txt --- a/trafficintelligence/tests/moving.txt Sun Mar 27 00:20:24 2022 -0400 +++ b/trafficintelligence/tests/moving.txt Sun Mar 27 00:54:12 2022 -0400 @@ -335,9 +335,9 @@ >>> f12.getVelocities().length() 5 ->>> o14, f14 = MovingObject.concatenate(o1, o4, 16) +>>> o14, f14 = MovingObject.concatenate(o1, o4, 16, 16) >>> len(o14.getFeatures()) -2 +3 >>> o14.getPositionAtInstant(10) == o1.getPositionAtInstant(10) True >>> o14.getPositionAtInstant(11) == o4.getPositionAtInstant(11)