feat: zero-fill extrapolation for input pixelized mass profiles - #508
Merged
Conversation
LinearNDInterpolatorExt gains fill=nearest|zero; InputPotential and InputDeflections gain extrapolate=nearest|zero (defaults unchanged). Zero fill makes a localized correction vanish outside its mesh instead of nearest-smearing spurious constant deflections across the full evaluation grid — required by the arc-restricted iterative potential corrections (PyAutoLabs/PyAutoLens#623). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Adds a zero-fill extrapolation mode to the input pixelized mass profiles (part of the potential-correction interferometer work, PyAutoLabs/PyAutoLens#623):
LinearNDInterpolatorExt(fill="zero")andInputPotential/InputDeflections(extrapolate="zero"). The default ("nearest") is unchanged.Rationale: when an
InputPotentialrepresents a localized correction on a sub-region of a larger grid (an arc-restricted δψ mesh), nearest extrapolation smears constant non-zero potential — and constant spurious deflections — across the entire evaluation grid, scrambling ray-tracing outside the mesh. Zero fill makes the correction vanish outside its support, the physically correct behaviour. Diagnosed on the visibility-space iterative engine (see #623 comments); the iterative engines in PyAutoLens now construct their correction profiles withextrapolate="zero".API Changes
Added only: the
fillparameter onag.mp.LinearNDInterpolatorExtand theextrapolateparameter onag.mp.InputPotential/ag.mp.InputDeflections(defaults preserve existing behaviour).See full details below.
Test Plan
extrapolate="zero"while nearest smears non-zero values; both modes agree exactly inside the hull; invalid mode raises.test_autogalaxysuite run before commit.Full API Changes (for automation & release notes)
Added
ag.mp.LinearNDInterpolatorExt(points, values, fill="nearest")—fill="zero"returns 0 outside the convex hull.ag.mp.InputPotential(..., extrapolate="nearest")/ag.mp.InputDeflections(..., extrapolate="nearest")—extrapolate="zero"threads zero-fill through all internal interpolators.Migration
Generated by the PyAutoLabs agent workflow.