Skip to content

Feature/fft jax imaging#271

Merged
Jammy2211 merged 5 commits intomainfrom
feature/fft_jax_imaging
Feb 3, 2026
Merged

Feature/fft jax imaging#271
Jammy2211 merged 5 commits intomainfrom
feature/fft_jax_imaging

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

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:

  • Replaced all references to w_tilde (including WTildeImaging and WTildeInterferometer) with sparse_operator (such as ImagingSparseOperator and InterferometerSparseLinAlg) 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]
  • Removed the legacy w_tilde modules and classes, including autoarray/dataset/imaging/w_tilde.py and autoarray/dataset/abstract/w_tilde.py. [1] [2]

API and interface updates:

  • Updated the GridsDataset and related classes to use the use_sparse_operator flag instead of use_w_tilde, ensuring consistent configuration for the new formalism. [1] [2] [3]
  • Updated import statements and module references throughout the codebase to point to the new sparse operator modules and classes. [1] [2]

These changes modernize the linear algebra approach in the codebase, improve naming consistency, and remove outdated code related to the previous w_tilde formalism.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_tilde references to sparse_operator in 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]:
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 70 to 75
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.
Copy link

Copilot AI Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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.

Copilot uses AI. Check for mistakes.
Jammy2211 and others added 2 commits February 3, 2026 19:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Jammy2211 Jammy2211 merged commit 0b750c3 into main Feb 3, 2026
8 checks passed
@Jammy2211 Jammy2211 deleted the feature/fft_jax_imaging branch February 13, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants