autoarray.inversion.mesh.mesh.RectangularAdaptDensity#

class RectangularAdaptDensity[source]#

Bases: AbstractMesh

A uniform rectangular mesh of pixels used to reconstruct a source on a regular grid.

The mesh is defined by a 2D shape (total_y_pixels, total_x_pixels) and is indexed in row-major order:

  • Index 0 corresponds to the top-left pixel.

  • Indices increase from left to right across each row, and from top to bottom across rows.

Each source-plane coordinate is associated with the rectangular pixel in which it lies. No interpolation is performed — every coordinate contributes entirely to a single pixel.

Methods

interpolator_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_weight_map_from

The weight map of a rectangular pixelization is None, because magnificaiton adaption uses the distribution and density of traced (y,x) coordinates in the source plane and not weights or the adapt data.

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

zeroed_pixels

Return the positive 1D pixel indices of the edge pixels in a rectangular mesh.

property zeroed_pixels#

Return the positive 1D pixel indices of the edge pixels in a rectangular mesh.

Indices are in row-major (C-order) flattened form for the rectangular pixel grid:
  • 0 corresponds to the top-left pixel (row=0, col=0)

  • indices increase across rows

These indices are defined purely within the rectangular mesh’s pixel indexing scheme (size = rows * cols) and are intended to be shifted / mapped to the full inversion indexing inside the inversion logic.

Returns:

A 1D array of positive indices corresponding to edge pixels.

Return type:

np.ndarray

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

The weight map of a rectangular pixelization is None, because magnificaiton adaption uses the distribution and density of traced (y,x) coordinates in the source plane and not weights or the adapt data.

Parameters:

xp – The array library to use.

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 pixelization, in both the data and source frames.

This function returns a MapperRectangular as follows:

  1. If the bordr 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.

  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 MapperRectangular.

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) – 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 – Not used for a rectangular pixelization.

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