Skip to content

Add IMAP_HRC frame to SpiceFrame enum and update science frames kernel to v1.2.0#2808

Merged
subagonsouth merged 8 commits intodevfrom
copilot/add-imap-hrc-frame-to-spiceframe
Mar 6, 2026
Merged

Add IMAP_HRC frame to SpiceFrame enum and update science frames kernel to v1.2.0#2808
subagonsouth merged 8 commits intodevfrom
copilot/add-imap-hrc-frame-to-spiceframe

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Adds the new IMAP_HRC (Heliospheric Ram Corotating) SPICE frame introduced in imap_science_120.tf to the SpiceFrame enum, updates all kernel references from v1.0.0 to v1.2.0, and makes the new frame available to L2 ENA maps.

Changes

  • New kernel imap_science_120.tf (v1.2.0): replaces imap_science_100.tf in both tests/spice/test_data/ and ultra/l1c/sim_spice_kernels/. Adds the IMAP_HRC frame at ID -43930 — a TWO-VECTOR parameterized frame with X aligned to the heliospheric ram direction and Z to the solar rotation axis (IAU_SUN), making it distinct from IMAP_HRE which uses the ecliptic normal for Z.

  • SpiceFrame enum (spice/geometry.py): added IMAP_HRC = -43930 after IMAP_GCS.

  • All kernel references updated from imap_science_100.tfimap_science_120.tf across 15 files.

  • ena_maps/utils/naming.py: refactored get_map_coord_frame to dynamically look up SpiceFrame[f"IMAP_{frame_str.upper()}"] in a try/except block instead of a hardcoded if/elif chain. Any KeyError (unrecognized frame) is re-raised as NotImplementedError, preserving existing error behavior. "hrc" added to _coord_frame_str_types.

class SpiceFrame(IntEnum):
    ...
    IMAP_GCS = -43929
    IMAP_HRC = -43930  # new: Heliospheric Ram Corotating
# Before: hardcoded if/elif per frame
# After: dynamic lookup — works for any current or future IMAP_* frame
try:
    return SpiceFrame[f"IMAP_{frame_str.upper()}"]
except KeyError:
    raise NotImplementedError(f"Coordinate frame {frame_str} is not yet implemented.")

Test Coverage

  • The existing test_spice_frame_enum iterates over all SpiceFrame members and asserts each maps to a valid frame ID in the loaded kernel — this automatically covers IMAP_HRC.
  • test_get_map_frame updated to assert "hrc"SpiceFrame.IMAP_HRC.
Original prompt

This section details on the original issue you should resolve

<issue_title>SPICE - Add IMAP_HRC frame to SpiceFrame</issue_title>
<issue_description>### Algorithm Description:

Nick has added the frame to the imap science frames kernel. This ticket is for adding that frame to the SpiceFrame enum.

  1. Add the new imap_science_120.tf to the repo in the tests/spice/test_data directory, replacing imap_science_100.tf
  2. Replace all references to imap_science_100.tf with the new imap_science_120.tf
  3. Add the new IMAP_HRC frame defined in the new imap science frame kernel to the SpiceFrame enum in spice/geometry.py
  4. Check test coverage of the SpiceFrame. There may be tests that iterate over SpiceFrame members that provide needed test coverage. If not, add test coverage exercising some geometry calculation using the new IMAP_HRC frame.
    </issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits March 3, 2026 22:20
Co-authored-by: subagonsouth <16110870+subagonsouth@users.noreply.github.com>
Co-authored-by: subagonsouth <16110870+subagonsouth@users.noreply.github.com>
Copilot AI changed the title [WIP] Add IMAP_HRC frame to SpiceFrame enum Add IMAP_HRC frame to SpiceFrame enum and update science frames kernel to v1.2.0 Mar 3, 2026
@subagonsouth
Copy link
Contributor

@copilot, please remove the old science frames kernel: imap_science_100.tf from the spice test_data directory.

Copilot AI and others added 2 commits March 4, 2026 15:49
…/test_data/

Co-authored-by: subagonsouth <16110870+subagonsouth@users.noreply.github.com>
Co-authored-by: subagonsouth <16110870+subagonsouth@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 4, 2026

@copilot, please remove the old science frames kernel: imap_science_100.tf from the spice test_data directory.

Done — removed imap_science_100.tf and added imap_science_120.tf to tests/spice/test_data/ in commits b068493 and 5a17e8c. (The file required force-adding since test_data/ is in .gitignore.)

Copy link
Contributor

@subagonsouth subagonsouth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@subagonsouth subagonsouth marked this pull request as ready for review March 4, 2026 23:12
@lacoak21
Copy link
Contributor

lacoak21 commented Mar 5, 2026

LGTM! Im not really sure what that new frame is but its not a blocker and ill ask at the next tagup.

@subagonsouth
Copy link
Contributor

@copilot,
I noticed that the new frame needs to be made available to L2 maps. See the function here: https://github.com/IMAP-Science-Operations-Center/imap_processing/blob/dev/imap_processing/ena_maps/utils/naming.py#L393

I suggest modifying that function to try instantiating the SpiceFrame using `f"IMAP_{frame.upper()}" or similar in a try/except block so that the frames don't need to be explicitly mapped in that function.

…pport

Co-authored-by: subagonsouth <16110870+subagonsouth@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 5, 2026

@copilot,
I noticed that the new frame needs to be made available to L2 maps. See the function here: https://github.com/IMAP-Science-Operations-Center/imap_processing/blob/dev/imap_...

Done in commit 174a0fa. get_map_coord_frame now uses SpiceFrame[f"IMAP_{frame_str.upper()}"] in a try/except block, so IMAP_HRC (and any future IMAP_* frames) are automatically available. I also added "hrc" to _coord_frame_str_types and a corresponding test assertion.

@jtniehof
Copy link
Collaborator

jtniehof commented Mar 5, 2026

LGTM! Im not really sure what that new frame is but its not a blocker and ill ask at the next tagup.

It's a frame that's oriented to the center of the IBEX ribbon which we suspect has something to do with an axis of symmetry in the interstellar medium (hand-wavey).

Copy link
Contributor

@tech3371 tech3371 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lacoak21
Copy link
Contributor

lacoak21 commented Mar 6, 2026

LGTM! Im not really sure what that new frame is but its not a blocker and ill ask at the next tagup.

It's a frame that's oriented to the center of the IBEX ribbon which we suspect has something to do with an axis of symmetry in the interstellar medium (hand-wavey).

Got it thanks!

@subagonsouth subagonsouth merged commit e946276 into dev Mar 6, 2026
14 checks passed
@subagonsouth subagonsouth deleted the copilot/add-imap-hrc-frame-to-spiceframe branch March 6, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SPICE - Add IMAP_HRC frame to SpiceFrame

5 participants