SpiceState

giant.utilities.spice_interface:

class giant.utilities.spice_interface.SpiceState(target, reference_frame, corrections, observer)[source]

This class creates a callable that returns the state vector (position and velocity, km and km/s respectively) of one object to another given a python datetime.

This class works by storing the “static” inputs to the call to the spice function spkezr (specifically the target, reference frame, corrections, and observer). In addition, this class provides access to the light time computation from spice using light_time() and both the state and light time using state_light_time(). The interface to spice is provided through spiceypy.

For more details, refer to the NAIF spice documentation for spkezr at https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/spkezr.html.

This class should be preferred over the create_callable_state() because it works much better with pickle and provides more functionality.

Parameters:
  • target (str) – The name/integer spice id for the object we are computing the state vector to as a string.

  • reference_frame (str) – The frame we are computing the state vector in as a string

  • corrections (str) – The corrections to use when computing the state vector (usually for GIANT this should be 'NONE'

  • observer (str) – The name/integer spice id for the object we are computing the state vector from as a string.

target: str

The object we are computing the state vector to as a string.

This usually is the name of the object or its integer spice id as a string. This is passed to the TARG input for spkezr.

reference_frame: str

The frame we are to compute the state vector in as a string

For GIANT this should usually be the inertial frame 'J200'. This is passed to the REF input for spkezr.

corrections: str

The corrections we are to apply when computing the state vector.

Valid inputs are 'NONE' for no correction, 'LT' for light time only corrections, 'LT+S' for light time plus stellar aberration corrections, 'CN' for converged light time only corrections, 'CN+S' for converged light time plus aberration corrections, 'XLT' for transmission light time only, 'XLT+S` for transmission light time and stellar aberration, ``'XCN' for transmission converged light time only, and 'XCN+S' for transmission converged light time plus stellar aberration.

For GIANT this should usually be 'NONE' since it does its own corrections. This is passed to the ABCORR input for spkezr.

observer: str

The object we are computing the state vector from as a string.

This usually is the name of the object or its integer spice id as a string. This is passed to the OBS input for spkezr.

Summary of Methods

light_time

Make the call to spkezr given the stored settings at the input date returning only the light time in TDB seconds.

position_light_time

Make the call to spkezr given the stored settings at the input date returning both the state vector in kilometers and kilometers per second and the light time in TDB seconds.