Skip to content

ULTRA l1b extendedspin: Hookup new extended spin config values to culling code - #3520

Open
lacoak21 wants to merge 10 commits into
IMAP-Science-Operations-Center:devfrom
lacoak21:ultra_l1b_culling_revalidate_tests_repoint_343
Open

lacoak21 wants to merge 10 commits into
IMAP-Science-Operations-Center:devfrom
lacoak21:ultra_l1b_culling_revalidate_tests_repoint_343

Conversation

@lacoak21

@lacoak21 lacoak21 commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Change Summary

Overview

Wire up the values from the ExtendedSpinConfig class to the culling algorithms.

File changes

  • imap_processing/ultra/constants.py
    • remove old constants that are no longer needed (the energy thresholds are extracted from the spin config ancillary now)
  • imap_processing/ultra/l1b/extendedspin.py
    • pass in the voltage and energy thresholds into the function calls
  • imap_processing/ultra/l1b/lookup_utils.py
    • Add comments about the length of the energy thresholds to avoid confusion
      -imap_processing/ultra/l1b/ultra_l1b_culling.py
    • small updates to reflect updates from Bobs code

Testing

imap_processing/tests/ultra/unit/test_ultra_l1b_culling.py
Most of the updates in this file are to switch over to use data from a new repoint (This repoint contains a lot of culled events so is a good one to test with)

# Conflicts:
#	imap_processing/tests/ultra/unit/test_lookup_utils.py
#	imap_processing/tests/ultra/unit/test_ultra_l1b.py
#	imap_processing/ultra/l1b/lookup_utils.py
# Conflicts:
#	imap_processing/tests/ultra/unit/test_lookup_utils.py
#	imap_processing/ultra/l1b/lookup_utils.py
@lacoak21
lacoak21 requested review from bryan-harter, leowerneck and tmplummer and a balanced review from Copilot October 1, 2026 21:40
@lacoak21 lacoak21 self-assigned this Oct 1, 2026

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.

Copilot review overview

🟡 Changes recommended

Out-of-range voltage samples can flag the final complete bin, and one validation test uses the wrong pointing configuration.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Wires pointing-specific extended-spin thresholds into ULTRA L1B culling and aligns validation with updated algorithms.

Changes:

  • Sources voltage and energy thresholds from ExtendedSpinConfig.
  • Updates culling behavior for smoothing, Earth-angle filtering, and trailing bins.
  • Refreshes validation tests for repoint 383.
File Description
constants.py Removes superseded culling constants.
extendedspin.py Passes configured thresholds and uses priority-1 DE.
lookup_utils.py Clarifies threshold ordering and units.
ultra_l1b_culling.py Updates culling and bin-handling logic.
test_ultra_l1b_culling.py Updates unit and validation coverage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

)
lv_flags = flag_low_voltage(spin_tbin_edges, status_ds, lv_threshold)
lv_flags = flag_low_voltage(
spin_tbin_edges, status_ds, REPOINT_47_SPIN_CONFIG.voltage_threshold
# For each low voltage time, find the corresponding spin time
lv_spin_inds = np.atleast_1d(
np.searchsorted(spin_tbin_edges, low_voltage_times, side="right") - 1
np.searchsorted(spin_tbin_edges[:-1], low_voltage_times, side="right") - 1
Comment on lines +67 to +69
# Use the priority 1 de for the spin level quantities since it contains all events.
# The energy dependent culling selects its de dataset per energy range.
de_dataset = de_datasets["p0"]
priority_1_de_dataset = de_datasets["p1"]

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.

2 participants