]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/blobdiff - scripts/print_json_objects_scenaris_histograms.py
Fix failure rate, resize plot
[hubacji1/iamcar2.git] / scripts / print_json_objects_scenaris_histograms.py
index d321939b91010868f3da4ca28b39fe31b66376bd..4b1b4a592d58d5a3994ad2644186e8054944be24 100644 (file)
@@ -103,40 +103,49 @@ if __name__ == "__main__":
                 in zip(tmp_hist[1][1:], tmp_hist[0])
             ])
     assert len(dirs) == len(files)
-    tmp_dirs = list(dirs)
-    tmp_files = list(files)
-    dirs = []
-    files = []
-    for w in what:
-        dirs += tmp_dirs
-        files += tmp_files
-    del(tmp_dirs)
-    del(tmp_files)
-    h0 = "%"
-    h1 = "%"
-    h2 = "%"
-    for w in what:
-        if len(h0) == 1:
-            h0 += "{:<%s}" % (int(len(files) * 32 / len(what) - 1))
-        else:
-            h0 += "{:<%s}" % (int(len(files) * 32 / len(what)))
-    print(h0.format(*what))
+    h1 = "%" # dir names
+    h2 = "%" # file (planner) names
+    i = 0
     for d in dirs:
-        if len(h1) == 1:
-            h1 += "{:<31}"
-            h2 += "{:<31}"
+        if i == 0:
+            print("%", end="")
+            h = "{:<%s}" % int(len(what) * 32 - 1)
+            print(h.format(d), end="")
         else:
-            h1 += "{:<32}"
-            h2 += "{:<32}"
-    print(h1.format(*dirs))
-    print(h2.format(*files))
-    data = ""
-    for d in dirs:
-        data += "{:<16.2f}{:<16}"
+            h = "{:<%s}" % int(len(what) * 32)
+            print(h.format(d), end="")
+        i += 1
+    print()
+    i = 0
+    for f in files:
+        if i == 0:
+            print("%", end="")
+            h = "{:<%s}" % int(len(what) * 32 - 1)
+            print(h.format(f), end="")
+        else:
+            h = "{:<%s}" % int(len(what) * 32)
+            print(h.format(f), end="")
+        i += 1
+    print()
+    i = 0
+    for f in files:
+        for w in what:
+            if i == 0:
+                print("%", end="")
+                print("{:<31}".format(w), end="")
+            else:
+                print("{:<32}".format(w), end="")
+            i += 1
+    print()
     assert len(histograms) > 0
-    bins = len(histograms[0])
-    for i in range(bins):
-        val = []
-        for h in histograms:
-            val += h[i]
-        print(data.format(*val))
+    hl = len(histograms[0])
+    for i in range(hl):
+        for j in range(len(histograms)):
+            print(
+                "{:<16.2f}{:<16}".format(
+                    histograms[j][i][0],
+                    histograms[j][i][1],
+                ),
+                end=""
+            )
+        print()