Repository navigation
fix: default FitPositionsSource to jacobian weighting; correct magnification normalisation - #792
Merged
Merged
Conversation
…ication normalisation FitPositionsSource now defaults to weighting="jacobian" (B_i = A_i^-T Theta_i A_i^-1, Gravity.jl Lombardi 2024 Eq. 46). The opt-in "magnification" weighting keeps its scalar mu^2/sigma^2 chi-squared (Jullo 2007 Eq. 10) but now uses the same model-independent 2-D normalisation sum log((2pi)^2 sigma^4) instead of the 1-D, mu-dependent sum log(2pi sigma^2/mu^2). FitPositionsSourceSolved inherits the normalisation (values unchanged). Tests re-derived analytically; new near-critical anisotropic test checks the true model outranks perturbations. Refs #791 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
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
FitPositionsSourcenow defaults to the"jacobian"source-plane weighting. Each source-plane residual δᵢ is weighted by the precision tensor Bᵢ = Aᵢ⁻ᵀΘᵢAᵢ⁻¹, i.e. it is measured in the image-plane noise ellipse. This is the Gravity.jl source-plane likelihood (Lombardi 2024, arXiv:2406.15280, Eq. 46). It is also Keeton 2001 Eq. 10 and Lenstool's tensor mode (forme 8).The old default, the scalar
"magnification"weighting (Jullo et al. 2007 Eq. 10), is biased near critical curves. On the point_source true model its source χ² is 10,023, against 4.25 in the image plane and 5.41 with"jacobian". Its normalisation Σ log(2πσ²/μ²) was also 1-D and depended on the model, which rewarded high magnification."magnification"stays as an opt-in, now with the same model-independent 2-D normalisation Σ log((2π)²σ⁴), i.e. Eq. 46 with B ≈ μ²Θ.Refs #791 (library part; the workspace follows).
API Changes
FitPositionsSource.weightingis now"jacobian"(was"magnification"). Source-plane χ² and log-likelihood values fromFitPositionsSourcechange."magnification"normalisation is now Σ log((2π)²σ⁴), model-independent and the same as"jacobian". It was Σ log(2πσ²/μ²). This affectsFitPositionsSourceonly;FitPositionsSourceSolvedalready used this normalisation.FitPositionsSourceSolvedinheritsnoise_normalizationfrom its parent instead of duplicating it. Its values are unchanged.See full details below.
Test Plan
pytest test_autolens -q -x: 911 passed, 1 xfailed.test__fit_positions_source__jacobian__true_model_outranks_perturbed_models_near_critical: an elliptical PowerLaw with slope 2.3 (radial eigenvalue ≠ 1) and a quad with μ up to about 17. The true model outranks perturbations of R_E + 0.01 and of the centre by +0.005 in y and in x.Full API Changes (for automation & release notes)
Changed Behaviour
al.FitPositionsSource.weighting: the default is now"jacobian"(was"magnification").al.FitPositionsSource.noise_normalizationwithweighting = "magnification": nowΣᵢ log((2π)² σᵢ⁴)(wasΣᵢ log(2π σᵢ²/µᵢ²)).al.FitPositionsSource.log_likelihood/chi_squared: change accordingly.Removed
FitPositionsSourceSolved.noise_normalizationoverride: replaced by the identical inherited property, so behaviour is unchanged.Migration
FitPositionsSource(e.g. autolens_workspace_testjax_likelihood/source_plane.py) must be re-measured.Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code