Skip to content

Conversation

@lacoak21
Copy link
Contributor

Change Summary

I discovered that sometimes the de data may be associated with spins that are NOT in the aux dataset. I talked to Nick and Larry about this issue and getting the data from the universal spin table is the desired way to deal with this.

Updated Files

  • updated file 1
    • description of change 1 in file 1
    • description of change 2 in file 2
  • updated file 2
    • descipriton of change 1 in file 2

Testing

Fix test and test new backup method

Copy link
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

This pull request adds a backup mechanism to retrieve spin information from the universal spin table when events fall outside the auxiliary dataset's time range. This addresses an edge case where direct event (DE) data may be associated with spins not present in the aux dataset.

Key Changes:

  • Refactored get_spin_and_duration() to get_spin_info() which returns a complete xarray Dataset with spin information
  • Added fallback logic to query the universal spin table for events outside aux dataset coverage
  • Updated get_event_times() parameter order for consistency (de_event_met before phase_angle)

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
imap_processing/ultra/l1b/ultra_l1b_extended.py Core implementation: refactored spin info retrieval functions, added universal spin table fallback, and updated get_event_times signature
imap_processing/ultra/l1c/ultra_l1c_pset_bins.py Updated calls to get_spin_info and added aux_dataset parameter to functions requiring spin information
imap_processing/ultra/l1c/spacecraft_pset.py Passed aux_dataset to get_spacecraft_exposure_times
imap_processing/ultra/l1c/helio_pset.py Passed aux_dataset to get_spacecraft_exposure_times
imap_processing/ultra/l1b/de.py Updated to use get_spin_info and pass spin_ds to get_event_times
imap_processing/ultra/l1b/ultra_l1b_culling.py Updated to use get_spin_info instead of get_spin_and_duration
imap_processing/ultra/constants.py Extracted N_RE constant for better maintainability of earth culling radius calculation
imap_processing/tests/ultra/unit/test_ultra_l1c_pset_bins.py Updated test calls to match new function signatures with aux_dataset parameter
imap_processing/tests/ultra/unit/test_ultra_l1b_extended.py Updated tests to use get_spin_info and verify fallback behavior with universal spin table
imap_processing/tests/ultra/unit/test_ultra_l1b_culling.py Updated tests to use get_spin_info instead of get_spin_and_duration

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

Copy link
Collaborator

@greglucas greglucas left a comment

Choose a reason for hiding this comment

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

It seems like we would want to use one or the other, but not switch between two as that could confuse things later on. If we don't have enough aux packet data, do we need to increase the request period on batch_starter to include some earlier packets for Ultra? In the opposite direction, if we always have spin table data, could we always reference that table instead of mixing and matching the two different sources of data?

Copy link
Contributor

@subagonsouth subagonsouth left a comment

Choose a reason for hiding this comment

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

Looks good except for the one concern I have about the units of subseconds in the two different sources for spin info.

@lacoak21 lacoak21 merged commit 87cb551 into IMAP-Science-Operations-Center:dev Dec 19, 2025
14 checks passed
@lacoak21 lacoak21 deleted the ultra_l1b_query_spin_table_if_no_aux_data branch December 19, 2025 17:12
@github-project-automation github-project-automation bot moved this to Done in IMAP Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants