imap_processing.spice.geometry.get_rotation_matrix#

imap_processing.spice.geometry.get_rotation_matrix(et: float | ndarray[tuple[int, ...], dtype[_ScalarType_co]], from_frame: SpiceFrame, to_frame: SpiceFrame, allow_spice_noframeconnect: bool = False) ndarray[tuple[int, ...], dtype[_ScalarType_co]]#

Get the rotation matrix/matrices that can be used to transform between frames.

If no transformation is defined for a specific time, a matrix of NaNs is returned.

This is a vectorized wrapper around spiceypy.pxform “Return the matrix that transforms position vectors from one specified frame to another at a specified epoch.” https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/pxform_c.html

Parameters:
  • et (float or np.ndarray) – Ephemeris time(s) for which to get the rotation matrices.

  • from_frame (SpiceFrame) – Reference frame to transform from.

  • to_frame (SpiceFrame) – Reference frame to transform to.

  • allow_spice_noframeconnect (bool) – If True, does not throw SPICE NOFRAMECONNECT error and returns a NaN matrix for those et`s where there is insufficient information available to transform from `from_frame to to_frame. Defaults to False.

Returns:

rotation – If et is a float, the returned rotation matrix is of shape (3, 3). If et is a np.ndarray, the returned rotation matrix is of shape (n, 3, 3) where n matches the number of elements in et. Some of the matrices in the output may be NaN if no transformation was available for the corresponding et and allow_spice_noframeconnect is True.

Return type:

np.ndarray