Problem
In mdx2.command_line.reintegrate, when processing image chunks, it's possible for all pixels in a chunk to be masked out, resulting in an empty HKLTable being passed to calc_corrections.
While the division operations (tab.phi /= tab.pixels, etc.) handle empty arrays correctly, the subsequent call to calc_corrections may encounter issues when operating on empty tables. This behavior has not been thoroughly tested.
Suggested Approach
-
Refactor calc_corrections: Ensure the function gracefully handles empty HKLTable inputs, either by:
- Adding explicit checks and early returns for empty tables
- Ensuring all operations within the function are safe for empty arrays
-
Add unit tests: Create test cases covering:
- Empty HKLTable input to
calc_corrections
- Empty table propagation through the reintegration workflow
- Verification that empty chunks don't cause failures
Context
Problem
In
mdx2.command_line.reintegrate, when processing image chunks, it's possible for all pixels in a chunk to be masked out, resulting in an empty HKLTable being passed tocalc_corrections.While the division operations (
tab.phi /= tab.pixels, etc.) handle empty arrays correctly, the subsequent call tocalc_correctionsmay encounter issues when operating on empty tables. This behavior has not been thoroughly tested.Suggested Approach
Refactor
calc_corrections: Ensure the function gracefully handles empty HKLTable inputs, either by:Add unit tests: Create test cases covering:
calc_correctionsContext