ULTRA l1c theta limit check#2941
ULTRA l1c theta limit check#2941lacoak21 merged 5 commits intoIMAP-Science-Operations-Center:devfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an ULTRA L1C restricted-FOV acceptance gate so that pixels/events outside a reduced theta/phi window are excluded from L1C fine energy-bin products (counts, exposure, efficiency/GF/sensitivity), and updates tests accordingly.
Changes:
- Introduce restricted-FOV acceptance logic (
in_restricted_fov) and integrate it into L1C pixel acceptance and event filtering. - Replace/rename spun-scattering acceptance calculation to
calculate_accepted_pixelsand thread it through spacecraft/helio PSET generation. - Fix boundary scale factor indexing bug in efficiency/GF accumulation and update unit tests for new inputs/behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| imap_processing/ultra/l1c/l1c_lookup_utils.py | Adds restricted-FOV helper and expands “accepted pixels” logic to incorporate FOV restrictions. |
| imap_processing/ultra/l1c/spacecraft_pset.py | Applies restricted-FOV filtering to event counts and uses new accepted-pixel logic for exposure/eff/GF. |
| imap_processing/ultra/l1c/helio_pset.py | Same as spacecraft path but for helio PSET generation. |
| imap_processing/ultra/l1c/ultra_l1c_pset_bins.py | Fixes BSF indexing when applying boundary scale factors during accumulation. |
| imap_processing/ultra/constants.py | Adds restricted-FOV theta limits and feature toggles for L1C (FOV restriction, BSF, scattering rejection). |
| imap_processing/tests/ultra/unit/test_l1c_lookup_utils.py | Adds unit tests for restricted-FOV logic and updated acceptance calculation. |
| imap_processing/tests/ultra/unit/test_ultra_l1c.py | Updates fixtures to include theta/phi fields required by new filtering. |
| imap_processing/tests/ultra/unit/test_ultra_l1c_pset_bins.py | Updates tests to use calculate_accepted_pixels. |
| imap_processing/tests/ultra/unit/test_spacecraft_pset.py | Updates test datasets to include theta/phi fields required by new filtering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| logger.info( | ||
| f"Restricted FOV counts filter: keeping {fov_accepted.sum()} / " | ||
| f"{len(fov_accepted)} events." | ||
| ) | ||
| species_dataset = species_dataset.isel(epoch=fov_accepted) |
There was a problem hiding this comment.
After applying the restricted-FOV event filter, species_dataset can become empty; subsequent operations (velocity normalization, histogramming, and especially min/max on event_times) will raise. Add an early return (e.g., None) or produce a zero-filled dataset when no events remain after this filter.
| f"Restricted FOV counts filter: keeping {fov_accepted.sum()} / " | ||
| f"{len(fov_accepted)} events." | ||
| ) | ||
| species_dataset = species_dataset.isel(epoch=fov_accepted) |
There was a problem hiding this comment.
After applying the restricted-FOV event filter, species_dataset can become empty; subsequent operations (velocity normalization, histogramming, and min/max on event_times) will raise. Add an early return (e.g., None) or produce a zero-filled dataset when no events remain after this filter.
| species_dataset = species_dataset.isel(epoch=fov_accepted) | |
| species_dataset = species_dataset.isel(epoch=fov_accepted) | |
| if species_dataset.sizes.get("epoch", 0) == 0: | |
| logger.info( | |
| "No events remain after restricted FOV filtering; " | |
| "skipping helio PSET generation." | |
| ) | |
| return None |
subagonsouth
left a comment
There was a problem hiding this comment.
This all looks good to me.
Change Summary
closes #2856
Overview
The ultra team wants to limit the FOV, This pr calculates pixels that are not in the limited FOV and those pixels are excluded from counts, exposure factor, and sensitivity (eff, gf).
I sent maps to the ULTRA team and they are looking good. I think they still may need to check some things.
File changes
imap_processing/ultra/l1c/helio_pset.py
imap_processing/ultra/l1c/l1c_lookup_utils.py
imap_processing/ultra/l1c/ultra_l1c_pset_bins.py
Testing
Update test to work with new rejection logic. Add new tests for the fov restriction code.