Skip to content

Commit 42aea76

Browse files
Jammy2211Jammy2211
authored andcommitted
back to stable
1 parent d7d31f6 commit 42aea76

File tree

7 files changed

+17
-13
lines changed

7 files changed

+17
-13
lines changed

autoarray/inversion/pixelization/mappers/mapper_util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ def adaptive_rectangular_mappings_weights_via_interpolation_from(
237237
grid_over_sampled_scaled = (source_plane_data_grid_over_sampled - mu) / scale
238238
grid_over_sampled_transformed = transform(grid_over_sampled_scaled)
239239
grid_over_index = source_grid_size * grid_over_sampled_transformed
240+
grid_over_index = (source_grid_size - 3) * grid_over_sampled_transformed + 1
240241

241242
# --- Step 4. Floor/ceil indices ---
242243
ix_down = jnp.floor(grid_over_index[:, 0])

autoarray/inversion/pixelization/mesh/rectangular.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Optional, Tuple
33

44

5+
from autoarray.structures.grids.irregular_2d import Grid2DIrregular
56
from autoarray.structures.grids.uniform_2d import Grid2D
67
from autoarray.structures.mesh.rectangular_2d import Mesh2DRectangular
78

@@ -126,7 +127,8 @@ def mesh_grid_from(
126127
by overlaying the `source_plane_data_grid` with the rectangular pixelization.
127128
"""
128129
return Mesh2DRectangular.overlay_grid(
129-
shape_native=self.shape, grid=source_plane_data_grid.over_sampled
130+
shape_native=self.shape,
131+
grid=Grid2DIrregular(source_plane_data_grid.over_sampled),
130132
)
131133

132134
@property

autoarray/inversion/pixelization/mesh/rectangular_uniform.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Optional
44

55

6+
from autoarray.structures.grids.irregular_2d import Grid2DIrregular
67
from autoarray.structures.grids.uniform_2d import Grid2D
78
from autoarray.structures.mesh.rectangular_2d_uniform import Mesh2DRectangularUniform
89

@@ -28,5 +29,6 @@ def mesh_grid_from(
2829
by overlaying the `source_plane_data_grid` with the rectangular pixelization.
2930
"""
3031
return Mesh2DRectangularUniform.overlay_grid(
31-
shape_native=self.shape, grid=source_plane_data_grid.over_sampled
32+
shape_native=self.shape,
33+
grid=Grid2DIrregular(source_plane_data_grid.over_sampled),
3234
)

autoarray/structures/grids/uniform_1d.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22
import numpy as np
3-
import jax.numpy as jnp
43
from typing import List, Union, Tuple
54

65
from autoarray.structures.abstract_structure import Structure
@@ -312,8 +311,8 @@ def grid_2d_radial_projected_from(self, angle: float = 0.0) -> Grid2DIrregular:
312311
The projected and rotated 2D grid of (y,x) coordinates.
313312
"""
314313

315-
grid = jnp.zeros((self.mask.pixels_in_mask, 2))
316-
grid = grid.at[:, 1].set(self.slim.array)
314+
grid = np.zeros((self.mask.pixels_in_mask, 2))
315+
grid[:, 1] = self.slim.array
317316

318317
grid = geometry_util.transform_grid_2d_to_reference_frame(
319318
grid_2d=grid, centre=(0.0, 0.0), angle=angle

autoarray/structures/mesh/rectangular_2d.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def overlay_grid(
8989
buffer
9090
The size of the extra spacing placed between the edges of the rectangular pixelization and input grid.
9191
"""
92+
grid = grid.array
9293

9394
y_min = jnp.min(grid[:, 0]) - buffer
9495
y_max = jnp.max(grid[:, 0]) + buffer

test_autoarray/inversion/inversion/test_inversion_util.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def test__reconstruction_positive_negative_from():
8181
reconstruction = aa.util.inversion.reconstruction_positive_negative_from(
8282
data_vector=data_vector,
8383
curvature_reg_matrix=curvature_reg_matrix,
84-
mapper_param_range_list=[[0, 3]],
8584
)
8685

8786
assert reconstruction == pytest.approx(np.array([1.0, -1.0, 3.0]), 1.0e-4)

test_autoarray/structures/mesh/test_rectangular.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test__neighbors__compare_to_mesh_util():
1313
# I12I13I14I15I
1414

1515
mesh = aa.Mesh2DRectangularUniform.overlay_grid(
16-
shape_native=(7, 5), grid=np.zeros((2, 2)), buffer=1e-8
16+
shape_native=(7, 5), grid=aa.Grid2DIrregular(np.zeros((2, 2))), buffer=1e-8
1717
)
1818

1919
(neighbors_util, neighbors_sizes_util) = aa.util.mesh.rectangular_neighbors_from(
@@ -25,7 +25,7 @@ def test__neighbors__compare_to_mesh_util():
2525

2626

2727
def test__edge_pixel_list():
28-
grid = np.array(
28+
grid = aa.Grid2DIrregular(
2929
[
3030
[-1.0, -1.0],
3131
[-1.0, 0.0],
@@ -47,7 +47,7 @@ def test__edge_pixel_list():
4747

4848

4949
def test__shape_native_and_pixel_scales():
50-
grid = np.array(
50+
grid = aa.Grid2DIrregular(
5151
[
5252
[-1.0, -1.0],
5353
[-1.0, 0.0],
@@ -68,7 +68,7 @@ def test__shape_native_and_pixel_scales():
6868
assert mesh.shape_native == (3, 3)
6969
assert mesh.pixel_scales == pytest.approx((2.0 / 3.0, 2.0 / 3.0), 1e-2)
7070

71-
grid = np.array(
71+
grid = aa.Grid2DIrregular(
7272
[
7373
[1.0, -1.0],
7474
[1.0, 0.0],
@@ -89,7 +89,7 @@ def test__shape_native_and_pixel_scales():
8989
assert mesh.shape_native == (5, 4)
9090
assert mesh.pixel_scales == pytest.approx((2.0 / 5.0, 2.0 / 4.0), 1e-2)
9191

92-
grid = np.array([[2.0, 1.0], [4.0, 3.0], [6.0, 5.0], [8.0, 7.0]])
92+
grid = aa.Grid2DIrregular([[2.0, 1.0], [4.0, 3.0], [6.0, 5.0], [8.0, 7.0]])
9393

9494
mesh = aa.Mesh2DRectangularUniform.overlay_grid(
9595
shape_native=(3, 3), grid=grid, buffer=1e-8
@@ -100,7 +100,7 @@ def test__shape_native_and_pixel_scales():
100100

101101

102102
def test__pixel_centres__3x3_grid__pixel_centres():
103-
grid = np.array(
103+
grid = aa.Grid2DIrregular(
104104
[
105105
[1.0, -1.0],
106106
[1.0, 0.0],
@@ -134,7 +134,7 @@ def test__pixel_centres__3x3_grid__pixel_centres():
134134
)
135135
)
136136

137-
grid = np.array(
137+
grid = aa.Grid2DIrregular(
138138
[
139139
[1.0, -1.0],
140140
[1.0, 0.0],

0 commit comments

Comments
 (0)