-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove SpiceId(NamedTuple) Parameterize test to cover single and iterable ET input Change typing on ensure_spice to apease mypy Fix up ensure_spice decorator factory typing
- Loading branch information
1 parent
f3ec1af
commit 0b87688
Showing
3 changed files
with
77 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,25 @@ | ||
"""Tests coverage for imap_processing/spice/geometry.py""" | ||
|
||
import numpy as np | ||
import pytest | ||
|
||
from imap_processing.spice.geometry import ( | ||
SpiceBody, | ||
SpiceFrame, | ||
ensured_spkezr, | ||
imap_state, | ||
) | ||
|
||
|
||
def test_imap_state(use_test_metakernel): | ||
@pytest.mark.parametrize( | ||
"et", | ||
[ | ||
798033670, | ||
np.linspace(798033670, 798033770), | ||
], | ||
) | ||
def test_imap_state(et, use_test_metakernel): | ||
"""Test coverage for imap_state()""" | ||
et = np.linspace(798033670, 798034670) | ||
state = imap_state(et, observer=SpiceBody.EARTH) | ||
assert len(state) == len(et) | ||
|
||
|
||
def test_ensured_spkezr(use_test_metakernel): | ||
"""Test coverage for ensured_spkezr()""" | ||
# The imap_spk_demo.bsp kernel provides ephemeris coverage for 2025-04-15 to | ||
# 2026-04-16. The kernel provides the IMAP ephemeris relative to Earth, so | ||
# only the position relative to Earth can be queried without loading | ||
# additional kernels. | ||
# The queried ET, 798033670 is ~2025-04-16T00:00:00.0 | ||
state, lt = ensured_spkezr( | ||
SpiceBody.IMAP.name, | ||
798033670, | ||
SpiceFrame.ECLIPJ2000.name, | ||
"NONE", | ||
SpiceBody.EARTH.name, | ||
) | ||
assert state.shape == (6,) | ||
assert isinstance(lt, float) | ||
if hasattr(et, "__len__"): | ||
np.testing.assert_array_equal(state.shape, (len(et), 6)) | ||
else: | ||
assert state.shape == (6,) |