Skip to content

Commit 827d9d2

Browse files
Jammy2211Jammy2211
authored andcommitted
fix unitt estr with sahpitng
1 parent 7defc3c commit 827d9d2

File tree

3 files changed

+2
-62
lines changed

3 files changed

+2
-62
lines changed

autoarray/operators/transformer.py

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -273,62 +273,4 @@ def transform_mapping_matrix(self, mapping_matrix):
273273

274274
transformed_mapping_matrix[:, source_pixel_1d_index] = visibilities
275275

276-
return transformed_mapping_matrix
277-
278-
def forward_lop(self, x):
279-
"""
280-
Forward NUFFT on CPU
281-
:param x: The input numpy array, with the size of Nd or Nd + (batch,)
282-
:type: numpy array with the dtype of numpy.complex64
283-
:return: y: The output numpy array, with the size of (M,) or (M, batch)
284-
:rtype: numpy array with the dtype of numpy.complex64
285-
"""
286-
287-
warnings.filterwarnings("ignore")
288-
289-
x2d = array_2d_util.array_2d_native_complex_via_indexes_from(
290-
array_2d_slim=x,
291-
shape_native=self.real_space_mask.shape_native,
292-
native_index_for_slim_index_2d=self.native_index_for_slim_index,
293-
)[::-1, :]
294-
295-
y = self.k2y(self.xx2k(self.x2xx(x2d)))
296-
return np.concatenate((y.real, y.imag), axis=0)
297-
298-
def adjoint_lop(self, y):
299-
"""
300-
Adjoint NUFFT on CPU
301-
:param y: The input numpy array, with the size of (M,) or (M, batch)
302-
:type: numpy array with the dtype of numpy.complex64
303-
:return: x: The output numpy array,
304-
with the size of Nd or Nd + (batch, )
305-
:rtype: numpy array with the dtype of numpy.complex64
306-
"""
307-
308-
warnings.filterwarnings("ignore")
309-
310-
def a_complex_from(a_real, a_imag):
311-
return a_real + 1j * a_imag
312-
313-
y = a_complex_from(
314-
a_real=y[: int(self.shape[0] / 2.0)], a_imag=y[int(self.shape[0] / 2.0) :]
315-
)
316-
317-
x2d = np.real(self.xx2x(self.k2xx(self.y2k(y))))
318-
319-
x = array_2d_util.array_2d_slim_complex_from(
320-
array_2d_native=x2d[::-1, :],
321-
mask=np.array(self.real_space_mask),
322-
)
323-
x = x.real # NOTE:
324-
325-
# NOTE:
326-
x *= self.adjoint_scaling
327-
328-
return x
329-
330-
def _matvec(self, x):
331-
return self.forward_lop(x)
332-
333-
def _rmatvec(self, x):
334-
return self.adjoint_lop(x)
276+
return transformed_mapping_matrix

autoarray/operators/transformer_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def visibilities_jit(image_1d, grid_radians, uv_wavelengths):
115115
return visibilities
116116

117117

118-
# @numba_util.jit()
118+
@numba_util.jit()
119119
def image_via_jit_from(n_pixels, grid_radians, uv_wavelengths, visibilities):
120120
image_1d = np.zeros(n_pixels)
121121

test_autoarray/operators/test_transformer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ def test__dft__visibilities_from(visibilities_7, uv_wavelengths_7x2, mask_2d_7x7
2727

2828
visibilities = transformer.visibilities_from(image=image)
2929

30-
print(visibilities)
31-
3230
assert visibilities[0:3] == pytest.approx(
3331
np.array(
3432
[

0 commit comments

Comments
 (0)