Skip to content

Commit

Permalink
kernels code pr response
Browse files Browse the repository at this point in the history
  • Loading branch information
laspsandoval committed Sep 11, 2024
1 parent 5c74385 commit 6d5fd21
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions imap_processing/spice/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,13 @@ def create_pointing_frame(pointing_frame_path: Path, ck_path: Path) -> None:
ck_path : Path
Location of the CK kernel.
References
----------
https://numpydoc.readthedocs.io/en/latest/format.html#references
Notes
-----
Kernels required to be furnished:
"imap_science_0001.tf",
"imap_sclk_0000.tsc",
"imap_sim_ck_2hr_2secsampling_with_nutation.bc" or
"IMAP_spacecraft_attitude.bc",
"sim_1yr_imap_attitude.bc",
"imap_wkcp.tf",
"naif0012.tls"
Expand All @@ -230,6 +226,10 @@ def create_pointing_frame(pointing_frame_path: Path, ck_path: Path) -> None:
TODO: Figure out how we want to handle the file size becoming too large.
- For now we can only furnish a single ck kernel.
TODO: This will not be the case once we add the ability to query the .csv.
References
----------
https://numpydoc.readthedocs.io/en/latest/format.html#references
"""
# Get IDs.
# https://spiceypy.readthedocs.io/en/main/documentation.html#spiceypy.spiceypy.gipool
Expand Down
Binary file not shown.
20 changes: 10 additions & 10 deletions imap_processing/tests/spice/test_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def multiple_pointing_kernels(spice_test_data_path):
required_kernels = [
"imap_science_0001.tf",
"imap_sclk_0000.tsc",
"IMAP_spacecraft_attitude.bc",
"sim_1yr_imap_attitude.bc",
"imap_wkcp.tf",
"naif0012.tls",
]
Expand Down Expand Up @@ -225,43 +225,43 @@ def test_multiple_attempts(pointing_frame_kernels, tmp_path, spice_test_data_pat
assert num_intervals == 1


def test_multiple_pointings(multiple_pointing_kernels, spice_test_data_path):
def test_multiple_pointings(pointing_frame_kernels, spice_test_data_path, tmp_path):
"""Tests create_pointing_frame function with multiple pointing kernels."""
spice.furnsh(multiple_pointing_kernels)
spice.furnsh(pointing_frame_kernels)

create_pointing_frame(
pointing_frame_path=spice_test_data_path / "imap_pointing_frame.bc",
ck_path=spice_test_data_path / "IMAP_spacecraft_attitude.bc",
pointing_frame_path=tmp_path / "imap_pointing_frame.bc",
ck_path=spice_test_data_path / "imap_sim_ck_2hr_2secsampling_with_nutation.bc",
)
ck_cover_pointing = spice.ckcov(
str(spice_test_data_path / "imap_pointing_frame.bc"),
str(tmp_path / "imap_pointing_frame.bc"),
-43901,
True,
"INTERVAL",
0,
"TDB",
)
num_intervals = spice.wncard(ck_cover_pointing)
et_start_pointing, et_end_pointing = spice.wnfetd(ck_cover_pointing, 365)
et_start_pointing, et_end_pointing = spice.wnfetd(ck_cover_pointing, 0)

ck_cover = spice.ckcov(
str(spice_test_data_path / "IMAP_spacecraft_attitude.bc"),
str(spice_test_data_path / "imap_sim_ck_2hr_2secsampling_with_nutation.bc"),
-43000,
True,
"INTERVAL",
0,
"TDB",
)
num_intervals_expected = spice.wncard(ck_cover)
et_start_expected, et_end_expected = spice.wnfetd(ck_cover, 365)
et_start_expected, et_end_expected = spice.wnfetd(ck_cover, 0)

assert num_intervals == num_intervals_expected
assert et_start_pointing == et_start_expected
assert et_end_pointing == et_end_expected

et_times = _get_et_times(et_start_pointing, et_end_pointing)

spice.furnsh(str(spice_test_data_path / "imap_pointing_frame.bc"))
spice.furnsh(str(tmp_path / "imap_pointing_frame.bc"))
rotation_matrix_1 = spice.pxform("ECLIPJ2000", "IMAP_DPS", et_times[100])
rotation_matrix_2 = spice.pxform("ECLIPJ2000", "IMAP_DPS", et_times[1000])

Expand Down

0 comments on commit 6d5fd21

Please sign in to comment.