diff python/moving.py @ 956:196a1fd498ba

removing unnecessary complexity of varying number of return elements
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 15 Aug 2017 16:15:55 -0400
parents d6c1c05d11f5
children 4f32d82ca390
line wrap: on
line diff
--- a/python/moving.py	Tue Aug 15 16:15:27 2017 -0400
+++ b/python/moving.py	Tue Aug 15 16:15:55 2017 -0400
@@ -1810,6 +1810,9 @@
     if returnMatches:
         gtMatches = {a.getNum():{} for a in annotations}
         toMatches = {o.getNum():{} for o in objects}
+    else:
+        gtMatches = None
+        toMatches = None
     for t in xrange(firstInstant, lastInstant+1):
         previousMatches = matches.copy()
         # go through currently matched GT-TO and check if they are still matched withing matchingDistance
@@ -1881,10 +1884,7 @@
         mota = 1.-float(mt+fpt+mme)/gt
     else:
         mota = None
-    if returnMatches:
-        return motp, mota, mt, mme, fpt, gt, gtMatches, toMatches
-    else:
-        return motp, mota, mt, mme, fpt, gt
+    return motp, mota, mt, mme, fpt, gt, gtMatches, toMatches
 
 def plotRoadUsers(objects, colors):
     '''Colors is a PlottingPropertyValues instance'''