autoarray.inversion.mesh.mesh.Delaunay#

class Delaunay[source]#

Bases: AbstractMesh

A Delaunay mesh composed of irregular triangular pixels used to reconstruct a source on an unstructured grid.

The mesh consists of pixels vertices in the source plane, which are connected via a Delaunay triangulation to form triangular elements. Each vertex represents a linear parameter in the inversion.

Source-plane coordinates are interpolated onto this mesh using barycentric interpolation within the enclosing triangle. For each coordinate, the three vertices of the containing Delaunay triangle are identified and weighted according to their barycentric distances, providing a smooth, piecewise-linear reconstruction.

Methods

interpolator_from

Mapper objects describe the mappings between pixels in the masked 2D data and the pixels in a mesh, in both the data and source frames.

relocated_grid_from

Relocates all coordinates of the input source_plane_data_grid that are outside of a border (which is defined by a grid of (y,x) coordinates) to the edge of this border.

relocated_mesh_grid_from

Relocates all coordinates of the input source_plane_mesh_grid that are outside of a border (which is defined by a grid of (y,x) coordinates) to the edge of this border.

Attributes

interpolator_cls

skip_areas

Whether to skip barycentric area calculations and split point computations during Delaunay triangulation.

zeroed_pixels

Return the positive mesh-local pixel indices to zero for a Delaunay mesh.

property zeroed_pixels#

Return the positive mesh-local pixel indices to zero for a Delaunay mesh.

For Delaunay meshes, self.zeroed_pixels is interpreted as a count of pixels to be zeroed at the end of the pixel block. For example:

self.pixels = 780, self.zeroed_pixels = 30

returns indices 750..779.

Returns:

1D array of positive pixel indices to zero.

Return type:

np.ndarray

property skip_areas#

Whether to skip barycentric area calculations and split point computations during Delaunay triangulation. When True, the Delaunay interface returns only the minimal set of outputs (points, simplices, mappings) without computing split_points or splitted_mappings. This optimization is useful for regularization schemes like Matérn kernels that don’t require area-based calculations. Default is False.

property interpolator_cls#
interpolator_from(source_plane_data_grid, source_plane_mesh_grid, border_relocator=None, adapt_data=None, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautogalaxy/envs/latest/lib/python3.11/site-packages/numpy/__init__.py'>)[source]#

Mapper objects describe the mappings between pixels in the masked 2D data and the pixels in a mesh, in both the data and source frames.

This function returns a MapperDelaunay as follows:

  1. Before this routine is called, a sparse grid of (y,x) coordinates are computed from the 2D masked data, the image_plane_mesh_grid, which acts as the Delaunay triangle vertexes of the mesh and mapper.

  2. Before this routine is called, operations are performed on this image_plane_mesh_grid that transform it from a 2D grid which overlaps with the 2D mask of the data in the data frame to an irregular grid in the source frame, the source_plane_mesh_grid.

  3. If the border relocator is input, the border of the input source_plane_data_grid is used to relocate all of the grid’s (y,x) coordinates beyond the border to the edge of the border.

  4. If the border relocatiro is input, the border of the input source_plane_data_grid is used to relocate all of the transformed source_plane_mesh_grid’s (y,x) coordinates beyond the border to the edge of the border.

  5. Use the transformed source_plane_mesh_grid’s (y,x) coordinates as the Vertex of the Delaunay mesh.

Parameters:
  • border_relocator (Optional[BorderRelocator]) – The border relocator, which relocates coordinates outside the border of the source-plane data grid to its edge.

  • source_plane_data_grid (Grid2D) – A 2D grid of (y,x) coordinates associated with the unmasked 2D data after it has been transformed to the source reference frame.

  • source_plane_mesh_grid (Grid2DIrregular) – The vertex of every Delaunay triangle pixel in the source frame, which are initially derived by computing a sparse set of (y,x) coordinates computed from the unmasked data in the data frame and applying a transformation to this.

  • image_plane_mesh_grid – The sparse set of (y,x) coordinates computed from the unmasked data in the data frame. This has a transformation applied to it to create the source_plane_mesh_grid.

  • adapt_data (ndarray) – Not used for a rectangular mesh.