Conversation
There was a problem hiding this comment.
Pull request overview
This pull request refactors the codebase to replace the "w_tilde" terminology with a new "sparse operator" formalism for both imaging and interferometer datasets. This extends efficient GPU-based linear algebra modeling capabilities to imaging datasets using JAX. The refactoring improves code clarity by using more descriptive terminology throughout the API.
Changes:
- Renamed all
w_tildereferences tosparse_operatorin class names, method parameters, and property names - Updated formatting and spacing in Gaussian profile implementations
- Added conditional JAX imports in dark matter profile utilities
- Removed outdated comments and commented-out imports related to w_tilde
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test_autogalaxy/profiles/mass/stellar/test_gaussian.py | Whitespace formatting improvements |
| autogalaxy/profiles/mass/stellar/gaussian.py | Code formatting fixes (spacing around operators) and line breaking improvements |
| autogalaxy/profiles/mass/dark/mcr_util.py | Added conditional JAX numpy imports for JAX compatibility |
| autogalaxy/interferometer/fit_interferometer.py | Renamed w_tilde parameter to sparse_operator |
| autogalaxy/imaging/fit_imaging.py | Renamed w_tilde parameter to sparse_operator |
| autogalaxy/aggregator/agg_util.py | Removed outdated docstring comment about w_tilde |
| autogalaxy/abstract_fit.py | Renamed w_tilde property to sparse_operator with updated documentation |
| autogalaxy/init.py | Removed commented-out w_tilde import |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| @property | ||
| def w_tilde(self) -> Optional[aa.WTildeImaging]: | ||
| def sparse_operator(self) -> Optional[aa.ImagingSparseOperator]: |
There was a problem hiding this comment.
The type hint specifies aa.ImagingSparseOperator but this is an abstract class used by both FitImaging and FitInterferometer (which would need InterferometerSparseLinAlg according to the PR description). The type hint should be more generic or use a Union type to accommodate both imaging and interferometer sparse operators.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
autogalaxy/abstract_fit.py
Outdated
| Only call the `sparse_operator` property of a dataset used to perform efficient linear algebra calcualtions if | ||
| the SettingsInversion()` object has `use_sparse_operator=True`, to avoid unnecessary computation. | ||
|
|
||
| Returns | ||
| ------- | ||
| The w-tilde matrix if the w-tilde formalism is being used for this inversion. |
There was a problem hiding this comment.
The documentation still references "w-tilde matrix" and "w-tilde formalism" which is outdated terminology. Since this PR is refactoring from w_tilde to sparse_operator, the Returns section should be updated to reflect the new terminology and describe what sparse operators are being returned.
| Only call the `sparse_operator` property of a dataset used to perform efficient linear algebra calcualtions if | |
| the SettingsInversion()` object has `use_sparse_operator=True`, to avoid unnecessary computation. | |
| Returns | |
| ------- | |
| The w-tilde matrix if the w-tilde formalism is being used for this inversion. | |
| Only call the `sparse_operator` property of a dataset used to perform efficient linear algebra calculations if | |
| the `SettingsInversion` object has `use_sparse_operator=True`, to avoid unnecessary computation. | |
| Returns | |
| ------- | |
| Optional[aa.ImagingSparseOperator] | |
| A sparse operator describing how image pixels map to the linear inversion quantities used in this fit, | |
| or None if sparse operators are not being used for this inversion. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.