Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Earth = _Earth()
Mars = _Mars()
Jupiter = _Jupiter()
Saturn = _Saturn()
Uranus = _Uranus()
Neptune = _Neptune()
Pluto = _Pluto()
class _Moon(_Body):
parent = Earth
k = constants.GM_moon
name = "Moon"
symbol = "\u263E"
R = constants.R_moon
R_mean = constants.R_mean_moon
R_polar = constants.R_polar_moon
mass = k / G
@staticmethod
def _rot_elements_at_epoch(T, d):
E1 = (125.045 - 0.0529921 * d) * u.deg
E2 = (250.089 - 0.1059842 * d) * u.deg
E3 = (260.008 + 13.0120009 * d) * u.deg
E4 = (176.625 + 13.3407154 * d) * u.deg
E5 = (357.529 + 0.9856003 * d) * u.deg
E6 = (311.589 + 26.4057084 * d) * u.deg
E7 = (134.963 + 13.0649930 * d) * u.deg
E8 = (276.617 + 0.3287146 * d) * u.deg
E9 = (34.226 + 1.7484877 * d) * u.deg
E10 = (15.134 - 0.1589763 * d) * u.deg
Mars = _Mars()
Jupiter = _Jupiter()
Saturn = _Saturn()
Uranus = _Uranus()
Neptune = _Neptune()
Pluto = _Pluto()
class _Moon(_Body):
parent = Earth
k = constants.GM_moon
name = "Moon"
symbol = "\u263E"
R = constants.R_moon
R_mean = constants.R_mean_moon
R_polar = constants.R_polar_moon
mass = k / G
@staticmethod
def _rot_elements_at_epoch(T, d):
E1 = (125.045 - 0.0529921 * d) * u.deg
E2 = (250.089 - 0.1059842 * d) * u.deg
E3 = (260.008 + 13.0120009 * d) * u.deg
E4 = (176.625 + 13.3407154 * d) * u.deg
E5 = (357.529 + 0.9856003 * d) * u.deg
E6 = (311.589 + 26.4057084 * d) * u.deg
E7 = (134.963 + 13.0649930 * d) * u.deg
E8 = (276.617 + 0.3287146 * d) * u.deg
E9 = (34.226 + 1.7484877 * d) * u.deg
E10 = (15.134 - 0.1589763 * d) * u.deg
E11 = (119.743 + 0.0036096 * d) * u.deg
@staticmethod
def _rot_elements_at_epoch(T, d):
ra = 272.76 * u.deg
dec = 67.16 * u.deg
W = (160.20 - 1.4813688 * d) * u.deg
return ra, dec, W
class _Earth(_Body):
parent = Sun
k = constants.GM_earth
name = "Earth"
symbol = "\u2641"
R = constants.R_earth
R_mean = constants.R_mean_earth
R_polar = constants.R_polar_earth
mass = k / G
J2 = constants.J2_earth
J3 = constants.J3_earth
H0 = constants.H0_earth
rho0 = constants.rho0_earth
@staticmethod
def _rot_elements_at_epoch(T, d):
ra = (0.00 - 0.641 * T) * u.deg
dec = (90.00 - 0.557 * T) * u.deg
W = (190.147 + 360.9856235 * d) * u.deg
return ra, dec, W
J3 = constants.J3_earth
H0 = constants.H0_earth
rho0 = constants.rho0_earth
@staticmethod
def _rot_elements_at_epoch(T, d):
ra = (0.00 - 0.641 * T) * u.deg
dec = (90.00 - 0.557 * T) * u.deg
W = (190.147 + 360.9856235 * d) * u.deg
return ra, dec, W
class _Mars(_Body):
parent = Sun
k = constants.GM_mars
name = "Mars"
symbol = "\u2642"
R = constants.R_mars
R_mean = constants.R_mean_mars
R_polar = constants.R_polar_mars
mass = k / G
J2 = constants.J2_mars
J3 = constants.J3_mars
@staticmethod
def _rot_elements_at_epoch(T, d):
M1 = (198.991226 + 19139.4819985 * T) * u.deg
M2 = (226.292679 + 38280.8511281 * T) * u.deg
M3 = (249.663391 + 57420.7251593 * T) * u.deg
M4 = (266.183510 + 76560.6367950 * T) * u.deg
M5 = (79.398797 + 0.5042615 * T) * u.deg
- 0.00000571 * math.sin(M5.to("rad").value)
) * u.deg
return ra, dec, W
class _Venus(_Body):
parent = Sun
k = constants.GM_venus
name = "Venus"
symbol = "\u2640"
R = constants.R_venus
R_mean = constants.R_mean_venus
R_polar = constants.R_polar_venus
mass = k / G
J2 = constants.J2_venus
J3 = constants.J3_venus
ecc = 0.007 * u.one
@staticmethod
def _rot_elements_at_epoch(T, d):
ra = 272.76 * u.deg
dec = 67.16 * u.deg
W = (160.20 - 1.4813688 * d) * u.deg
return ra, dec, W
class _Earth(_Body):
parent = Sun
k = constants.GM_earth
name = "Earth"
ra = (299.36 + 0.70 * math.sin(N.to("rad").value)) * u.deg
dec = (43.46 - 0.51 * math.cos(N.to("rad").value)) * u.deg
W = (249.978 + 541.1397757 * d - 0.48 * math.sin(N.to("rad").value)) * u.deg
return ra, dec, W
class _Pluto(_Body):
parent = Sun
k = constants.GM_pluto
name = "Pluto"
symbol = "\u2647"
R = constants.R_pluto
R_mean = constants.R_mean_pluto
R_polar = constants.R_polar_pluto
mass = k / G
@staticmethod
def _rot_elements_at_epoch(T, d):
ra = 132.993 * u.deg
dec = -6.163 * u.deg
W = (302.695 + 56.3625225 * d) * u.deg
return ra, dec, W
Mercury = _Mercury()
Venus = _Venus()
Earth = _Earth()
Mars = _Mars()
Jupiter = _Jupiter()
dec = 67.16 * u.deg
W = (160.20 - 1.4813688 * d) * u.deg
return ra, dec, W
class _Earth(_Body):
parent = Sun
k = constants.GM_earth
name = "Earth"
symbol = "\u2641"
R = constants.R_earth
R_mean = constants.R_mean_earth
R_polar = constants.R_polar_earth
mass = k / G
J2 = constants.J2_earth
J3 = constants.J3_earth
H0 = constants.H0_earth
rho0 = constants.rho0_earth
@staticmethod
def _rot_elements_at_epoch(T, d):
ra = (0.00 - 0.641 * T) * u.deg
dec = (90.00 - 0.557 * T) * u.deg
W = (190.147 + 360.9856235 * d) * u.deg
return ra, dec, W
class _Mars(_Body):
parent = Sun
k = constants.GM_mars
return ra, dec, W
class _Earth(_Body):
parent = Sun
k = constants.GM_earth
name = "Earth"
symbol = "\u2641"
R = constants.R_earth
R_mean = constants.R_mean_earth
R_polar = constants.R_polar_earth
mass = k / G
J2 = constants.J2_earth
J3 = constants.J3_earth
H0 = constants.H0_earth
rho0 = constants.rho0_earth
@staticmethod
def _rot_elements_at_epoch(T, d):
ra = (0.00 - 0.641 * T) * u.deg
dec = (90.00 - 0.557 * T) * u.deg
W = (190.147 + 360.9856235 * d) * u.deg
return ra, dec, W
class _Mars(_Body):
parent = Sun
k = constants.GM_mars
name = "Mars"
symbol = "\u2642"
R = constants.R_mars
W = (160.20 - 1.4813688 * d) * u.deg
return ra, dec, W
class _Earth(_Body):
parent = Sun
k = constants.GM_earth
name = "Earth"
symbol = "\u2641"
R = constants.R_earth
R_mean = constants.R_mean_earth
R_polar = constants.R_polar_earth
mass = k / G
J2 = constants.J2_earth
J3 = constants.J3_earth
H0 = constants.H0_earth
rho0 = constants.rho0_earth
@staticmethod
def _rot_elements_at_epoch(T, d):
ra = (0.00 - 0.641 * T) * u.deg
dec = (90.00 - 0.557 * T) * u.deg
W = (190.147 + 360.9856235 * d) * u.deg
return ra, dec, W
class _Mars(_Body):
parent = Sun
k = constants.GM_mars
name = "Mars"
ltan: ~astropy.units.Quantity
Decimal hour between 0 and 24
Returns
-------
RAAN: ~astropy.units.Quantity
Right ascension of the ascending node angle in GCRS
Note
----
Calculations of the sun mean longitude and equation of time
follow "Fundamentals of Astrodynamics and Applications"
Fourth edition by Vallado, David A.
"""
T_UT1 = ((epoch.ut1 - constants.J2000).value / 36525.0) * u.deg
T_TDB = ((epoch.tdb - constants.J2000).value / 36525.0) * u.deg
# Apparent sun position
sun_position = coordinates.get_sun(epoch)
# Calculate the sun apparent local time
salt = sun_position.ra + 12 * u.hourangle
# Use the equation of time to calculate the mean sun local time (fictional sun without anomalies)
# sun mean anomaly
M_sun = 357.5291092 * u.deg + 35999.05034 * T_TDB
# sun mean longitude
l_sun = 280.460 * u.deg + 36000.771 * T_UT1
l_ecliptic_part2 = 1.914666471 * u.deg * np.sin(