pip install jplephem
pip install sgp4
Spacecraft_Testbed/Information/Celestial_Bodies/Ephemerides
.
In [1]:
# Import the Celestial Body class
from Spacecraft_Testbed.Body import Celestial_Body
# Importy NumPy tools for math stuff
from numpy import linspace
In [2]:
# Instantiate Earth and Jupiter
Earth = Celestial_Body('Earth')
Jupiter = Celestial_Body('Jupiter')
In [3]:
# Define Julian date of interest (March 20)
March20 = 2457832.5 # Initial time
In [4]:
# Calculate position and velocity of Earth
# with respect to the solar system barycentre
# On March 20
p, v = Earth.Position_and_Velocity(March20)
print "Position: " + str(p)
print "Velocity: " + str(v)
In [5]:
# Examine the Chinese weather satellite Fengyun 1C debris fragements
frag1 = Earth.Satellites.Fengyun_1C.Fengyun_1C_Deb_102
frag2 = Earth.Satellites.Fengyun_1C.Fengyun_1C_Deb_105
# Examine the Iridium debris fragement 4
frag3 = Earth.Satellites.Iridium_33.Iridium_33_Deb_4
# and Breeze debris fragement 1
frag4 = Earth.Satellites.Cosmos_2251.Cosmos_2251_Deb_1
In [6]:
# These positions and velocities can be shown as well
print frag1.Position_and_Velocity(March20) # WRT SS barycentre
In [7]:
# WRT other planets and fragements (all derrived from the body class)
print frag3.Position_and_Velocity_WRT(Earth, March20) # WRT Earth
In [8]:
# WRT another fragement
print frag4.Position_and_Velocity_WRT(frag1, March20)
In [9]:
# WRT Jupiter
print frag2.Position_and_Velocity_WRT(Jupiter, March20)
In [10]:
# Earth WRT Mars
print Earth.Position_and_Velocity_WRT(Celestial_Body('Mars'), March20)
Remeber that position and velocity are given in $m$ and $\frac{m}{s}$, respectively.