from astropy.time import Time
from poliastro.bodies import Mercury, Venus, Earth, Mars, Jupiter
from poliastro.ephem import Ephem
from poliastro.frames import Planes
from poliastro.util import time_range
from poliastro.plotting import StaticOrbitPlotter
import matplotlib.pyplot as plt
'savefig', dpi=300) plt.rc(
References:
In [3]:
In [4]:
= 75
periods = 'white'
background_color # background_color = 'dark'
format = 'svg'
= f'../figures/orbits/juno_orbit_{background_color}.{format}'
path00 = f'../figures/orbits/juno_psp_orbit_{background_color}.{format}'
path01 = f'../figures/orbits/psp_orbit_{background_color}.{format}'
path02
= 0.77 alpha
In [5]:
if background_color == 'dark':
= True
dark = 'white'
jno_color else:
= False
dark = None jno_color
Juno
In [6]:
## Main dates
= Time("2011-08-06", scale="utc").tdb
juno_date_launch = Time("2012-09-03 19:21", scale="utc").tdb
date_flyby = Time("2016-07-05 03:18", scale="utc").tdb juno_date_arrival
In [7]:
= Ephem.from_horizons(
juno_traj "Juno (spacecraft)",
=time_range(juno_date_launch, end=juno_date_arrival, periods=periods),
epochs=Planes.EARTH_ECLIPTIC,
plane )
In [27]:
= StaticOrbitPlotter(num_points=300, plane=Planes.EARTH_ECLIPTIC, dark=dark)
plotter
plotter.set_body_frame(Earth, juno_date_launch)= plotter.plot_body_orbit(Earth, juno_date_launch)
earth_plots_traj, earth_plots_pos = plotter.plot_body_orbit(Mars, juno_date_arrival)
mars_plots_traj, mars_plots_pos = plotter.plot_body_orbit(Jupiter, juno_date_arrival)
jupiter_plots_traj, jupiter_plots_pos
for body_traj in [earth_plots_traj[0], mars_plots_traj[0], jupiter_plots_traj[0]]:
'dotted')
body_traj.set_linestyle(for body_pos in [earth_plots_pos, mars_plots_pos, jupiter_plots_pos]:
3)
body_pos.set_markersize(None)
body_pos.set_label(
'Earth', earth_plots_traj)
plotter._set_legend('Mars', mars_plots_traj)
plotter._set_legend('Jupiter', jupiter_plots_traj)
plotter._set_legend(
= plotter.plot_trajectory(juno_traj._coordinates, label="Juno cruise", color=jno_color)
juno_plots_traj, juno_plots_pos
=None, loc="upper left",)
plotter._ax.legend(title='tight') plt.savefig(path00, bbox_inches
In [24]:
plt.show()
Juno with Parker Solar Probe
In [42]:
## Main dates
# August 12, 2018: Launch - 3:31 a.m. EDT (7:31 UTC)
= Time("2018-08-12T10:00", scale="utc").tdb
psp_date_launch # November 5, 2018: Perihelion #1 - 10:27 p.m. EST (Nov. 6, 2018 at 03:27 UTC)
= Time("2018-11-06T03:27", scale="utc").tdb
p1_date # January 19, 2019: Aphelion #1
= Time("2019-01-19T00:00", scale="utc").tdb a1_date
In [43]:
= Ephem.from_horizons(
psp_traj "Parker Solar Probe (spacecraft)",
=time_range(psp_date_launch, end=p1_date, periods=periods),
epochs=Planes.EARTH_ECLIPTIC,
plane
)
= Ephem.from_horizons(
psp_traj_2 "Parker Solar Probe (spacecraft)",
=time_range(p1_date, end=a1_date, periods=periods),
epochs=Planes.EARTH_ECLIPTIC,
plane )
In [45]:
= StaticOrbitPlotter(num_points=300, plane=Planes.EARTH_ECLIPTIC, dark=dark)
plotter
plotter.set_body_frame(Earth, juno_date_launch)= plotter._plot_body_orbit(Mercury, psp_date_launch)
mercury_plots_traj, mercury_plots_pos = plotter.plot_body_orbit(Venus, psp_date_launch)
venus_plots_traj, venus_plots_pos = plotter.plot_body_orbit(Earth, juno_date_launch)
earth_plots_traj, earth_plots_pos = plotter.plot_body_orbit(Mars, juno_date_arrival)
mars_plots_traj, mars_plots_pos = plotter.plot_body_orbit(Jupiter, juno_date_arrival)
jupiter_plots_traj, jupiter_plots_pos
for body_traj in [mercury_plots_traj[0], venus_plots_traj[0], earth_plots_traj[0], mars_plots_traj[0], jupiter_plots_traj[0]]:
'dotted')
body_traj.set_linestyle(for body_pos in [mercury_plots_pos, venus_plots_pos, earth_plots_pos, mars_plots_pos, jupiter_plots_pos]:
3)
body_pos.set_markersize(None)
body_pos.set_label(
'Mercury', mercury_plots_traj)
plotter._set_legend('Venus', venus_plots_traj)
plotter._set_legend('Earth', earth_plots_traj)
plotter._set_legend('Mars', mars_plots_traj)
plotter._set_legend('Jupiter', jupiter_plots_traj)
plotter._set_legend(
= plotter.plot_trajectory(juno_traj._coordinates, label="Juno cruise", color=jno_color)
juno_plots_traj, juno_plots_pos = plotter.plot_trajectory(psp_traj._coordinates, label="PSP cruise", color="red")
psp_plots_traj, psp_plots_pos = plotter.plot_trajectory(psp_traj_2._coordinates, color="red")
psp_plots_traj_2, psp_plots_pos_2
0].set_linewidth(1.5)
juno_plots_traj[0].set_linewidth(1.5)
psp_plots_traj[0].set_linewidth(1.5)
psp_plots_traj_2[
=None, ncols=2, loc="upper left",)
plotter._ax.legend(title='tight') plt.savefig(path01, bbox_inches
Parker Solar Probe
In [48]:
= StaticOrbitPlotter(plane=Planes.EARTH_ECLIPTIC, dark=dark)
plotter
= plotter.plot_body_orbit(Mercury, psp_date_launch)
mercury_plots_traj, mercury_plots_pos = plotter.plot_body_orbit(Venus, psp_date_launch)
venus_plots_traj, venus_plots_pos = plotter.plot_body_orbit(Earth, psp_date_launch)
earth_plots_traj, earth_plots_pos
= plotter.plot_trajectory(psp_traj._coordinates, label="PSP cruise", color="red")
psp_plots_traj, psp_plots_pos = plotter.plot_trajectory(psp_traj_2._coordinates, label="PSP cruise", color="red")
psp_plots_traj_2, psp_plots_pos_2
0].set_linewidth(2)
psp_plots_traj[0].set_linewidth(2)
psp_plots_traj_2[
for body_traj in [mercury_plots_traj[0], venus_plots_traj[0], earth_plots_traj[0]]:
'dotted')
body_traj.set_linestyle(for body_pos in [mercury_plots_pos, venus_plots_pos, earth_plots_pos]:
3)
body_pos.set_markersize(
False)
plt.legend().set_visible(='tight') plt.savefig(path02, bbox_inches