gcrf_to_lunar_fixed
- ssapy.utils.gcrf_to_lunar_fixed(r, t, v=None)[source][source]
Transform position and velocity vectors from the GCRF (Geocentric Celestial Reference Frame) to a Moon-fixed (lunar-centric) frame.
This function adjusts the position and velocity vectors to account for the Moon’s motion, effectively transforming them into a frame fixed to the Moon.
Parameters:
r (numpy array): Position vector(s) in the GCRF [x, y, z]. t (numpy array): Time(s) at which the position vector(s) are defined. v (numpy array, optional): Velocity vector(s) in the GCRF [vx, vy, vz]. If not provided, only position is transformed.
Returns:
- numpy array or tuple:
If v is not provided: Transformed position vector(s) in the Moon-fixed frame.
- If v is provided: A tuple containing:
r_lunar (numpy array): Transformed position vector(s) in the Moon-fixed frame.
v_lunar (numpy array): Transformed velocity vector(s) in the Moon-fixed frame.
Notes:
The get_body function is used to retrieve the Moon’s position at a given time.
The Moon’s position is subtracted from the transformed lunar-centric position to obtain a Moon-fixed reference frame.
If velocity is provided, it is recalculated in the Moon-fixed frame using the v_from_r function.