def test_set_frame_plots_same_colors(): # TODO: Review op = StaticOrbitPlotter() op.plot_body_orbit(Jupiter, J2000_TDB) colors1 = [orb[2] for orb in op.trajectories] op.set_body_frame(Jupiter) colors2 = [orb[2] for orb in op.trajectories] assert colors1 == colors2
def test_plot_trajectory_sets_label(): expected_label = "67P" op = StaticOrbitPlotter() trajectory = churi.sample() op.plot_body_orbit(Mars, J2000_TDB, label="Mars") op.plot_trajectory(trajectory, label=expected_label) legend = plt.gca().get_legend() assert legend.get_texts()[1].get_text() == expected_label
def test_redraw_keeps_trajectories(): # See https://github.com/poliastro/poliastro/issues/518 op = StaticOrbitPlotter() trajectory = churi.sample() op.plot_body_orbit(Mars, J2000_TDB, label="Mars") op.plot_trajectory(trajectory, label="67P") assert len(op.trajectories) == 2 op.set_body_frame(Mars) assert len(op.trajectories) == 2
# ### Solutions for M=0 # # By making use of the previous defined function, we can easily get the different transfer orbit regarding the number of required revolutions, in this case 0. # In[4]: # Solving for direct (M=0) transfer long and short arcs ss_short0, ss_long0 = lambert_transfer(earth_departure, mars_arrival, revs=0) fig, ax = plt.subplots(figsize=(5, 10)) op = StaticOrbitPlotter(ax=ax) ax.set_title("Direct arc transfer ($M=0$)") orbit_set = {ss_short0: ["Short0", "black"], ss_long0: ["Long0", "grey"]} op.plot_body_orbit(Earth, EPOCH_DPT) op.plot_body_orbit(Mars, EPOCH_ARR) for ss in orbit_set: op.plot(ss, label=orbit_set[ss][0], color=orbit_set[ss][-1], trail=True) # ### Solutions for M=1 # In[5]: # Solving for M=1 long and short arc transfers ss_short1, ss_long1 = lambert_transfer(earth_departure, mars_arrival, revs=1) fig, ax = plt.subplots(figsize=(5, 10)) op = StaticOrbitPlotter(ax=ax) ax.set_title("Direct arc transfer ($M=1$)")