Skip to content

Commit 5b3dacc

Browse files
committed
FIX: Update the rotation direction for the lo pivot angle
We need to rotate in the + pivot angle direction. There was an incorrect negative sign to rotate counter clockwise before.
1 parent 3fabb69 commit 5b3dacc

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

imap_processing/tests/spice/test_geometry.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
get_spacecraft_to_instrument_spin_phase_offset,
2020
imap_state,
2121
instrument_pointing,
22+
lo_instrument_pointing,
2223
solar_longitude,
2324
spherical_to_cartesian,
2425
)
@@ -515,6 +516,39 @@ def test_instrument_pointing_lo_ck(frame, furnish_kernels):
515516
_ = instrument_pointing(et, frame, SpiceFrame.ECLIPJ2000)
516517

517518

519+
@pytest.mark.parametrize(
520+
"pivot_angle, expected",
521+
[
522+
(0, [0.0, 0.0, 1.0]), # Aligned with SC +Z
523+
(75, [0.483, 0.837, 0.259]), # Rotated 75°
524+
(90, [0.5, 0.866, 0.0]), # Rotated 90° (perpendicular to SC +Z)
525+
(105, [0.483, 0.837, -0.259]), # Rotated 105°
526+
],
527+
)
528+
def test_lo_instrument_pointing_pivot_angle(pivot_angle, expected, furnish_kernels):
529+
kernels = ["imap_130.tf"]
530+
with furnish_kernels(kernels):
531+
et = 0 # Use fixed frames, no time-dependent kernels needed
532+
533+
# Get Lo boresight in spacecraft frame
534+
boresight_sc = lo_instrument_pointing(
535+
et, pivot_angle, SpiceFrame.IMAP_SPACECRAFT, cartesian=True
536+
)
537+
538+
# Verify angle from spacecraft +Z axis equals pivot angle
539+
sc_z_axis = np.array([0, 0, 1])
540+
angle_from_sc_z = np.rad2deg(
541+
np.arccos(np.clip(np.dot(boresight_sc, sc_z_axis), -1, 1))
542+
)
543+
np.testing.assert_allclose(angle_from_sc_z, pivot_angle, atol=1e-8)
544+
545+
# Verify components match expected values
546+
np.testing.assert_allclose(boresight_sc, expected, atol=1e-3)
547+
548+
# Verify boresight is a unit vector
549+
np.testing.assert_allclose(np.linalg.norm(boresight_sc), 1.0, atol=1e-10)
550+
551+
518552
@pytest.mark.external_kernel
519553
def test_basis_vectors(imap_ena_sim_metakernel):
520554
"""Test coverage for basis_vectors()."""

0 commit comments

Comments
 (0)