Constants#

Last revised by M. Pugliatti on 2025 FEB 4

In SCB, constants are defined in the constants.py library and are divided into:

  1. Universal constants: contains values related to universal constants such as the speed of light c, the universal gravitational constant G, etc.

  2. Planetary bodies: contains values related to mass, GM, radius, spice ID, etc. of planetary bodies

Values can be either defined by hand or from the scipy.constants method and are saved in dictionaries.

Load constants#

There are 3 methods to load constants in a script:

Method (1): Load all constants#

import scarabaeus as scb
# Import costants
from scarabaeus import Constants

Method (2): Load only the universal constants#

from scarabaeus.Constants import CONSTANTS

this is used to load only the universal constants.

Method (3): Load constants running an initialization script#

Constants are automatically loaded when running an initialization script

from scarabaeus.scb_initialize import *

Access constants#

Once loaded, constants can be accessed in this way:

Universal constants#

To access the universal constants saved in the dictionary you can run:

Constants.CONSTANTS["G"]

The dictionary is made of 3 values: - [0] The value, saved as an ArrayWUnits - [1] The name, saved as an string - [2] The reference, saved as an string, that indicates the origin of the value.

You can access these as:

Constants.CONSTANTS["G"][0]
Constants.CONSTANTS["G"][1]
Constants.CONSTANTS["G"][2]

Planetary constants#

Planetary constants are called by planetary body’s name as dictionary:

Constants.earth

You can access the various fields as:

Constants.earth["name"]
Constants.earth["spice_name"]
Constants.earth["ref_name"]
Constants.earth["SPICE_ID"]
Constants.earth["mass"]
Constants.earth["mu"]
Constants.earth["radius"]