Skip to content

Commit

Permalink
code cov update
Browse files Browse the repository at this point in the history
  • Loading branch information
laspsandoval committed Aug 20, 2024
1 parent 1aa2890 commit 804c3ac
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion imap_processing/pointing_frame_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def average_quaternions(et_times: np.ndarray) -> tuple[np.ndarray, list[np.ndarr
body_quat = body_quat * np.sign(body_quat[0])

# Aggregate quaternions into a single matrix.
aggregate += np.outer(np.abs(body_quat), body_quat)
aggregate += np.outer(body_quat, body_quat)

# Reference: "On Averaging Rotations"
# Link: https://link.springer.com/content/pdf/10.1023/A:1011129215388.pdf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,35 @@ def et_times(create_kernel_list):
"""Tests get_coverage function."""
kernels, ck_kernel = create_kernel_list

with spice.KernelPool(kernels):
et_start, et_end, et_times = get_coverage(str(ck_kernel[0]))

return et_times


@pytest.mark.xfail(reason="Will fail unless kernels in pointing_frame/test_data.")
def test_get_coverage(create_kernel_list):
"""Tests get_coverage function."""
kernels, ck_kernel = create_kernel_list

with spice.KernelPool(kernels):
et_start, et_end, et_times = get_coverage(str(ck_kernel[0]))

assert et_start == 802008069.184905
assert et_end == 802094467.184905

return et_times

@pytest.mark.xfail(reason="Will fail unless kernels in pointing_frame/test_data.")
def test_average_quaternions(et_times, create_kernel_list):
"""Tests average_quaternions function."""

kernels, ck_kernel = create_kernel_list
with spice.KernelPool(kernels):
q_avg, z_eclip_time = average_quaternions(et_times)

# Generated from MATLAB code results
q_avg_expected = np.array([-0.6838, 0.5480, -0.4469, -0.1802])
np.testing.assert_allclose(q_avg, q_avg_expected, atol=1e-4)


@pytest.mark.xfail(reason="Will fail unless kernels in pointing_frame/test_data.")
Expand Down

0 comments on commit 804c3ac

Please sign in to comment.