autoarray.inversion.pixelizations.VoronoiNNMagnification#

class autoarray.inversion.pixelizations.VoronoiNNMagnification(shape: Tuple[int, int] = (3, 3))[source]#

A full description of this class is given for the class VoronoiMagnification.

The only difference for this class is that when it is used by the Mapper to map coordinates from the data frame to source frame it uses interpolation. This means that every pixel in the data is mapped to multiple Voronoi pixels, where these mappings are weighted.

This uses uses a natural neighbor interpolation scheme (https://en.wikipedia.org/wiki/Natural_neighbor_interpolation).

__init__(shape: Tuple[int, int] = (3, 3))#

A pixelization associates a 2D grid of (y,x) coordinates (which are expected to be aligned with a masked dataset) with a 2D grid of pixels.

The Voronoi pixelization represents pixels as an irregular grid of Voronoi cells which can form any shape, size or tesselation.

Both of these grids (e.g. the masked dataset’s 2D grid and the grid of the Voronoi pixelization’s pixels) have (y,x) coordinates in two reference frames:

  • data: the original reference frame of the masked data.

  • source: a reference frame where grids in the data reference frame are transformed to a new reference

frame (e.g. their (y,x) coordinates may be shifted, stretched or have a more complicated operation performed on them).

The grid associated with the masked dataset and Voronoi pixelization have the following variable names:

  • grid_slim: the (y,x) grid of coordinates of the original masked data (which can be in the data frame and

given the variable name data_grid_slim or in the transformed source frame with the variable name source_grid_slim).

  • pixelization_grid: the (y,x) grid of Voronoi pixels which are associated with the grid_slim (y,x)

coordinates (association is always performed in the source reference frame).

A Voronoi pixelization has four grids associated with it: data_grid_slim, source_grid_slim, data_pixelization_grid and source_pixelization_grid.

If a transformation of coordinates is not applied, the data frame and source frames are identical.

The (y,x) coordinates of the source_pixelization_grid represent the centres of the Voronoi pixels on the Voronoi mesh.

Each (y,x) coordinate in the source_grid_slim is associated with the Voronoi pixel whose centre is its nearest neighbor. Voronoi pixelizations do not use a weighted interpolation scheme (unlike the Delaunay) pixelization.

For the VoronoiMagnification pixelization the centres of the Voronoi grid are derived in the data frame, by overlaying a uniform grid with the input shape over the masked data’s grid. All coordinates in this uniform grid which are contained within the mask are kept, have the same transformation applied to them as the masked data’s grid to map them to the source frame, where they form the pixelization’s Voronoi pixel centres.

In the project PyAutoLens, one’s data is a masked 2D image. Its data_grid_slim is a 2D grid where every (y,x) coordinate is aligned with the centre of every unmasked image pixel. A “lensing operation” transforms this grid of (y,x) coordinates from the data frame to a new grid of (y,x) coordinates in the source frame. The pixelization is then applied in the source frame.. In lensing terminology, the data frame is the image-plane and source frame the source-plane.

Parameters

shape – The shape of the unmasked pixelization_grid in the data frame which is laid over the masked image, in order to derive the centres of the Voronoi pixels in the data frame.

Methods

__init__([shape])

A pixelization associates a 2D grid of (y,x) coordinates (which are expected to be aligned with a masked dataset) with a 2D grid of pixels.

data_pixelization_grid_from(data_grid_slim)

Computes the pixelization_grid in the data frame, by overlaying a uniform grid of coordinates over the masked 2D data (see Grid2DSparse.from_grid_and_unmasked_2d_grid_shape()).

mapper_from(source_grid_slim[, …])

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

pixelization_grid_from([source_grid_slim, …])

Return the Voronoi source_pixelization_grid as a Grid2DVoronoi object, which provides additional functionality for performing operations that exploit the geometry of a Voronoi pixelization.

relocated_grid_from(source_grid_slim[, …])

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

relocated_pixelization_grid_from(…[, settings])

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

weight_map_from(hyper_image)

Attributes

is_stochastic

uses_interpolation