autoarray.inversion.pixelization.image_mesh.Hilbert#

class Hilbert[source]#

Bases: AbstractImageMeshWeighted

Computes an image-mesh by computing the Hilbert curve of the adapt data and drawing points from it.

This requires an adapt-image, which is the image that the Hilbert curve algorithm adapts to in order to compute the image mesh. This could simply be the image itself, or a model fit to the image which removes certain features or noise.

For example, using the adapt image, the image mesh is computed as follows:

  1. Convert the adapt image to a weight map, which is a 2D array of weight values.

2) Run the Hilbert algorithm on the weight map, such that the image mesh pixels cluster around the weight map values with higher values.

Parameters:
  • pixels – The total number of pixels in the image mesh and drawn from the Hilbert curve.

  • weight_floor – The minimum weight value in the weight map, which allows more pixels to be drawn from the lower weight regions of the adapt image.

  • weight_power – The power the weight values are raised too, which allows more pixels to be drawn from the higher weight regions of the adapt image.

Methods

check_adapt_background_pixels

Checks the number of mesh pixels in the background of the image-mesh and raises an InversionException if there are fewer mesh pixels in the background than the input settings.

check_mesh_pixels_per_image_pixels

Checks the number of mesh pixels in every image pixel and raises an InversionException if there are fewer mesh pixels inside a certain number of image-pixels than the input settings.

image_plane_mesh_grid_from

Returns an image mesh by running the Hilbert curve on the weight map.

mesh_pixels_per_image_pixels_from

Returns an array containing the number of mesh pixels in every pixel of the data's mask.

weight_map_from

Returns the weight-map used by the image-mesh to compute the mesh pixel centres.

Attributes

uses_adapt_images

rtype:

bool

image_plane_mesh_grid_from(grid, adapt_data, settings=None)[source]#

Returns an image mesh by running the Hilbert curve on the weight map.

See the __init__ docstring for a full description of how this is performed.

Parameters:
  • grid (Grid2D) – The grid of (y,x) coordinates of the image data the pixelization fits, which the Hilbert curve adapts to.

  • adapt_data (Optional[ndarray]) – The weights defining the regions of the image the Hilbert curve adapts to.

Return type:

Grid2DIrregular