Rename function to find_last_de_packet_data#2671
Conversation
Remove logic that checks for 2 DE packets at each ESA step
There was a problem hiding this comment.
Pull request overview
This pull request renames the function find_second_de_packet_data to find_last_de_packet_data and removes logic that assumed exactly 2 DE packets per ESA step. The instrument can now be configured with 2, 4, or 8 DE packets per 8-spin ESA step, so the previous pair-checking logic has been removed as it's redundant with checks performed in Hi Goodtimes processing.
Changes:
- Renamed
find_second_de_packet_datatofind_last_de_packet_datato reflect that it finds the last packet in each set (not necessarily the second in a pair) - Updated comments to reference "2, 4, or 8 CCSDS packets" instead of assuming 2 packets per ESA step
- Removed validation logic that checked for exactly 2 packets at each ESA step and filtered out unpaired packets
- Updated test cases to reflect the new expected behavior where all last packets are kept (not just paired ones)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| imap_processing/hi/hi_l1c.py | Renamed function from find_second_de_packet_data to find_last_de_packet_data, updated docstring and comments to reflect new packet count flexibility (2, 4, or 8 packets), removed pair validation logic |
| imap_processing/tests/hi/test_hi_l1c.py | Updated mock decorators, mock variable names, test comments, and expected test results to match the renamed function and new logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # indices of those changes to identify the last packet in each set. We | ||
| # also need to add the final packet index and assume an energy step change | ||
| # occurs after the final packet. |
There was a problem hiding this comment.
The comment at line 608 in the function body still refers to "the second packet in each pair of DE packets" but should be updated to "the last packet in each set of DE packets" to be consistent with the new logic that supports 2, 4, or 8 packets per ESA step (not just pairs).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
e64ad41
into
IMAP-Science-Operations-Center:dev
Remove logic that checks for 2 DE packets at each ESA step
Change Summary
Hi told me that the instrument will not always be configured to have 2 DE packets per 8-spin ESA step. This was a minor change to remove the references to the 2 DE packets. It also removes some logic that would remove last packet indices if 2 packets at that ESA are not present. This logic duplicates a check that occurs in Hi Goodtimes.