Skip to content

ULTRA l1b: Validation result updates#3136

Open
lacoak21 wants to merge 8 commits intoIMAP-Science-Operations-Center:devfrom
lacoak21:ultra_l1b_culling_validation_results
Open

ULTRA l1b: Validation result updates#3136
lacoak21 wants to merge 8 commits intoIMAP-Science-Operations-Center:devfrom
lacoak21:ultra_l1b_culling_validation_results

Conversation

@lacoak21
Copy link
Copy Markdown
Contributor

@lacoak21 lacoak21 commented May 4, 2026

Change Summary

closes #3132

Overview

There were subtle differences in Bob's vs my code in how our masks were getting propagated and passed through. This PR aligns our code exactly.

File changes

Testing

Update stats test.

@lacoak21 lacoak21 requested a review from Copilot May 4, 2026 21:51
@lacoak21 lacoak21 self-assigned this May 4, 2026
@lacoak21 lacoak21 added this to IMAP May 4, 2026
@lacoak21 lacoak21 added bug Something isn't working Ins: Ultra Related to the IMAP-Ultra instrument labels May 4, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Aligns ULTRA L1B culling/validation behavior to eliminate subtle differences in how quality-flag masks are propagated through the extendedspin culling sequence (per #3132).

Changes:

  • Adjusts how the cull “mask” is constructed/updated in calculate_extendedspin() before running upstream-ion/spectral/statistical-outlier culls.
  • Updates the ULTRA45 Earth keepout angle threshold constant used in valid-event filtering.
  • Updates the unit test expectations for flag_statistical_outliers().

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
imap_processing/ultra/l1b/ultra_l1b_culling.py Minor whitespace-only change near valid-events helper logic.
imap_processing/ultra/l1b/extendedspin.py Updates mask propagation/order for subsequent culls (upstream ion, spectral, stat outliers).
imap_processing/ultra/constants.py Changes ULTRA45 Earth keepout angle threshold from 20° to 15°.
imap_processing/tests/ultra/unit/test_ultra_l1b_culling.py Updates assertions around std_diff returned by flag_statistical_outliers().
Comments suppressed due to low confidence (1)

imap_processing/ultra/l1b/extendedspin.py:125

  • upstream_ion_qf_2 is computed using the same mask as the first upstream-ion pass. Since flag_upstream_ion expects mask to represent bins flagged in previous steps, the second pass likely should also exclude bins flagged by the first pass (and/or high-energy). Otherwise the second channel set may be biased by bins already identified as upstream-ion contaminated.
    upstream_ion_qf_2 = flag_upstream_ion(
        de_dataset,
        spin_tbin_edges,
        energy_ranges,
        mask,
        UltraConstants.UPSTREAM_ION_ENERGY_CHANNELS_2,
        instrument_id,
    )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread imap_processing/ultra/l1b/extendedspin.py
Comment thread imap_processing/tests/ultra/unit/test_ultra_l1b_culling.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Ins: Ultra Related to the IMAP-Ultra instrument

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

ULTRA l1b investigate why there are subtle differences in culling

2 participants