autoarray.inversion.pixelization.mesh.Rectangular#

class Rectangular[source]#

Bases: AbstractMesh

A uniform mesh of rectangular pixels, which without interpolation are paired with a 2D grid of (y,x) coordinates.

For a full description of how a mesh is paired with another grid, see the Pixelization API documentation.

The rectangular grid is uniform, has dimensions (total_y_pixels, total_x_pixels) and has indexing beginning in the top-left corner and going rightwards and downwards.

A Pixelization using a Rectangular mesh has three grids associated with it:

  • image_plane_data_grid: The observed data grid in the image-plane (which is paired with the mesh in the source-plane).

  • source_plane_data_grid: The observed data grid mapped to the source-plane after gravitational lensing.

  • source_plane_mesh_grid: The centres of each rectangular pixel.

It does not have a image_plane_mesh_grid because a rectangular pixelization is constructed by overlaying a grid of rectangular over the source_plane_data_grid.

Each (y,x) coordinate in the source_plane_data_grid is associated with the rectangular pixelization pixel it falls within. No interpolation is performed when making these associations. :type shape: Tuple[int, int] :param shape: The 2D dimensions of the rectangular grid of pixels (total_y_pixels, total_x_pixel).

Methods

image_plane_mesh_grid_from

Not used for rectangular pixelization.

mapper_grids_from

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.

mesh_grid_from

Return the rectangular source_plane_mesh_grid as a Mesh2DRectangular object, which provides additional functionality for perform operatons that exploit the geometry of a rectangular pixelization.

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.

weight_map_from

Attributes

is_stochastic

uses_interpolation

Does this Mesh object use interpolation when pairing with another 2D grid?

property uses_interpolation: bool#

Does this Mesh object use interpolation when pairing with another 2D grid?

Return type

bool

mapper_grids_from(source_plane_data_grid, source_plane_mesh_grid=None, image_plane_mesh_grid=None, adapt_data=None, settings=<autoarray.inversion.pixelization.settings.SettingsPixelization object>, preloads=<autoarray.preloads.Preloads object>, run_time_dict=None)[source]#

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.

This function returns a MapperRectangularNoInterp as follows:

  1. If settings.use_border=True, 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.

  2. Determine the (y,x) coordinates of the pixelization’s rectangular pixels, by laying this rectangular grid over the 2D grid of relocated (y,x) coordinates computed in step 1 (or the input source_plane_data_grid if step 1 is bypassed).

  3. Return the MapperRectangularNoInterp.

Parameters
  • 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 (Optional[Grid2D]) – Not used for a rectangular pixelization, because the pixelization grid in the source frame is computed by overlaying the source_plane_data_grid with the rectangular pixelization.

  • image_plane_mesh_grid (Optional[Grid2D]) – Not used for a rectangular pixelization.

  • adapt_data (Optional[ndarray]) – Not used for a rectangular pixelization.

  • settings (SettingsPixelization) – Settings controlling the pixelization for example if a border is used to relocate its exterior coordinates.

  • preloads (Preloads) – Object which may contain preloaded arrays of quantities computed in the pixelization, which are passed via this object speed up the calculation.

  • run_time_dict (Optional[Dict]) – A dictionary which contains timing of certain functions calls which is used for profiling.

Return type

MapperGrids

mesh_grid_from(source_plane_data_grid=None, source_plane_mesh_grid=None, sparse_index_for_slim_index=None)[source]#

Return the rectangular source_plane_mesh_grid as a Mesh2DRectangular object, which provides additional functionality for perform operatons that exploit the geometry of a rectangular pixelization.

Parameters
  • source_plane_data_grid (Optional[Grid2D]) – The (y,x) grid of coordinates over which the rectangular pixelization is overlaid, where this grid may have had exterior pixels relocated to its edge via the border.

  • source_plane_mesh_grid (Optional[Grid2D]) – Not used for a rectangular pixelization, because the pixelization grid in the source frame is computed by overlaying the source_plane_data_grid with the rectangular pixelization.

  • sparse_index_for_slim_index (Optional[ndarray]) – Not used for a rectangular pixelization.

Return type

Mesh2DRectangular

image_plane_mesh_grid_from(image_plane_data_grid, adapt_data=None, settings=<autoarray.inversion.pixelization.settings.SettingsPixelization object>)[source]#

Not used for rectangular pixelization.