Skip to content

Commit b20d6b1

Browse files
Jammy2211Jammy2211
authored andcommitted
remove all Voronoi support
1 parent d0a90b4 commit b20d6b1

133 files changed

Lines changed: 587 additions & 103509 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

autoarray/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from .inversion.pixelization.mappers.factory import mapper_from as Mapper
4343
from .inversion.pixelization.mappers.rectangular import MapperRectangular
4444
from .inversion.pixelization.mappers.delaunay import MapperDelaunay
45-
from .inversion.pixelization.mappers.voronoi import MapperVoronoi
4645
from .inversion.pixelization.mappers.rectangular_uniform import MapperRectangularUniform
4746
from .inversion.pixelization.image_mesh.abstract import AbstractImageMesh
4847
from .inversion.pixelization.mesh.abstract import AbstractMesh
@@ -77,7 +76,6 @@
7776
from .structures.grids.irregular_2d import Grid2DIrregular
7877
from .structures.mesh.rectangular_2d import Mesh2DRectangular
7978
from .structures.mesh.rectangular_2d_uniform import Mesh2DRectangularUniform
80-
from .structures.mesh.voronoi_2d import Mesh2DVoronoi
8179
from .structures.mesh.delaunay_2d import Mesh2DDelaunay
8280
from .structures.arrays.kernel_2d import Kernel2D
8381
from .structures.vectors.uniform import VectorYX2D

autoarray/config/general.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,5 @@ numba:
1414
cache: true
1515
nopython: true
1616
parallel: false
17-
pixelization:
18-
voronoi_nn_max_interpolation_neighbors: 300
1917
structures:
2018
native_binned_only: false # If True, data structures are only stored in their native and binned format. This is used to reduce memory usage in autocti.

autoarray/config/visualize/mat_wrap_2d.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,6 @@ DelaunayDrawer: # wrapper for `plt.fill()`: customize the appearance of De
155155
alpha: 0.7
156156
edgecolor: k
157157
linewidth: 0.0
158-
VoronoiDrawer: # wrapper for `plt.fill()`: customize the appearance of Voronoi mesh's.
159-
figure:
160-
alpha: 0.7
161-
edgecolor: k
162-
linewidth: 0.3
163-
subplot:
164-
alpha: 0.7
165-
edgecolor: k
166-
linewidth: 0.3
167158
ParallelOverscanPlot:
168159
figure:
169160
c: k

autoarray/fixtures.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -380,29 +380,6 @@ def make_delaunay_mesh_grid_9():
380380

381381
return aa.Mesh2DDelaunay(values=grid_9)
382382

383-
384-
def make_voronoi_mesh_grid_9():
385-
grid_9 = aa.Grid2D.no_mask(
386-
values=[
387-
[0.6, -0.3],
388-
[0.5, -0.8],
389-
[0.2, 0.1],
390-
[0.0, 0.5],
391-
[-0.3, -0.8],
392-
[-0.6, -0.5],
393-
[-0.4, -1.1],
394-
[-1.2, 0.8],
395-
[-1.5, 0.9],
396-
],
397-
shape_native=(3, 3),
398-
pixel_scales=1.0,
399-
)
400-
401-
return aa.Mesh2DVoronoi(
402-
values=grid_9,
403-
)
404-
405-
406383
def make_over_sampler_2d_7x7():
407384
return aa.OverSampler(mask=make_mask_2d_7x7(), sub_size=2)
408385

@@ -444,23 +421,6 @@ def make_delaunay_mapper_9_3x3():
444421
regularization=make_regularization_constant(),
445422
)
446423

