Skip to content

Conversation

@lacoak21
Copy link
Contributor

Change Summary

Overview

Event times should not be calculated for events at "valid_mask". These will have phase_angle fill vals and the event time calculation will be incorrect. The old code used to do this so I basically reverted back to how we used to compute them.

valid_mask = de_dataset["start_type"].data != FILLVAL_UINT8

Updated Files

  • imap_processing/ultra/l1b/de.py
    • revert back code

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 PR fixes the calculation of event times for ULTRA L1b data by excluding invalid events (where start_type equals the fill value) from the event time calculation. Invalid events have fill values for phase_angle, which would lead to incorrect event time calculations if processed. The fix reverts to the previous approach of pre-initializing event_times and spin_starts arrays with fill values and only calculating times for valid events.

Key Changes:

  • Pre-initialize event_times and spin_starts arrays with fill values before selective calculation
  • Modified get_event_times call to process only valid events (filtered by valid_mask)
  • Updated valid_events logic to identify events with valid (non-fill) event times
  • Adjusted repoint filtering to only process valid events and properly update masks

💡 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.

I don't think you need the initial copy since it is already creating a new array on that line.

The valid events of valid events is a bit confusing at first reading. Could use a comment about only updating where true or something like that.

@lacoak21 lacoak21 merged commit 7446839 into IMAP-Science-Operations-Center:dev Dec 22, 2025
14 checks passed
@lacoak21 lacoak21 deleted the ultra_l1b_mask_invalid_times branch December 22, 2025 15:01
@github-project-automation github-project-automation bot moved this to Done in IMAP Dec 22, 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.

2 participants