dynamic_two_vector_frame¶
- giant.rotations.frames.dynamic_two_vector_frame(primary_vector_func, secondary_vector_func, primary_axis, secondary_axis, return_rotation=False)[source]¶
Create a dynamic (time dependent) 2-vector frame function.
This is particularly useful in conjunction with the spice interface functionality.
For instance, we can define a time dependent earth nadir frame using the following:
>>> from giant.utilities.spice_interface import SpicePosition >>> from giant.rotations import dynamic_two_vector_frame >>> from datetime import datetime >>> z_dir_fun = SpicePosition('EARTH', 'J2000', 'NONE', 'MY_SPACECRAFT') >>> x_const_fun = SpicePosition('SUN', 'J2000', 'NONE', 'MY_SPACECRAFT') >>> nadir_frame_fun = dynamic_two_vector_frame(z_dir_fun, x_const_fun, 'z', 'x', return_rotation=True) >>> current_rotation_inertial_to_nadir = nadir_frame_fun(datetime.now())
- Parameters:
primary_vector_func (Callable[[datetime | Timestamp], ndarray]) – Function that returns the primary vector for a given datetime
secondary_vector_func (Callable[[datetime | Timestamp], ndarray]) – Function that returns the constraint for the secondary vector for a given datetime
primary_axis (Literal['x', 'y', 'z']) – The axis corresponding to the primary vector
secondary_axis (Literal['x', 'y', 'z']) – The axis corresponding to the secondary vector
return_reotation – whether to return as a .Rotation object (True) or as a numpy array containing the rotation matrix
return_rotation (bool)
- Returns:
callable that returns the rotation matrix for a given datetime
- Return type:
Callable[[datetime | Timestamp], ndarray | Rotation]