pyRTX.classes.Precompute

Classes

Precompute(epochs)

A class to perform and store SPICE computations in advance.

class pyRTX.classes.Precompute.Precompute(epochs: list)[source]

A class to perform and store SPICE computations in advance.

This class allows users to precompute and store various SPICE data, such as position and state vectors, and rotation matrices, for a given set of epochs. This can significantly speed up computations that require repeated calls to SPICE.

__init__(epochs: list)[source]

Initializes the Precompute object.

Parameters:

epochs (list) – A list of epochs in TDB seconds past J2000 for which to perform the precomputations.

addPosition(observer: str, target: str, frame: str, correction: str = 'CN')[source]

Adds a position vector computation to the precomputation list.

Parameters:
  • observer (str) – The name of the observing body.

  • target (str) – The name of the target body.

  • frame (str) – The reference frame for the computation.

  • correction (str, default 'CN') – The aberration correction to use.

addState(observer: str, target: str, frame: str, correction: str = 'CN')[source]

Adds a state vector computation to the precomputation list.

Parameters:
  • observer (str) – The name of the observing body.

  • target (str) – The name of the target body.

  • frame (str) – The reference frame for the computation.

  • correction (str, default 'CN') – The aberration correction to use.

addRotation(base_frame: str, target_frame: str)[source]

Adds a rotation matrix computation to the precomputation list.

Parameters:
  • base_frame (str) – The base reference frame.

  • target_frame (str) – The target reference frame.

precomputeSolarPressure(sc, planet, correction='LT+S')[source]

Adds all necessary computations for solar radiation pressure to the precomputation list.

Parameters:
  • sc (pyRTX.Spacecraft) – The spacecraft object.

  • planet (pyRTX.Planet) – The planet object.

  • correction (str, default 'LT+S') – The aberration correction to use.

precomputePlanetaryRadiation(sc, planet, moving_frames=[], correction='CN')[source]

Adds all necessary computations for planetary radiation to the precomputation list.

Parameters:
  • sc (pyRTX.Spacecraft) – The spacecraft object.

  • planet (pyRTX.Planet) – The planet object.

  • moving_frames (list, optional) – A list of any additional moving frames to precompute.

  • correction (str, default 'CN') – The aberration correction to use.

precomputeDrag(sc, planet_name, moving_frames=[], accel_frame='', correction='LT+S')[source]

Adds all necessary computations for drag to the precomputation list.

Parameters:
  • sc (pyRTX.Spacecraft) – The spacecraft object.

  • planet_name (str) – The name of the planet.

  • moving_frames (list, optional) – A list of any additional moving frames to precompute.

  • accel_frame (str, optional) – The reference frame for the acceleration.

  • correction (str, default 'LT+S') – The aberration correction to use.

dump()[source]

Performs all the precomputations and stores the results in an xarray Dataset.

getPosition(epoch, observer: str, target: str, frame: str, correction: str)[source]

Retrieves a precomputed position vector.

Parameters:
  • epoch (float) – The epoch for which to retrieve the position.

  • observer (str) – The name of the observing body.

  • target (str) – The name of the target body.

  • frame (str) – The reference frame of the position vector.

  • correction (str) – The aberration correction used.

Returns:

The position vector.

Return type:

numpy.ndarray

getState(epoch, observer: str, target: str, frame: str, correction: str)[source]

Retrieves a precomputed state vector.

Parameters:
  • epoch (float) – The epoch for which to retrieve the state.

  • observer (str) – The name of the observing body.

  • target (str) – The name of the target body.

  • frame (str) – The reference frame of the state vector.

  • correction (str) – The aberration correction used.

Returns:

The state vector.

Return type:

numpy.ndarray

getRotation(epoch, base_frame: str, target_frame: str)[source]

Retrieves a precomputed rotation matrix.

Parameters:
  • epoch (float) – The epoch for which to retrieve the rotation matrix.

  • base_frame (str) – The base reference frame.

  • target_frame (str) – The target reference frame.

Returns:

The rotation matrix.

Return type:

numpy.ndarray

getArray()[source]

Returns the entire xarray Dataset of precomputed values.

Returns:

The Dataset of precomputed values.

Return type:

xarray.Dataset

save(filename: str, complev: int = 1)[source]

Saves the precomputed data to a NetCDF file.

Parameters:
  • filename (str) – The path to the output file.

  • complev (int, default 1) – The compression level for the output file.

pxform_convert(pxform)[source]

Converts a 3x3 SPICE rotation matrix to a 4x4 transformation matrix.

Parameters:

pxform (numpy.ndarray) – The 3x3 rotation matrix.

Returns:

The 4x4 transformation matrix.

Return type:

numpy.ndarray