447-
448-
def make_voronoi_mapper_9_3x3():
449-
mapper_grids = aa.MapperGrids(
450-
mask=make_mask_2d_7x7(),
451-
source_plane_data_grid=make_grid_2d_sub_2_7x7(),
452-
source_plane_mesh_grid=make_voronoi_mesh_grid_9(),
453-
image_plane_mesh_grid=aa.Grid2D.uniform(shape_native=(3, 3), pixel_scales=0.1),
454-
adapt_data=aa.Array2D.ones(shape_native=(3, 3), pixel_scales=0.1),
455-
)
456-
457-
return aa.MapperVoronoi(
458-
mapper_grids=mapper_grids,
459-
border_relocator=make_border_relocator_2d_7x7(),
460-
regularization=make_regularization_constant(),
461-
)
462-
463-
464424
def make_rectangular_inversion_7x7_3x3():
465425
return aa.Inversion(
466426
dataset=make_masked_imaging_7x7(),
@@ -474,13 +434,6 @@ def make_delaunay_inversion_9_3x3():
474434
linear_obj_list=[make_delaunay_mapper_9_3x3()],
475435
)
476436

477-
478-
def make_voronoi_inversion_9_3x3():
479-
return aa.Inversion(
480-
dataset=make_masked_imaging_7x7(), linear_obj_list=[make_voronoi_mapper_9_3x3()]
481-
)
482-
483-
484437
### EUCLID DATA ####
485438

486439

autoarray/inversion/inversion/mapper_valued.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, mapper, values, mesh_pixel_mask: Optional[np.ndarray] = None)
1616
mapper pixel) in order to perform calculations which use both the `Mapper` and these values.
1717
1818
For example, a common use case is to interpolate the reconstruction of values on a mapper from the
19-
mesh of the mapper (e.g. a Voronoi mesh) to a uniform Cartesian grid of values, because the irregular mesh
19+
mesh of the mapper (e.g. a Delaunay mesh) to a uniform Cartesian grid of values, because the irregular mesh
2020
is difficult to plot and analyze.
2121
2222
This class also provides functionality to compute the magnification of the reconstruction, by comparing the
@@ -26,7 +26,7 @@ def __init__(self, mapper, values, mesh_pixel_mask: Optional[np.ndarray] = None)
2626
Parameters
2727
----------
2828
mapper
29-
The `Mapper` object which pairs with the values, for example a `MapperVoronoi` object.
29+
The `Mapper` object which pairs with the values, for example a `MapperDelaunay` object.
3030
values
3131
The values of each pixel of the mapper, which could be the `reconstruction` values of an `Inversion`,
3232
but alternatively could be other quantities such as the noise-map of these values.
@@ -71,7 +71,7 @@ def interpolated_array_from(
7171
extent: Optional[Tuple[float, float, float, float]] = None,
7272
) -> Array2D:
7373
"""
74-
The values of a mapper can be on an irregular pixelization (e.g. a Delaunay triangulation, Voronoi mesh).
74+
The values of a mapper can be on an irregular pixelization (e.g. a Delaunay triangulation).
7575
7676
Analysing the reconstruction can therefore be difficult and require specific functionality tailored to using
7777
this irregular grid.
@@ -218,7 +218,8 @@ def magnification_via_mesh_from(
218218
PSF, as the source plane reconstruction is a non-convolved image.
219219
220220
In the source-plane, this is computed by summing the reconstruction values multiplied by the area of each
221-
mesh pixel, for example if the source-plane is a `Voronoi` mesh this is the area of each Voronoi pixel.
221+
mesh pixel, for example if the source-plane is a `Delaunay` mesh this is the area of each corresponding
222+
Delaunay pixel.
222223
223224
This calculatiion is generally more robust that using an interpolated
224225
image (see `magnification_via_interpolation_from`), because it uses the exact the source-plane reconstruction
@@ -244,7 +245,7 @@ def magnification_via_mesh_from(
244245
245246
To compute the magnification of a `Delaunay` mesh, use the method `magnification_via_interpolation_from`.
246247
247-
This method only supports a `RectangularMagnification` or `Voronoi` mesh.
248+
This method only supports a `RectangularMagnification`.
248249
"""
249250
)
250251

