Celestial Bodies
Celestial body definitions including physical properties and rotational elements.
Supported Bodies
Lox supports the standard NAIF/SPICE body identifiers for:
- Planets (Mercury through Neptune)
- Planetary barycenters
- Natural satellites (major moons)
- The Sun
- Solar system barycenter
Quick Example
import lox_space as lox
# Create by name or ID
earth = lox.Origin("Earth")
moon = lox.Origin("Moon")
mars = lox.Origin(499) # NAIF ID
# Access properties
print(f"Earth radius: {earth.mean_radius():.1f} km")
print(f"Earth GM: {earth.gravitational_parameter():.6e} km³/s²")
# Rotational elements at a given epoch
et = 0.0 # Ephemeris time (seconds from J2000)
ra, dec, w = earth.rotational_elements(et)
Origin
Represents a celestial body (planet, moon, barycenter, etc.).
Origin objects represent celestial bodies using NAIF/SPICE identifiers. They provide access to physical properties such as gravitational parameters, radii, and rotational elements.
Parameters:
-
–originBody name (e.g., "Earth", "Moon") or NAIF ID (e.g., 399 for Earth).
Raises:
-
ValueError–If the origin name or ID is not recognized.
-
TypeError–If the argument is neither a string nor an integer.
Examples:
>>> earth = lox.Origin("Earth")
>>> moon = lox.Origin("Moon")
>>> mars = lox.Origin(499) # NAIF ID
Methods:
-
declination–Return the declination of the pole in radians.
-
declination_rate–Return the rate of change of declination in radians/second.
-
equatorial_radius–Return the equatorial radius in km.
-
gravitational_parameter–Return the gravitational parameter (GM) in km³/s².
-
id–Return the NAIF ID of this body.
-
mean_radius–Return the mean radius in km.
-
name–Return the name of this body.
-
polar_radius–Return the polar radius in km.
-
radii–Return the triaxial radii (x, y, z) in km.
-
right_ascension–Return the right ascension of the pole in radians.
-
right_ascension_rate–Return the rate of change of right ascension in radians/second.
-
rotation_angle–Return the rotation angle (prime meridian) in radians.
-
rotation_rate–Return the rotation rate in radians/second.
-
rotational_element_rates–Return rotational element rates in radians/second.
-
rotational_elements–Return rotational elements (right ascension, declination, rotation angle) in radians.
declination_rate
Return the rate of change of declination in radians/second.
gravitational_parameter
gravitational_parameter() -> float
Return the gravitational parameter (GM) in km³/s².
right_ascension
Return the right ascension of the pole in radians.
right_ascension_rate
Return the rate of change of right ascension in radians/second.
rotation_angle
Return the rotation angle (prime meridian) in radians.
rotational_element_rates
Return rotational element rates in radians/second.