]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/blobdiff - gplot.py
Refactor load JSON obstacles
[hubacji1/iamcar.git] / gplot.py
index 23d997a4c7f6a6981052f5bbba2faf428321d99d..1e9005163fd5603cd68578bfa81a3745b8f56d71 100644 (file)
--- a/gplot.py
+++ b/gplot.py
@@ -263,44 +263,9 @@ def print_successrate():
         print("{}: {}".format(a["f"], v[a["f"]]))
 
 if __name__ == "__main__":
-    plt.rcParams["font.size"] = 29
-    res = []
-    for d in listdir("testlog"):
-        LOGF="testlog/{}".format(d)
-        r = {}
-        for sf in [i["f"] for i in LOG]:
-            r[sf] = load_trajectories("{}/{}".format(LOGF, sf))
-            res.append({
-                "f": d,
-                "elap": get_val_if_exist(r["T2"], "elap"),
-                "rrte": get_val_if_exist(r["T2"], "rrte"),
-                "ppse": get_val_if_exist(r["T2"], "ppse"),
-            })
-
-    fig = plt.figure()
-    ax = fig.add_subplot(111)
-    ax.set_title("Elapsed time for different parking slot lenghts")
-
-    ax.set_ylabel("Time [s]")
-    ax.set_xlabel("Parking slot length [m]")
-    plt.plot(
-        [float(r["f"].split("_")[1]) for r in res],
-        [mean_conf_int(r["elap"])[0] for r in res],
-        color = 'r',
-        label = 'Overall',
-    )
-    plt.plot(
-        [float(r["f"].split("_")[1]) for r in res],
-        [mean_conf_int(r["rrte"])[0] for r in res],
-        color = 'b',
-        label = 'RRT',
-    )
-    plt.plot(
-        [float(r["f"].split("_")[1]) for r in res],
-        [mean_conf_int(r["ppse"])[0] for r in res],
-        color = 'g',
-        label = 'Slot Planner',
-    )
-
-    plt.legend()
-    plt.show()
+    r = {}
+    for sf in [i["f"] for i in LOG]:
+        r[sf] = load_trajectories("{}/{}".format(LOGF, sf))
+    print_successrate()
+    plot_maxtime()
+    plot_costdist()