3. CelestialBody#

class CelestialBody(name: str, mass: ArrayWUnits, mean_radius: ArrayWUnits, grav_param: ArrayWUnits, base_frame: Frame, spice_id: int | str = None, gs_list: list = [])#

Bases: Body

Defines an astronomical body like the Sun, a planet, dwarf planet, moon, asteroid, or comet.

Parameters:
  • name (str) – The written name of the CelestialBody.

  • mass (ArrayWUnits) – The mass of the CelestialBody. Recommend expressed in units of kilograms.

  • mean_radius (ArrayWUnits) – The mean radius of the CelestialBody. Recommend expressed in units of kilometers.

  • grav_param (ArrayWUnits) – The gravitational parameter of the CelestialBody. Recommend expressed in units of \(\frac{km^3}{s^2}\).

  • base_frame (Frame) – The body-centered, body-fixed reference frame attached to the CelestialBody.

  • spice_id (int or str, optional) – The NAIF ID code of the object. May be given as an integer ID or as a string. Defaults to None.

  • gs_list (list, optional) – A list containing all of the ground stations on the surface of the CelestialBody. Defaults to [].

See also

scarabaeus.Constants

List of Scarabaeus-defined planetary constants.

scarabaeus.Frame

Scarabaeus’ representation of reference frames.

Examples

Create a CelestialBody object with numerical values that are half that of Jupiter, from the Constants library.

# initial setup
import scarabaeus as scb

# get planetary values from Constants
jov_constants = scb.Constants.jupiter

# define the celestial body
half_jupiter = scb.CelestialBody(
    name        = "HALF JUPITER",
    mass        = jov_constants["mass"] / 2,
    mean_radius = jov_constants["radius"] / 2,
    grav_param  = jov_constants["mu"] / 2,
    base_frame  = scb.Frame('IAU_JUPITER')
    spice_id    = 5,
    gs_list     = []
)

>>> jupiter.disp_properties()
                            HALF JUPITER
===================================================================
mass                     : 9.490623355393134e+26 kg
mean_radius              : 35746.0 km
gravitational parameter  : 63343267.460900396 mu
reference frame          : IAU_JUPITER (599 - JUPITER)
SPICE ID                 : -599
attached ground stations : []

Attributes

base_frame

The reference frame attached to the CelestialBody.

grav_param

The gravitational parameter of the CelestialBody given, by convention, in units of \(\frac{km^3}{s^2}\).

gs_list

All GroundStation objects attached to the surface of the CelestialBody.

mass

The mass of the Body object.

mean_radius

The mean radius of the CelestialBody.

name

The name of the Body object.

spice_id

The SPICE ID of the Body object.

Methods

add_ground_station(gs_to_add)

Adds a new GroundStation object to the list of ground stations attached to the CelestialBody object.

disp_properties()

Displays all properties of the CelestialBody object in a readable format.

from_constants(cb_name)

Creates a CelestialBody object from a given name using its respective values as defined in Scarabaeus' Constants library.

get_state(epoch_0[, reference_frame, origin])

Retrieves the state of the body relative to a given origin in a specified reference frame.

classmethod from_constants(cb_name: str) Self#

Creates a CelestialBody object from a given name using its respective values as defined in Scarabaeus’ Constants library.

Parameters:

cb_name (str) – The name of the desired celestial body to create a Scarabaeus CelestialBody object for.

Returns:

cb_out – A CelestialBody object initialized with all relevant values as defined by the given constant value.

Return type:

CelestialBody

Raises:

not_def_err – Raised when the given cb_name does not match an object in Scarabaeus’ constants library.

See also

scarabaeus.Constants

Scarabaeus’ constants library.

Notes

This method performs the same functionality as manually accessing each of the pertinent Constants values and assigning them by normal construction. It is a faster alternative when initalizing CelestialBody objects by values from Constants.

add_ground_station(gs_to_add) None#

Adds a new GroundStation object to the list of ground stations attached to the CelestialBody object.

Parameters:

gs_to_add (GroundStation or list of GroundStations) – In the case of adding one ground station: a single GroundStation object. In the case of adding multiple ground stations: a list of GroundStation objects.

Return type:

None

disp_properties() None#

Displays all properties of the CelestialBody object in a readable format.

property base_frame: Frame#

The reference frame attached to the CelestialBody.

property grav_param: ArrayWUnits#

The gravitational parameter of the CelestialBody given, by convention, in units of \(\frac{km^3}{s^2}\).

property gs_list: list[GroundStation]#

All GroundStation objects attached to the surface of the CelestialBody.

property mean_radius: ArrayWUnits#

The mean radius of the CelestialBody.