Skip to content
21 changes: 8 additions & 13 deletions imap_processing/ena_maps/utils/naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MappableInstrumentShortName(Enum):
# Must be specified separately for purpose of type checking vs comparison
valid_spice_frame_strings = ["sf", "hf", "hk"]
_spice_frame_str_types = Literal["sf", "hf", "hk"]
_coord_frame_str_types = Literal["hae", "hre", "hnu", "gcs"]
_coord_frame_str_types = Literal["hae", "hre", "hnu", "gcs", "hrc"]

# Mapping of inertial frames to their longer names used in logical source descriptors
INERTIAL_FRAME_LONG_NAMES = {
Expand Down Expand Up @@ -414,18 +414,13 @@ def get_map_coord_frame(frame_str: _coord_frame_str_types) -> SpiceFrame:
NotImplementedError
If the frame string is not recognized.
"""
if frame_str == "hae":
return SpiceFrame.IMAP_HAE
elif frame_str == "hre":
return SpiceFrame.IMAP_HRE
elif frame_str == "hnu":
return SpiceFrame.IMAP_HNU
elif frame_str == "gcs":
return SpiceFrame.IMAP_GCS
else:
raise NotImplementedError(
f"Coordinate frame {frame_str} is not yet implemented."
)
try:
return SpiceFrame[f"IMAP_{frame_str.upper()}"]
except KeyError as err:
raise KeyError(
f"Coordinate frame {frame_str} which translates to "
f"SPICE frame IMAP_{frame_str.upper()} is not recognized."
) from err

def to_empty_map(
self,
Expand Down
3 changes: 2 additions & 1 deletion imap_processing/spice/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class SpiceFrame(IntEnum):
IMAP_GLOWS = -43750

# IMAP Science Frames (new additions from imap_science_xxx.tf)
# IMAP_OMD appears to have a bad definition in imap_science_100.tf
# IMAP_OMD appears to have a bad definition in imap_science_120.tf
# Commenting it out for now.
# IMAP_OMD = -43900
IMAP_EARTHFIXED = -43910
Expand All @@ -87,6 +87,7 @@ class SpiceFrame(IntEnum):
IMAP_HRE = -43927
IMAP_HNU = -43928
IMAP_GCS = -43929
IMAP_HRC = -43930


BORESIGHT_LOOKUP = {
Expand Down
2 changes: 1 addition & 1 deletion imap_processing/spice/pointing_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def calculate_pointing_attitude_segments(
- Latest NAIF leapseconds kernel (naif0012.tls)
- The latest IMAP sclk (imap_sclk_NNNN.tsc)
- The latest IMAP frame kernel (imap_###.tf)
- IMAP DPS frame kernel (imap_science_100.tf)
- IMAP DPS frame kernel (imap_science_120.tf)
- IMAP historical attitude kernel from which the pointing frame kernel will
be generated.
"""
Expand Down
2 changes: 1 addition & 1 deletion imap_processing/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def imap_ena_sim_metakernel(furnish_kernels, _download_kernels):
"sim_1yr_imap_attitude.bc",
"imap_130.tf",
"de440s.bsp",
"imap_science_100.tf",
"imap_science_120.tf",
"sim_1yr_imap_pointing_frame.bc",
]
with furnish_kernels(kernels) as k:
Expand Down
3 changes: 2 additions & 1 deletion imap_processing/tests/ena_maps/test_naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,10 @@ def test_get_map_frame(
assert MapDescriptor.get_map_coord_frame("hre") is SpiceFrame.IMAP_HRE
assert MapDescriptor.get_map_coord_frame("hnu") is SpiceFrame.IMAP_HNU
assert MapDescriptor.get_map_coord_frame("gcs") is SpiceFrame.IMAP_GCS
assert MapDescriptor.get_map_coord_frame("hrc") is SpiceFrame.IMAP_HRC

# Test with not implemented 'hgi'
with pytest.raises(NotImplementedError):
with pytest.raises(KeyError, match="Coordinate frame hgi"):
MapDescriptor.get_map_coord_frame("hgi")

def test_get_output_map_structure_from_descriptor_string(self):
Expand Down
2 changes: 1 addition & 1 deletion imap_processing/tests/glows/test_glows_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def test_hist_spice_output(
"de440s.bsp",
"imap_sclk_0000.tsc",
"imap_130.tf",
"imap_science_100.tf",
"imap_science_120.tf",
"sim_1yr_imap_attitude.bc",
"sim_1yr_imap_pointing_frame.bc",
]
Expand Down
2 changes: 1 addition & 1 deletion imap_processing/tests/hi/test_hi_l2.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def test_create_sky_map_from_psets(
"""Test coverage for create_sky_map_from_psets()"""
kernels = [
"imap_sclk_0000.tsc",
"imap_science_100.tf",
"imap_science_120.tf",
"naif0012.tls",
"imap_spk_demo.bsp",
"de440s.bsp",
Expand Down
2 changes: 1 addition & 1 deletion imap_processing/tests/ialirt/unit/test_ialirt_spice.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test_transform_instrument_vectors_to_inertial_single(furnish_kernels):
"""Test real-world application of this function."""

kernels = [
"imap_science_100.tf",
"imap_science_120.tf",
"imap_130.tf",
"naif0012.tls",
"de440s.bsp",
Expand Down
4 changes: 2 additions & 2 deletions imap_processing/tests/ialirt/unit/test_parse_mag.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def test_transform_to_frames(furnish_kernels, spice_test_data_path):
"""Test transform_to_frames over multiple spin phases."""

kernels = [
"imap_science_100.tf",
"imap_science_120.tf",
"imap_130.tf",
"naif0012.tls",
"de440s.bsp",
Expand Down Expand Up @@ -640,7 +640,7 @@ def test_process_packet(
):
"""Test the process_packet function."""
kernels = [
"imap_science_100.tf",
"imap_science_120.tf",
"imap_130.tf",
"naif0012.tls",
"de440s.bsp",
Expand Down
2 changes: 1 addition & 1 deletion imap_processing/tests/mag/test_mag_l1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def test_calculate_spin_offsets(
"naif0012.tls",
"imap_sclk_0000.tsc",
"imap_130.tf",
"imap_science_100.tf",
"imap_science_120.tf",
"sim_1yr_imap_attitude.bc",
"sim_1yr_imap_pointing_frame.bc",
]
Expand Down
Loading