fix: Keep masked fit utility gradients finite - #607
Merged
Merged
Conversation
Jammy2211
marked this pull request as draft
October 2, 2026 10:09
Collaborator
Author
|
Heart YELLOW is now explicitly acknowledged for this bundle. PR remains draft until one imaging smoke check is repeated with explicit library-path provenance after repairing a shared activation-script symlink. Full PyAutoArray validation is confirmed against this worktree: 1,924 passed with captured exit 0. The current geometry delegate will finish before the shared worktree switches back. |
Jammy2211
marked this pull request as ready for review
October 2, 2026 10:36
Collaborator
Author
|
Workspace PR: PyAutoLabs/autolens_workspace_test#340. Final smoke verification used explicit bundle interpreter/import provenance: fit-util JAX and imaging rectangular both passed, runner exit0. Full suite1924 passed with exit0. Heart exact YELLOW reason acknowledged; library-first merge/release gate remains. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevent divisions by zero in discarded branches of three fit utilities. Denominators are made safe before division, so masked pixels no longer contaminate JAX gradients. Residual fractions now return zero for zero data in both masked and unmasked helpers.
Part of #604. Permanent compiled JAX regressions are in the linked workspace PR.
API Changes
residual_flux_fraction_map_with_mask_fromnow returns zero for included pixels whose data is zero, matching the unmasked helper. Defined forward results are unchanged. Included zero-noise chi-squared remains undefined. See full details below.Test Plan
Full API Changes (for automation & release notes)
Changed Behaviour
chi_squared_map_with_mask_from: zero noise in masked pixels no longer poisons gradients.residual_flux_fraction_map_from: excluded zero-data divisions have finite gradients.residual_flux_fraction_map_with_mask_from: zero-data pixels return zero with zero excluded derivatives, including unmasked pixels.Migration
Generated by the PyAutoLabs agent workflow.