Overview
InterferometerSparseOperator builds W~ = Re(FᴴWF) from a single precision operator computed with noise_map.real only (dataset.py:362). That is exact only when every visibility has equal real and imaginary sigma. With unequal sigmas the sparse InversionInterferometerSparse curvature matrix silently disagrees with the dense path (5e-16 → 5e-10..3e-2 relative, geometry dependent), on the single-mapper route too. Simulated and real datasets satisfy the equality, so it is latent — but nothing guards it. Found during #499/#500.
Plan
- Raise a clear
DatasetException from Interferometer.apply_sparse_operator when any visibility has unequal real/imag sigma, naming the cause and the dense-path workaround.
- Unit test: unequal sigma raises; equal, non-uniform sigma passes.
- Docstring notes on
apply_sparse_operator and InterferometerSparseOperator.
- Assess (in the PR, no implementation) whether a general two-operator extension is worth doing.
Detailed implementation plan
Affected Repositories
Branch Survey
| Repository |
Current Branch |
Dirty? |
| ./PyAutoArray |
main |
clean (parallel worktree alongside numba-cpu-nnls-iteration-reduction — disjoint files) |
Suggested branch: feature/sparse-interferometer-unequal-sigma-guard
Implementation Steps
autoarray/dataset/interferometer/dataset.py — at the top of apply_sparse_operator, if not np.allclose(self.noise_map.real, self.noise_map.imag): raise exc.DatasetException(...) with a message stating the W~ operator is built from the real-part sigma only and requires sigma_real == sigma_imag per visibility; suggest not calling apply_sparse_operator (dense mapping path) or equalising the sigmas.
- Same file /
inversion_interferometer_util.py — docstring notes on the precondition.
test_autoarray/dataset/interferometer/test_dataset.py — test__apply_sparse_operator__unequal_real_imag_noise_raises and an equal-but-non-uniform sigma control that succeeds.
- PR body: short assessment of the two-operator generalisation (real- and imag-weighted precision operators combined in
apply_operator).
Key Files
autoarray/dataset/interferometer/dataset.py — guard + docstring
test_autoarray/dataset/interferometer/test_dataset.py — tests
Original Prompt
Click to expand starting prompt
Sparse interferometer W~ path silently assumes equal real/imag noise sigma
Type: bug
Target: PyAutoArray
Repos:
- PyAutoArray
- workspaces
Difficulty: medium
Autonomy: supervised
Priority: normal
Status: formalised
Sparse interferometer W~ path silently assumes equal real/imag noise sigma
Type: bug
Target: PyAutoArray
Repos:
- PyAutoArray
Difficulty: medium
Autonomy: supervised
Priority: normal
Problem
InterferometerSparseOperator builds the real-space operator W~ = Re(F^H W F) from a single
NUFFT precision operator. That reduction is only exact when every visibility has equal real and
imaginary noise sigma. With sigma_real != sigma_imag the sparse InversionInterferometerSparse
curvature matrix disagrees with the dense InversionInterferometerMapping path even on the
single-mapper route: measured 5e-16 relative with equal sigmas vs 5e-10 to 3e-2 with unequal
sigmas (geometry dependent). Pre-existing, not introduced by #500. SimulatorInterferometer and
real datasets satisfy the equality, so it is latent — but nothing guards it.
Fix
- Raise a clear
InversionException (or in Interferometer.apply_sparse_operator) when the noise
map has unequal real/imag sigma for any visibility, with a unit test. Do this first.
- Assess extending the operator to the general case (two precision operators, real- and
imag-weighted, combined in apply_operator) — only if the cost is modest; otherwise the guard stands.
Context
Found 2026-08-28 while shipping #499 / #500. The misc/jax_assertions/fit_interferometer_sparse_operator.py parity
scripts in both test workspaces document the limitation in their
docstrings and deliberately use equal-sigma noise maps; they need no change.
Overview
InterferometerSparseOperatorbuildsW~ = Re(FᴴWF)from a single precision operator computed withnoise_map.realonly (dataset.py:362). That is exact only when every visibility has equal real and imaginary sigma. With unequal sigmas the sparseInversionInterferometerSparsecurvature matrix silently disagrees with the dense path (5e-16 → 5e-10..3e-2 relative, geometry dependent), on the single-mapper route too. Simulated and real datasets satisfy the equality, so it is latent — but nothing guards it. Found during #499/#500.Plan
DatasetExceptionfromInterferometer.apply_sparse_operatorwhen any visibility has unequal real/imag sigma, naming the cause and the dense-path workaround.apply_sparse_operatorandInterferometerSparseOperator.Detailed implementation plan
Affected Repositories
Branch Survey
Suggested branch:
feature/sparse-interferometer-unequal-sigma-guardImplementation Steps
autoarray/dataset/interferometer/dataset.py— at the top ofapply_sparse_operator,if not np.allclose(self.noise_map.real, self.noise_map.imag): raise exc.DatasetException(...)with a message stating the W~ operator is built from the real-part sigma only and requiressigma_real == sigma_imagper visibility; suggest not callingapply_sparse_operator(dense mapping path) or equalising the sigmas.inversion_interferometer_util.py— docstring notes on the precondition.test_autoarray/dataset/interferometer/test_dataset.py—test__apply_sparse_operator__unequal_real_imag_noise_raisesand an equal-but-non-uniform sigma control that succeeds.apply_operator).Key Files
autoarray/dataset/interferometer/dataset.py— guard + docstringtest_autoarray/dataset/interferometer/test_dataset.py— testsOriginal Prompt
Click to expand starting prompt
Sparse interferometer W~ path silently assumes equal real/imag noise sigma
Type: bug
Target: PyAutoArray
Repos:
Difficulty: medium
Autonomy: supervised
Priority: normal
Status: formalised
Sparse interferometer W~ path silently assumes equal real/imag noise sigma
Type: bug
Target: PyAutoArray
Repos:
Difficulty: medium
Autonomy: supervised
Priority: normal
Problem
InterferometerSparseOperatorbuilds the real-space operatorW~ = Re(F^H W F)from a singleNUFFT precision operator. That reduction is only exact when every visibility has equal real and
imaginary noise sigma. With
sigma_real != sigma_imagthe sparseInversionInterferometerSparsecurvature matrix disagrees with the dense
InversionInterferometerMappingpath even on thesingle-mapper route: measured 5e-16 relative with equal sigmas vs 5e-10 to 3e-2 with unequal
sigmas (geometry dependent). Pre-existing, not introduced by #500.
SimulatorInterferometerandreal datasets satisfy the equality, so it is latent — but nothing guards it.
Fix
InversionException(or inInterferometer.apply_sparse_operator) when the noisemap has unequal real/imag sigma for any visibility, with a unit test. Do this first.
imag-weighted, combined in
apply_operator) — only if the cost is modest; otherwise the guard stands.Context
Found 2026-08-28 while shipping #499 / #500. The
misc/jax_assertions/fit_interferometer_sparse_operator.pyparityscripts in both test workspaces document the limitation in their
docstrings and deliberately use equal-sigma noise maps; they need no change.