GravityParameters#

class VSPEC.params.planet.GravityParameters(mode: str, value: astropy.units.Quantity)#

Bases: BaseParameters

Class representing gravity parameters.

Parameters:
  • mode (str) – The mode of the gravity parameter. Valid options are ‘g’, ‘rho’, and ‘kg’.

  • value (astropy.units.Quantity) – The value of the gravity parameter.

Notes

  • The available modes and their corresponding units are:
    • ‘g’: meters per second squared (\({\rm m~s}^{-2}\))

    • ‘rho’: grams per cubic centimeter (\({\rm g~cm}^{-3}\))

    • ‘kg’: kilograms (kg)

Examples

>>> GravityParameters('g',1000*u.cm/u.s).value
10.0

A GravityParameters object can also be created from a dictionary.

>>> d = {'mode':'kg','value':1*u.M_earth}
>>> grav = GravityParameters.from_dict(d)
>>> grav.mode
'kg'
>>> grav.value
5.972e+24

It can also write a dictionary to be read by PSG.

>>> grav.to_psg()
{'OBJECT-GRAVITY': 5.9720e+24, 'OBJECT-GRAVITY-UNIT': 'kg'}
value#

The value of the gravity parameter to upload to PSG

Type:

float

mode#

The mode of the gravity parameter.

Type:

str

classmethod from_dict(d: dict, *args)#

Construct a GravityParameters object from a dictionary.

Parameters:

d (dict) – The dictionary to use to construct the class.

Returns:

The constructed class instance.

Return type:

GravityParameters

Notes

This constructor assumes d contains the keys 'mode' and 'value'

property value#

The value of the gravity parameter converted to the appropriate unit based on the mode.

Returns:

The value of the gravity parameter.

Return type:

float