Skip to content

Commit b83197d

Browse files
Jammy2211Jammy2211
authored andcommitted
remove interpolated reconstruction plot and some unit tests
1 parent 7068b8f commit b83197d

11 files changed

Lines changed: 12 additions & 327 deletions

File tree

autoarray/inversion/mock/mock_mapper.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def __init__(
2020
mapping_matrix=None,
2121
pixel_signals=None,
2222
parameters=None,
23-
interpolated_array=None,
2423
):
2524
mapper_grids = MapperGrids(
2625
mask=mask,
@@ -41,7 +40,6 @@ def __init__(
4140
self._mapping_matrix = mapping_matrix
4241
self._parameters = parameters
4342
self._pixel_signals = pixel_signals
44-
self._interpolated_array = interpolated_array
4543

4644
def pixel_signals_from(self, signal_scale, xp=np):
4745
if self._pixel_signals is None:
@@ -71,11 +69,3 @@ def pix_sub_weights_split_points(self):
7169
@property
7270
def mapping_matrix(self):
7371
return self._mapping_matrix
74-
75-
def interpolated_array_from(
76-
self,
77-
values: np.ndarray,
78-
shape_native: Tuple[int, int] = (401, 401),
79-
extent: Optional[Tuple[float, float, float, float]] = None,
80-
):
81-
return self._interpolated_array

autoarray/plot/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
from autoarray.plot.wrap.two_d.grid_errorbar import GridErrorbar
2929
from autoarray.plot.wrap.two_d.vector_yx_quiver import VectorYXQuiver
3030
from autoarray.plot.wrap.two_d.patch_overlay import PatchOverlay
31-
from autoarray.plot.wrap.two_d.interpolated_reconstruction import (
32-
InterpolatedReconstruction,
33-
)
3431
from autoarray.plot.wrap.two_d.delaunay_drawer import DelaunayDrawer
3532
from autoarray.plot.wrap.two_d.origin_scatter import OriginScatter
3633
from autoarray.plot.wrap.two_d.mask_scatter import MaskScatter

autoarray/plot/mat_plot/two_d.py

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def __init__(
4949
grid_errorbar: Optional[w2d.GridErrorbar] = None,
5050
vector_yx_quiver: Optional[w2d.VectorYXQuiver] = None,
5151
patch_overlay: Optional[w2d.PatchOverlay] = None,
52-
interpolated_reconstruction: Optional[w2d.InterpolatedReconstruction] = None,
5352
delaunay_drawer: Optional[w2d.DelaunayDrawer] = None,
5453
origin_scatter: Optional[w2d.OriginScatter] = None,
5554
mask_scatter: Optional[w2d.MaskScatter] = None,
@@ -135,8 +134,6 @@ def __init__(
135134
Overlays matplotlib `patches.Patch` objects over the figure, such as an `Ellipse`.
136135
delaunay_drawer
137136
Draws a colored Delaunay mesh of pixels using `plt.tripcolor`.
138-
interpolated_reconstruction
139-
Draws a colored Delaunay mesh of pixels using `plt.fill`.
140137
origin_scatter
141138
Scatters the (y,x) origin of the data structure on the figure.
142139
mask_scatter
@@ -190,10 +187,6 @@ def __init__(
190187
self.vector_yx_quiver = vector_yx_quiver or w2d.VectorYXQuiver(is_default=True)
191188
self.patch_overlay = patch_overlay or w2d.PatchOverlay(is_default=True)
192189

193-
self.interpolated_reconstruction = (
194-
interpolated_reconstruction
195-
or w2d.InterpolatedReconstruction(is_default=True)
196-
)
197190
self.delaunay_drawer = delaunay_drawer or w2d.DelaunayDrawer(is_default=True)
198191

199192
self.origin_scatter = origin_scatter or w2d.OriginScatter(is_default=True)
@@ -694,36 +687,19 @@ def _plot_delaunay_mapper(
694687

695688
interpolation_array = None
696689

697-
if interpolate_to_uniform:
698-
interpolation_array = (
699-
self.interpolated_reconstruction.imshow_reconstruction(
700-
mapper=mapper,
701-
pixel_values=pixel_values,
702-
units=self.units,
703-
cmap=self.cmap,
704-
colorbar=self.colorbar,
705-
colorbar_tickparams=self.colorbar_tickparams,
706-
aspect=aspect_inv,
707-
ax=ax,
708-
use_log10=self.use_log10,
709-
)
710-
)
711-
712-
else:
713-
714-
if hasattr(pixel_values, "array"):
715-
pixel_values = pixel_values.array
690+
if hasattr(pixel_values, "array"):
691+
pixel_values = pixel_values.array
716692

717-
self.delaunay_drawer.draw_delaunay_pixels(
718-
mapper=mapper,
719-
pixel_values=pixel_values,
720-
units=self.units,
721-
cmap=self.cmap,
722-
colorbar=self.colorbar,
723-
colorbar_tickparams=self.colorbar_tickparams,
724-
ax=ax,
725-
use_log10=self.use_log10,
726-
)
693+
self.delaunay_drawer.draw_delaunay_pixels(
694+
mapper=mapper,
695+
pixel_values=pixel_values,
696+
units=self.units,
697+
cmap=self.cmap,
698+
colorbar=self.colorbar,
699+
colorbar_tickparams=self.colorbar_tickparams,
700+
ax=ax,
701+
use_log10=self.use_log10,
702+
)
727703

728704
self.title.set(auto_title=auto_labels.title)
729705
self.ylabel.set()

autoarray/plot/wrap/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
from autoarray.plot.wrap.two_d.grid_errorbar import GridErrorbar
2626
from autoarray.plot.wrap.two_d.vector_yx_quiver import VectorYXQuiver
2727
from autoarray.plot.wrap.two_d.patch_overlay import PatchOverlay
28-
from autoarray.plot.wrap.two_d.interpolated_reconstruction import (
29-
InterpolatedReconstruction,
30-
)
3128
from autoarray.plot.wrap.two_d.origin_scatter import OriginScatter
3229
from autoarray.plot.wrap.two_d.mask_scatter import MaskScatter
3330
from autoarray.plot.wrap.two_d.border_scatter import BorderScatter

autoarray/plot/wrap/two_d/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
from .grid_errorbar import GridErrorbar
77
from .vector_yx_quiver import VectorYXQuiver
88
from .patch_overlay import PatchOverlay
9-
from .interpolated_reconstruction import (
10-
InterpolatedReconstruction,
11-
)
129
from .delaunay_drawer import DelaunayDrawer
1310
from .origin_scatter import OriginScatter
1411
from .mask_scatter import MaskScatter

autoarray/plot/wrap/two_d/interpolated_reconstruction.py

Lines changed: 0 additions & 110 deletions
This file was deleted.

test_autoarray/inversion/inversion/test_mapper_valued.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -54,36 +54,8 @@ def test__max_pixel_list_from__filter_neighbors():
5454
]
5555

5656

57-
def test__interpolated_array_from():
58-
values = np.array([0.0, 1.0, 1.0, 1.0])
5957

60-
mapper = aa.m.MockMapper(parameters=4, interpolated_array=values)
6158

62-
mapper_valued = aa.MapperValued(values=values, mapper=mapper)
63-
64-
values = mapper_valued.interpolated_array_from(
65-
shape_native=(3, 3), extent=(-0.2, 0.2, -0.3, 0.3)
66-
)
67-
68-
assert (values == np.array([0.0, 1.0, 1.0, 1.0])).all()
69-
70-
71-
def test__interpolated_array_from__with_pixel_mask():
72-
values = np.array([0.0, 1.0, 1.0, 1.0])
73-
74-
mapper = aa.m.MockMapper(parameters=4, interpolated_array=values)
75-
76-
mesh_pixel_mask = np.array([True, False, False, True])
77-
78-
mapper_valued = aa.MapperValued(
79-
values=values, mapper=mapper, mesh_pixel_mask=mesh_pixel_mask
80-
)
81-
82-
values = mapper_valued.interpolated_array_from(
83-
shape_native=(3, 3), extent=(-0.2, 0.2, -0.3, 0.3)
84-
)
85-
86-
assert values == pytest.approx(np.array([0.0, 1.0, 1.0, 1.0]), 1.0e-4)
8759

8860

8961
def test__magnification_via_mesh_from():

test_autoarray/inversion/pixelization/mappers/test_abstract.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -133,38 +133,6 @@ def test__adaptive_pixel_signals_from___matches_util(grid_2d_7x7, image_7x7):
133133
assert (pixel_signals == pixel_signals_util).all()
134134

135135

136-
def test__interpolated_array_from(grid_2d_7x7):
137-
mesh_grid_ndarray = aa.Grid2D.no_mask(
138-
values=[[0.1, 0.1], [1.1, 0.6], [2.1, 0.1], [0.4, 1.1], [1.1, 7.1], [2.1, 1.1]],
139-
shape_native=(3, 2),
140-
pixel_scales=1.0,
141-
)
142-
143-
mesh_grid = aa.Mesh2DDelaunay(values=mesh_grid_ndarray)
144-
145-
mapper_grids = aa.MapperGrids(
146-
mask=grid_2d_7x7.mask,
147-
source_plane_data_grid=grid_2d_7x7,
148-
source_plane_mesh_grid=mesh_grid,
149-
)
150-
151-
mapper = aa.Mapper(mapper_grids=mapper_grids, regularization=None)
152-
153-
interpolated_array_via_mapper = mapper.interpolated_array_from(
154-
values=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]),
155-
shape_native=(3, 3),
156-
extent=(-0.2, 0.2, -0.2, 0.2),
157-
)
158-
159-
interpolated_array_via_grid = mesh_grid.interpolated_array_from(
160-
values=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]),
161-
shape_native=(3, 3),
162-
extent=(-0.2, 0.2, -0.2, 0.2),
163-
)
164-
165-
assert (interpolated_array_via_mapper == interpolated_array_via_grid).all()
166-
167-
168136
def test__mapped_to_source_from(grid_2d_7x7):
169137
mesh_grid = aa.Grid2D.no_mask(
170138
values=[[0.1, 0.1], [1.1, 0.6], [2.1, 0.1], [0.4, 1.1], [1.1, 7.1], [2.1, 1.1]],

test_autoarray/inversion/pixelization/mesh/test_mesh_util.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -104,30 +104,3 @@ def test__rectangular_neighbors_from():
104104
assert (
105105
neighbors_sizes == np.array([2, 3, 3, 2, 3, 4, 4, 3, 3, 4, 4, 3, 2, 3, 3, 2])
106106
).all()
107-
108-
109-
def test__delaunay_interpolated_grid_from():
110-
shape_native = (3, 3)
111-
112-
grid_interpolate_slim = aa.Grid2D.uniform(
113-
shape_native=shape_native, pixel_scales=1.0
114-
).slim
115-
116-
delaunay_grid = np.array(
117-
[[1.0, -1.0], [1.0, 1.0], [0.0, 0.0], [-1.0, -1.0], [-1.0, 1.0]]
118-
)
119-
120-
delaunay = scipy.spatial.Delaunay(delaunay_grid)
121-
122-
values = np.array([1.0, 2.0, 3.0, 4.0, 5.0])
123-
124-
interpolated_grid = aa.util.mesh_numba.delaunay_interpolated_array_from(
125-
shape_native=shape_native,
126-
interpolation_grid_slim=grid_interpolate_slim,
127-
pixel_values=values,
128-
delaunay=delaunay,
129-
)
130-
131-
assert interpolated_grid == pytest.approx(
132-
np.array([[1.0, 1.5, 2.0], [2.5, 3.0, 3.5], [4.0, 4.5, 5.0]]), 1.0e-4
133-
)

test_autoarray/structures/mesh/test_delaunay.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,6 @@
33

44
import autoarray as aa
55

6-
7-
def test__interpolated_array_from():
8-
grid = aa.Grid2D.no_mask(
9-
values=[[0.0, 0.0], [1.1, 0.6], [2.1, 0.1], [0.4, 1.1], [1.1, 7.1], [2.1, 1.1]],
10-
shape_native=(3, 2),
11-
pixel_scales=1.0,
12-
)
13-
14-
mesh = aa.Mesh2DDelaunay(values=grid)
15-
16-
interpolated_array = mesh.interpolated_array_from(
17-
values=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape_native=(3, 2)
18-
)
19-
20-
assert interpolated_array.native == pytest.approx(
21-
np.array([[3.0, 5.0], [2.0, 5.0], [1.0, 5.0]]), 1.0e-4
22-
)
23-
24-
interpolated_array = mesh.interpolated_array_from(
25-
values=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]), shape_native=(2, 3)
26-
)
27-
28-
assert interpolated_array.native == pytest.approx(
29-
np.array([[3.0, 6.0, 5.0], [1.0, 4.0, 5.0]]), 1.0e-4
30-
)
31-
32-
interpolated_array = mesh.interpolated_array_from(
33-
values=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0]),
34-
shape_native=(3, 2),
35-
extent=(-0.4, 0.4, -0.4, 0.4),
36-
)
37-
38-
assert interpolated_array.native == pytest.approx(
39-
np.array([[1.0, 1.907216], [1.0, 1.0], [1.0, 1.0]]), 1.0e-4
40-
)
41-
42-
436
def test__neighbors(grid_2d_sub_1_7x7):
447

458
mesh_grid = aa.Grid2D.no_mask(

0 commit comments

Comments
 (0)