Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the migration from the legacy w_tilde-based inversion formalism to a new sparse_operator-based approach in the lensing pipeline, and updates tests to validate equivalence between the mapping-matrix and sparse-operator paths.
Changes:
- Updated imaging tests to compare inversions built from standard mapping matrices versus the new sparse-operator pipeline, using the new
apply_sparse_operatorAPI and naming. - Refactored
FitImaging,FitInterferometer, andTracerToInversionto passsparse_operatorthroughaa.DatasetInterfaceinstead of the removedw_tildeattributes, ensuring the inversion path is driven entirely by the new formalism. - Cleaned up legacy
w_tilde-related imports inautolens.__init__and performed minor formatting-only adjustments intracer_util.py.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
test_autolens/imaging/test_simulate_and_fit_imaging.py |
Renames a w_tilde comparison test and switches it to use apply_sparse_operator, asserting curvature and regularization matrices match the mapping-matrix inversion, directly validating the new sparse-operator imaging path. |
autolens/lens/tracer_util.py |
Reflows the NaN-sanitizing xp.where call for deflections and inlines the time-delay distance expression, preserving behavior while improving readability for JAX-related numeric operations. |
autolens/lens/to_inversion.py |
Removes the legacy w_tilde handling and forwards self.dataset.sparse_operator into aa.DatasetInterface so that all per-plane inversion datasets use the new sparse-operator field. |
autolens/interferometer/fit_interferometer.py |
Updates tracer_to_inversion to construct its DatasetInterface with sparse_operator=self.dataset.sparse_operator, aligning the interferometer inversion path with the new sparse-operator API. |
autolens/imaging/fit_imaging.py |
Similarly updates tracer_to_inversion to pass sparse_operator=self.dataset.sparse_operator when building the inversion dataset, ensuring imaging inversions are configured via the new formalism. |
autolens/__init__.py |
Drops re-exports of WTildeImaging and load_curvature_preload_if_compatible, removing the public w_tilde surface from the top-level API in favor of the sparse-operator approach. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
autolens/init.py:8
- Removing the top-level
WTildeImagingandload_curvature_preload_if_compatibleimports without adding equivalents for the new sparse-operator classes changes the publicautolensAPI: code that relied onautolens.WTildeImagingorautolens.load_curvature_preload_if_compatiblewill now fail. If the new sparse-operator types are meant to replace these, consider re-exporting the new public equivalents here or clearly documenting the new import path so the breaking change is explicit for users.
from autoconf import jax_wrapper
from autoconf.dictable import from_dict, from_json, output_to_json, to_dict
from autoarray import preprocess
from autoarray.dataset.imaging.dataset import Imaging
from autoarray.dataset.interferometer.dataset import (
Interferometer,
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request extends the the "w_tilde" formalism of interferometry linear algebra to imaging datasets, enabling efficiently modeling using sparse operators on GPU via JAX. Initial test runs indicate this enables lens modeling of Hubble Space Telescope data using pixelized sources in under 10 minutes, with the formalism enabling small amounts of VRAM use.
It also changes the codebase API to replace the previous use of the term "w_tilde" with a new "sparse operator" formalism for both imaging and interferometer datasets. The changes update class names, method signatures, and internal logic to use the new approach, resulting in improved clarity and maintainability. The most important changes are grouped below:
Refactoring from w_tilde to sparse operator formalism:
w_tilde(includingWTildeImagingandWTildeInterferometer) withsparse_operator(such asImagingSparseOperatorandInterferometerSparseLinAlg) throughout the codebase, including constructor arguments, attributes, and method names in both imaging and interferometer dataset classes. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]w_tildemodules and classes, includingautoarray/dataset/imaging/w_tilde.pyandautoarray/dataset/abstract/w_tilde.py. [1] [2]API and interface updates:
GridsDatasetand related classes to use theuse_sparse_operatorflag instead ofuse_w_tilde, ensuring consistent configuration for the new formalism. [1] [2] [3]These changes modernize the linear algebra approach in the codebase, improve naming consistency, and remove outdated code related to the previous w_tilde formalism.