comparison trafficintelligence/moving.py @ 1179:2039df59c47b

correcting bug for concatenation caused when saving velocities (1 fewer positions)
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sun, 27 Mar 2022 00:20:24 -0400
parents aa88acf06876
children dc28364f34b9
comparison
equal deleted inserted replaced
1178:ee3eaf902b83 1179:2039df59c47b
1325 newNum = obj1.getNum() 1325 newNum = obj1.getNum()
1326 else: 1326 else:
1327 newNum = num 1327 newNum = num
1328 commonTimeInterval = obj1.commonTimeInterval(obj2) 1328 commonTimeInterval = obj1.commonTimeInterval(obj2)
1329 emptyInterval = TimeInterval(min(obj1.getLastInstant(),obj2.getLastInstant()), max(obj1.getFirstInstant(),obj2.getFirstInstant())) 1329 emptyInterval = TimeInterval(min(obj1.getLastInstant(),obj2.getLastInstant()), max(obj1.getFirstInstant(),obj2.getFirstInstant()))
1330 if commonTimeInterval.empty() and emptyInterval.length() >= 3: 1330 if commonTimeInterval.empty() and emptyInterval.length() >= 2: # 2 to include situations successive positions, but issues with missing last velocity and reloading
1331 if newFeatureNum is None: 1331 if newFeatureNum is None:
1332 print('Not merging objects {} and {}, missing new feature number'.format(obj1.getNum(),obj2.getNum())) 1332 print('Not merging objects {} and {}, missing new feature number'.format(obj1.getNum(),obj2.getNum()))
1333 return None, None 1333 return None, None
1334 else: 1334 else:
1335 if obj1.existsAtInstant(emptyInterval.last): 1335 if obj1.existsAtInstant(emptyInterval.last):