(spaces: list[str])
| 16 | |
| 17 | |
| 18 | def plot_separately(spaces: list[str]): |
| 19 | for spaceid in ColoredTqdm(spaces, desc="Plotting"): |
| 20 | exp_space = Sandbox.load(spaceid) |
| 21 | config = exp_space.config |
| 22 | |
| 23 | try: |
| 24 | gt_traj, est_traj = Trajectory.from_sandbox(exp_space, align_time="est->gt") |
| 25 | est_traj.plot_kwargs |= {"color": getColor("-", 4, 0)} |
| 26 | if gt_traj is None: |
| 27 | Logger.write("warn", f"Unable to plot error analysis for {est_traj} since could not load GT trajectory.") |
| 28 | return |
| 29 | |
| 30 | gt_traj.plot_kwargs |= {"linewidth": 3, "linestyle": ":"} |
| 31 | |
| 32 | for key, scale in NEED_ALIGN_SCALE.items(): |
| 33 | if key not in est_traj.name.lower(): continue |
| 34 | |
| 35 | Logger.write("info", f"{est_traj} --[align_scale={scale}]-> {gt_traj}") |
| 36 | if scale == "Dynamic": est_traj.data = est_traj.data.align_scale(gt_traj.data) |
| 37 | else: est_traj.data = est_traj.data.scale(scale) |
| 38 | break |
| 39 | |
| 40 | est_traj.data = est_traj.data.align_origin(gt_traj.data) |
| 41 | name = config.Project if hasattr(config, "Project") else est_traj.name |
| 42 | AnalyzeTranslation( |
| 43 | [(gt_traj.apply(lambda traj: traj.as_motion), est_traj.apply(lambda traj: traj.as_motion))], |
| 44 | Path("Results", f"{name}_TranslationErr.png") |
| 45 | ) |
| 46 | AnalyzeRotation( |
| 47 | [(gt_traj.apply(lambda traj: traj.as_motion), est_traj.apply(lambda traj: traj.as_motion))], |
| 48 | Path("Results", f"{name}_RotationErr.png") |
| 49 | ) |
| 50 | PlotTrajectory([gt_traj, est_traj], Path("Results", f"{name}_Trajectory.png")) |
| 51 | except Exception as e: |
| 52 | Logger.show_exception() |
| 53 | |
| 54 | |
| 55 | def plot_jointly(spaces: list[str]): |
no test coverage detected