Skip to content

ULTRA l1b: Refactor extendedspin.py to make a single call to get_valid_de_count_summary() - #3500

Merged
lacoak21 merged 2 commits into
IMAP-Science-Operations-Center:devfrom
lacoak21:ultra_l1b_refactor_counts_summary
Sep 29, 2026
Merged

lacoak21 merged 2 commits into
IMAP-Science-Operations-Center:devfrom
lacoak21:ultra_l1b_refactor_counts_summary

Conversation

@lacoak21

Copy link
Copy Markdown
Contributor

Change Summary

closes #3497

Overview

Minor refactor to make one single call to get_valid_de_count_summary vs many. Originally I had individual calls because I thought there were going to be differences in the binning over the spin_bin dimension but that turned out not to be the case.

File changes

  • imap_processing/ultra/l1b/extendedspin.py
    • Fix calls to culling functions to pass in the direct events counts summary
  • imap_processing/ultra/l1b/ultra_l1b_culling.py
    • extract the spin binning logic and move it to another util function.

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

The smoothing helper breaks callers that pass combine_spin_bin_radius=None, a previously supported no-op configuration.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Refactors ULTRA L1B culling to compute and reuse one direct-event count summary.

Changes:

  • Extracts spin-bin smoothing into combine_de_counts_summary.
  • Updates culling APIs and extended-spin integration.
  • Updates unit tests for the refactored interfaces.
File Summary
imap_processing/​ultra/​l1b/​ultra_l1b_culling.py Refactors culling APIs and adds count-summary smoothing.
imap_processing/​ultra/​l1b/​extendedspin.py Computes and reuses one shared count summary.
imap_processing/​tests/​ultra/​unit/​test_ultra_l1b_culling.py Updates tests for the new interfaces.

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

Comment thread imap_processing/ultra/l1b/ultra_l1b_culling.py
@leowerneck

Copy link
Copy Markdown
Contributor

There was a weird failure of Tests / test (ubuntu-latest, 3.10). Seems like a package (spiceypy?) failed to build due to non compliance with something? Strange. I asked to rerun.

@leowerneck leowerneck 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.

LGTM.

@lacoak21
lacoak21 force-pushed the ultra_l1b_refactor_counts_summary branch from 27286e9 to 3a45006 Compare September 28, 2026 20:48
@lacoak21
lacoak21 merged commit bea4cd8 into IMAP-Science-Operations-Center:dev Sep 29, 2026
22 checks passed
@lacoak21
lacoak21 deleted the ultra_l1b_refactor_counts_summary branch September 29, 2026 15:05
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.

Refactor code to make less calls to get_valid_events_per_energy_range

3 participants