Skip to content

Commit 46fc1c5

Browse files
authored
Merge pull request #478 from PyAutoLabs/claude/remove-dead-adjoint-scaling
Remove the dead use_adjoint_scaling parameter and adjoint_scaling attribute
2 parents 6bbde1a + 461e002 commit 46fc1c5

2 files changed

Lines changed: 4 additions & 34 deletions

File tree

autoarray/dataset/interferometer/dataset.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ def apply_sparse_operator(
274274
dirty_image = self.transformer.image_from(
275275
visibilities=self.data.real * self.noise_map.real**-2.0
276276
+ 1j * self.data.imag * self.noise_map.imag**-2.0,
277-
use_adjoint_scaling=True,
278277
)
279278

280279
sparse_operator = inversion_interferometer_util.InterferometerSparseOperator.from_nufft_precision_operator(

autoarray/operators/transformer.py

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@ def __init__(
143143
The precomputed sine terms used in the imaginary part of the DFT.
144144
real_space_pixels : int
145145
Alias for `total_image_pixels`.
146-
adjoint_scaling : float
147-
Scaling factor applied to the adjoint operator to normalize the inverse transform.
148146
"""
149147
super().__init__()
150148

@@ -155,11 +153,6 @@ def __init__(
155153
self.total_visibilities = uv_wavelengths.shape[0]
156154
self.total_image_pixels = self.real_space_mask.pixels_in_mask
157155

158-
# NOTE: This is the scaling factor that needs to be applied to the adjoint operator
159-
self.adjoint_scaling = (2.0 * self.grid.shape_native[0]) * (
160-
2.0 * self.grid.shape_native[1]
161-
)
162-
163156
def visibilities_from(self, image: Array2D, xp=np) -> Visibilities:
164157
"""
165158
Computes the visibilities from a real-space image using the direct Fourier transform (DFT).
@@ -187,9 +180,7 @@ def visibilities_from(self, image: Array2D, xp=np) -> Visibilities:
187180

188181
return Visibilities(visibilities=visibilities)
189182

190-
def image_from(
191-
self, visibilities: Visibilities, use_adjoint_scaling: bool = False, xp=np
192-
) -> Array2D:
183+
def image_from(self, visibilities: Visibilities, xp=np) -> Array2D:
193184
"""
194185
Computes the real-space image from a set of visibilities using the adjoint of the DFT.
195186
@@ -201,14 +192,6 @@ def image_from(
201192
----------
202193
visibilities
203194
The complex visibilities to be transformed into a real-space image.
204-
use_adjoint_scaling
205-
If True, normalise the adjoint output onto the common scale shared by
206-
every transformer (that of the plain mathematical adjoint). Both
207-
remaining transformers already return the plain mathematical
208-
adjoint, so this is a no-op for each of them; it is retained as a
209-
stable part of the transformer interface. See `Interferometer.
210-
apply_sparse_operator`, which passes `True` so the sparse-operator
211-
dirty image is scale-consistent across both transformers.
212195
213196
Returns
214197
-------
@@ -322,10 +305,6 @@ def __init__(
322305
Number of measured visibilities.
323306
total_image_pixels
324307
Number of unmasked pixels in the image grid.
325-
adjoint_scaling
326-
Scaling factor available for callers who want to apply an
327-
optional normalisation to the adjoint output. Provided for
328-
parity with the legacy class.
329308
"""
330309
from astropy import units
331310

@@ -362,7 +341,6 @@ def __init__(
362341

363342
self.total_visibilities = uv_wavelengths.shape[0]
364343
self.total_image_pixels = real_space_mask.pixels_in_mask
365-
self.adjoint_scaling = (2.0 * n_y) * (2.0 * n_x)
366344

367345
def _forward_native(self, image_native_2d, xp=np):
368346
"""Run nufft2d2 on a 2D native-shape image array, returning visibilities.
@@ -447,7 +425,6 @@ def visibilities_from(self, image, xp=np) -> Visibilities:
447425
def image_from(
448426
self,
449427
visibilities: Visibilities,
450-
use_adjoint_scaling: bool = False,
451428
xp=np,
452429
) -> Array2D:
453430
"""
@@ -459,15 +436,9 @@ def image_from(
459436
460437
Note that this is the **mathematical adjoint** of `visibilities_from`,
461438
with no kernel deconvolution applied. The values match
462-
`TransformerDFT.image_from` exactly.
463-
464-
`use_adjoint_scaling` normalises the adjoint onto the common scale
465-
shared by every transformer. It is a no-op here (and for
466-
`TransformerDFT`) because both remaining adjoints are already the plain
467-
mathematical adjoint; it is retained as a stable part of the
468-
transformer interface. `Interferometer.apply_sparse_operator` passes
469-
`True` so the sparse-operator dirty image is scale-consistent across
470-
both transformers.
439+
`TransformerDFT.image_from` exactly, which is what makes
440+
`Interferometer.apply_sparse_operator` scale-consistent across both
441+
transformers.
471442
"""
472443
_load_nufftax()
473444

0 commit comments

Comments
 (0)