imap_processing.spice.geometry.basis_vectors#
- imap_processing.spice.geometry.basis_vectors(et: float | ndarray[tuple[int, ...], dtype[_ScalarType_co]], from_frame: SpiceFrame, to_frame: SpiceFrame) ndarray[tuple[int, ...], dtype[_ScalarType_co]]#
Get the basis vectors of the from_frame expressed in the to_frame.
The rotation matrix defining a frame transform are the basis vectors of the from_frame expressed in the to_frame. This function just transposes each rotation matrix retrieved from the get_rotation_matrix function so that basis vectors can be indexed 0 for x, 1 for y, and 2 for z.
- 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.
- Returns:
basis_vectors – If et is a float, the returned basis vector matrix is of shape (3, 3). If et is a np.ndarray, the returned basis vector matrix is of shape (n, 3, 3) where n matches the number of elements in et and basis vectors are the rows of the 3 by 3 matrices.
- Return type:
np.ndarray
Examples
>>> from imap_processing.spice.geometry import basis_vectors ... from imap_processing.spice.time import ttj2000ns_to_et ... et = ttj2000ns_to_et(dataset.epoch.values) ... basis_vectors = basis_vectors( ... et, SpiceFrame.IMAP_SPACECRAFT, SpiceFrame.ECLIPJ2000 ... ) ... spacecraft_x = basis_vectors[:, 0] ... spacecraft_y = basis_vectors[:, 1] ... spacecraft_z = basis_vectors[:, 2]