]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/blobdiff - scripts/print_json_objects_scenaris_statistics.py
Do not use unicode minus
[hubacji1/iamcar2.git] / scripts / print_json_objects_scenaris_statistics.py
index 46df9e6793bfafccfbc0da5cd39e3b1e7cd9eb5b..96dd4c3e516e4bff89b861b78c60d23a07cb267f 100644 (file)
@@ -63,11 +63,20 @@ def compute_stats(sl={}, what="time"):
     what -- The variable in scenario stats to compute with.
     """
     assert len(sl) > 0
-    wl = [s["sc"][what] for s in sl if "sc" in s and what in s["sc"]]
+    wl = [
+        s["sc"][what] for s in sl
+        if "sc" in s
+        and what in s["sc"]
+        and (
+            "cost" in s["sc"]
+            and s["sc"]["cost"] != 9999
+        )
+    ]
     el = [
         1 for s in sl
         if "sc" in s
         and "cost" in s["sc"]
+        and s["sc"]["cost"] != 9999
         and s["sc"]["cost"] != -1
     ]
     if len(wl) == 0:
@@ -75,6 +84,7 @@ def compute_stats(sl={}, what="time"):
         wl_std = inf
         wl_max = inf
         wl_min = -inf
+        wl_med = inf
     else:
         wl_mean = sum(wl) / len(wl)
         wl_tmp = [(x - wl_mean)**2 for x in wl]
@@ -166,7 +176,7 @@ if __name__ == "__main__":
         col = compute_stats(sl, "connecteds-in-path")
         nl = compute_stats(sl, "nodes")
         print(gos().format(
-                tl["err"], sl[0]["dn"], sl[0]["fn"],
+                tl["err"], sl[0]["dn"][:15], sl[0]["fn"],
                 "-", "-",
                 tl["avg"], tl["std"], tl["med"], tl["max"], tl["min"],
                 il["avg"], il["std"], il["med"], il["max"], il["min"],