|
19 | 19 | get_spacecraft_to_instrument_spin_phase_offset, |
20 | 20 | imap_state, |
21 | 21 | instrument_pointing, |
| 22 | + lo_instrument_pointing, |
22 | 23 | solar_longitude, |
23 | 24 | spherical_to_cartesian, |
24 | 25 | ) |
@@ -515,6 +516,39 @@ def test_instrument_pointing_lo_ck(frame, furnish_kernels): |
515 | 516 | _ = instrument_pointing(et, frame, SpiceFrame.ECLIPJ2000) |
516 | 517 |
|
517 | 518 |
|
| 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 | + |
518 | 552 | @pytest.mark.external_kernel |
519 | 553 | def test_basis_vectors(imap_ena_sim_metakernel): |
520 | 554 | """Test coverage for basis_vectors().""" |
|
0 commit comments