SpiceGravityDynamics

giant.ufo.dynamics:

class giant.ufo.dynamics.SpiceGravityDynamics(center_body, process_noise, other_bodies=None, gravity_parameters=None, load_data=False, minimum_time_step=0.001)[source]

This class implements a simple N-Body gravity dynamics model using Spice as the source of the planet locations.

To use this class, specify the central (primary body) as well as any bodies/barycenters you want to include as n-body sources through the center_body and other_bodies arguments respectively. The class will then automatically compute the gravity for you. Note that you should not include the central body in the list of n-body perturbations.

By default, this class will retrieve the GM values from spice for each body/barycenter being considered. You can override these values by specifying the key word argument gravity_parameters which should be a dictionary mapping the name of the planet to the gravity parameter.

This class can optionally furnsh the planetary ephemeris and planetary constants files for you if you so desire. This is controlled through key word argument load_data. If you provide this option, the class will attempt to locate the files in the data directory in the directory containing this file. If it cannot find the files there then it will ask you if it can download them from the naif site. If you have already loaded kernels that provide the required data (namely the name of the planets, the planetary GM (unless you are providing your own)), and the locations of the planets) then you should leave this option off as it could override the values you have already loaded.

The covariance in this dynamics model is integrated directly instead of using the state transformation matrix (because that is how I learned EKFs…). This means that the process noise is added to the covariance derivative directly (which may be different from what many are use to). Therefore be sure you carefully consider how to set the process noise when using this class.

Parameters:
  • center_body (str) – The center of integration (and the center of the integration frame)

  • process_noise (ndarray | Callable[[ndarray, float], ndarray]) – The process noise either as a numpy array of shape 7x7 (constant process noise) or as a callable object which takes in the current state and time (np.ndarray, float) and outputs a 7x7 numpy array containing the process noise matrix

  • other_bodies (List[str] | None) – Other bodies whose gravity should be included as a list of body/barycenter names. If None no other bodies will be considered.

  • gravity_parameters (Dict[str, float] | None) – A dictionary mapping names to GM values. If this is None or it does not provide the data for one of the bodies being considered we will try to query this from spice. The values should be in km**3/sec**2

  • load_data (bool) – A boolean flag specifying whether this class should furnsh the required datafiles. If you have already loaded files then you should leave this as False.

  • minimum_time_step (float | None) – The minimum time step to allow the integrator to take in seconds. If None (or 0) then no minimum time step is enforced.

Summary of Methods

compute_covariance_dynamics

This method computes the dynamics for the covariance matrix.

compute_dynamics

This method computes the dynamics for the state vector

compute_state_dynamics

This computes the dynamics for just the "state" part of the state vector (not the covariance)

get_gm

propagate

This method propagates the input state the the requested time.