Skip to content

Hit l1a: Fix livetime alignment bug when dropped frames. - #3641

Open
lacoak21 wants to merge 3 commits into
IMAP-Science-Operations-Center:devfrom
lacoak21:hit_l1a_fix_bug_with_dropped_set_livetime
Open

lacoak21 wants to merge 3 commits into
IMAP-Science-Operations-Center:devfrom
lacoak21:hit_l1a_fix_bug_with_dropped_set_livetime

Conversation

@lacoak21

Copy link
Copy Markdown
Contributor

Change Summary

closes #3578

Overview

When there are incomplete sets for sectored counts, the code correctly drops the full set of counts data yet the livetime never accounts for it.

Since the livetime never drops in complete sets, in l1b this errors out with a dimension issue.

This also exposed another bug, since the livetimes come from the previous 10 frames, this means that the next set needs to be dropped as well since it would have to use incomplete livetime data. Unfortunatley this means we miss 20 minutes of data but a dropped frame should rarely occur.

File changes

  • imap_processing/hit/l1a/hit_l1a.py
    • fix find_complete_mod_10_sets to drop the set with the missing frame and the next set
    • Fix the bug in subset_livetime to drop the times associated with those sets.

Testing

Fix tests

@lacoak21
lacoak21 requested a balanced review from Copilot November 11, 2026 22:55
@lacoak21 lacoak21 self-assigned this Nov 11, 2026
@lacoak21
lacoak21 marked this pull request as ready for review November 11, 2026 22:55

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 continuity-check flaw allows a missing ten-frame block to pair counts with the wrong livetime, silently producing incorrect L1B rates.

1 open issue
What changed in this PR

This PR addresses #3578 by aligning HIT L1A sectored counts with their corresponding livetime values, preventing downstream L1B dimension mismatches after dropped frames.

Changes:

  • Filters out incomplete mod-10 sets and sets whose preceding block is incomplete.
  • Selects livetime values for each retained epoch rather than a continuous range.
  • Adds regression tests for gaps, invalid epoch matches, and cases with no usable sets.
File Description
imap_processing/​tests/​hit/​test_hit_l1a.py Extends tests for dropped frames and livetime alignment.
imap_processing/​hit/​l1a/​hit_l1a.py Updates set filtering and livetime selection, with alignment checks.

Review effort: Balanced

if len(starts) == 0:
return np.array([], dtype=int)
# Find where the previous set is complete as well.
valid = np.isin(starts - 10, starts)

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.

BUG - Hit l1a. When incomplete sets are dropped, the corresponding livetime is not.

2 participants