Skip to content

Hi L1C: record matched gain_config_id in PSET - #3624

Open
tmplummer wants to merge 2 commits into
IMAP-Science-Operations-Center:devfrom
tmplummer:3617-hi-l1c---record-matched-gain_config_id-in-pset-for-l2-gain-config-combination
Open

tmplummer wants to merge 2 commits into
IMAP-Science-Operations-Center:devfrom
tmplummer:3617-hi-l1c---record-matched-gain_config_id-in-pset-for-l2-gain-config-combination

Conversation

@tmplummer

Copy link
Copy Markdown
Contributor

Change Summary

Overview

Closes #3617. L1C now records the pointing's matched gain config in the PSET so L2 can combine gain configs (#3619).

  • gain_config_id global attribute set to the matched ID, or NaN if no config matches.
  • calibration_prod holds only the matched config's products. If no config matches, it is a single FILLVAL entry, and backgrounds are left at FILLVAL.

File changes

  • hi_l1c.py: sets the global attribute, builds calibration_prod from the matched config, and returns early from pset_backgrounds on the fill entry.
  • imap_hi_variable_attrs.yaml: fixes calibration_prod FILLVAL (65535 → 255, since it is a uint8) and FORMAT (I1 → I3).

Testing

  • 38 tests in test_hi_l1c.py pass, including new matched/unmatched cases. The real-data test writes a CDF and reads it back for both cases.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A critical mismatch between the narrowed product configuration and gain-independent background rows can raise ValueError and prevent affected pointings from producing L1C.

1 open issue
What changed in this PR

This pull request updates Hi L1C PSET generation to record the matched gain configuration and restrict calibration products to that configuration, while representing unmatched pointings with fill values.

Changes:

  • Records gain_config_id, using NaN when no configuration matches.
  • Restricts calibration products and related processing to the matched gain configuration.
  • Updates calibration_prod fill metadata and adds matched/unmatched test coverage.

This pull request requires changes.

File Summary Review status
imap_processing/​tests/​hi/​test_hi_l1c.py Adds matched, unmatched, fill-value, and CDF round-trip coverage. Reviewed
imap_processing/​hi/​hi_l1c.py Matches gain configurations, records the global ID, and handles matched and unmatched PSETs. Requires changes: filter the background configuration to the matched products before calling pset_backgrounds() to avoid coordinate mismatches.
imap_processing/​cdf/​config/​imap_hi_variable_attrs.yaml Corrects the calibration_prod uint8 fill value and format. Reviewed

Review effort: Lite

Comment thread imap_processing/hi/hi_l1c.py Resolved
When no gain config matches, leave backgrounds as FILLVAL
Backgrounds are gain-independent, so the background config lists every
calibration product while a PSET holds only its matched gain config's.
pset_backgrounds now requires the PSET's cal prods to be a subset of the
config's and selects those rows, instead of requiring an exact match.
@tmplummer
tmplummer force-pushed the 3617-hi-l1c---record-matched-gain_config_id-in-pset-for-l2-gain-config-combination branch from 05423b7 to 36265dd Compare November 4, 2026 21:48
@tmplummer
tmplummer requested a lite review from Copilot November 4, 2026 21:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A critical active issue remains because unmatched PSETs can make the Hi L2 path order-dependent and cause shape-mismatch failures during map projection.

1 open issue
1 resolved since last review

Review effort: Lite

Comment thread imap_processing/hi/hi_l1c.py Resolved
@tmplummer tmplummer self-assigned this Nov 6, 2026

This branch has not been deployed

No deployments
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.

Hi L1C - Record matched gain_config_id in PSET for L2 gain-config combination

2 participants