@@ -257,8 +258,7 @@ def magnification_via_mesh_from(
257258
"""
258259
The magnification cannot be computed because the areas of the source-plane mesh pixels are all zero.
259260
260-
This probably means you have specified an invalid source-plane mesh, for example a `Voronoi` mesh
261-
where all pixels are on the edge of the source-plane and therefore have an infinite border.
261+
This probably means you have specified an invalid source-plane mesh.
262262
"""
263263
)
264264

autoarray/inversion/linear_obj/neighbors.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
class Neighbors(np.ndarray):
55
def __new__(cls, arr: np.ndarray, sizes: np.ndarray):
66
"""
7-
Class packaging ndarrays describing the neighbors of every pixel in a mesh (e.g. `RectangularMagnification`,
8-
`Voronoi`).
7+
Class packaging ndarrays describing the neighbors of every pixel in a mesh (e.g. `RectangularMagnification`).
98
109
The array `arr` contains the pixel indexes of the neighbors of every pixel. Its has shape [total_pixels,
1110
max_neighbors_in_single_pixel].
@@ -28,7 +27,7 @@ def __new__(cls, arr: np.ndarray, sizes: np.ndarray):
2827
2928
- For pixel 4, the central pixel, neighbors[4,:] = [1, 3, 5, 7] and neighbors_sizes[4] = 4.
3029
31-
The same arrays can be generalized for other pixelizations, for example a `Voronoi` grid.
30+
The same arrays can be generalized for other pixelizations, for example a `Delaunay` grid.
3231
3332
Parameters
3433
----------

autoarray/inversion/pixelization/mappers/abstract.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ def interpolated_array_from(
420420
) -> Array2D:
421421
"""
422422
The reconstructed values of a mapper (e.g. the `reconstruction` of an `Inversion` may be on an irregular
423-
pixelization (e.g. a Delaunay triangulation, Voronoi mesh).
423+
pixelization (e.g. a Delaunay triangulation).
424424
425425
Analysing the reconstruction can therefore be difficult and require specific functionality tailored to using
426426
this irregular grid.
@@ -437,7 +437,7 @@ def interpolated_array_from(
437437
----------
438438
values
439439
The value corresponding to the reconstructed value of every pixelization pixel (e.g. Delaunay triangle
440-
vertexes, Voronoi mesh cells).
440+
vertexes).
441441
shape_native
442442
The 2D shape in pixels of the interpolated reconstruction, which is always returned using square pixels.
443443
extent

autoarray/inversion/pixelization/mappers/factory.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from autoarray.structures.mesh.rectangular_2d import Mesh2DRectangular
88
from autoarray.structures.mesh.rectangular_2d_uniform import Mesh2DRectangularUniform
99
from autoarray.structures.mesh.delaunay_2d import Mesh2DDelaunay
10-
from autoarray.structures.mesh.voronoi_2d import Mesh2DVoronoi
1110

1211

1312
def mapper_from(
@@ -47,7 +46,6 @@ def mapper_from(
4746
MapperRectangularUniform,
4847
)
4948
from autoarray.inversion.pixelization.mappers.delaunay import MapperDelaunay
50-
from autoarray.inversion.pixelization.mappers.voronoi import MapperVoronoi
5149

5250
if isinstance(mapper_grids.source_plane_mesh_grid, Mesh2DRectangularUniform):
5351
return MapperRectangularUniform(
@@ -70,10 +68,3 @@ def mapper_from(
7068
regularization=regularization,
7169
xp=xp,
7270
)
73-
elif isinstance(mapper_grids.source_plane_mesh_grid, Mesh2DVoronoi):
74-
return MapperVoronoi(
75-
mapper_grids=mapper_grids,
76-
border_relocator=border_relocator,
77-
regularization=regularization,
78-
xp=xp,
79-
)

0 commit comments

Comments
 (0)