autolens.Grid2DIterate#

class Grid2DIterate[source]#

Bases: Grid2D

Represents a grid of coordinates as described for the Grid2D class, but using an iterative sub-grid that adapts its resolution when it is input into a function that performs an analytic calculation.

A Grid2D represents (y,x) coordinates using a sub-grid, where functions are evaluated once at every coordinate on the sub-grid and averaged to give a more precise evaluation an analytic function. A Grid2DIterate does not have a specified sub-grid size, but instead iteratively recomputes the analytic function at increasing sub-grid sizes until an input fractional accuracy is reached.

Iteration is performed on a per (y,x) coordinate basis, such that the sub-grid size will adopt low values wherever doing so can meet the fractional accuracy and high values only where it is required to meet the fractional accuracy. For functions where a wide range of sub-grid sizes allow fractional accuracy to be met this ensures the function can be evaluated accurate in a computaionally efficient manner.

This overcomes a limitation of the Grid2D class whereby if a small subset of pixels require high levels of sub-gridding to be evaluated accuracy, the entire grid would require this sub-grid size thus leading to unecessary expensive function evaluations.

Parameters:
  • values (ndarray) – The (y,x) coordinates of the grid.

  • mask (Mask2D) – The 2D mask associated with the grid, defining the pixels each grid coordinate is paired with and originates from.

  • fractional_accuracy (float) – The fractional accuracy the function evaluated must meet to be accepted, where this accuracy is the ratio of the value at a higher sub size to the value computed using the previous sub_size. The fractional accuracy does not depend on the units or magnitude of the function being evaluated.

  • relative_accuracy (Optional[float]) – The relative accuracy the function evaluted must meet to be accepted, where this value is the absolute difference of the values computed using the higher sub size and lower sub size grids. The relative accuracy depends on the units / magnitude of the function being evaluated.

  • sub_steps (Optional[List[int]]) – The sub-size values used to iteratively evaluated the function at high levels of sub-gridding. If None, they are setup as the default values [2, 4, 8, 16].

  • store_native (bool) – If True, the ndarray is stored in its native format [total_y_pixels, total_x_pixels, 2]. This avoids mapping large data arrays to and from the slim / native formats, which can be a computational bottleneck.

Methods

all

array_at_sub_size_from

rtype:

Array2D

astype

rtype:

AbstractNDArray

blurring_grid_from

Setup a blurring-grid from a mask, where a blurring grid consists of all pixels that are masked (and therefore have their values set to (0.0, 0.0)), but are close enough to the unmasked pixels that their values will be convolved into the unmasked those pixels.

blurring_grid_via_kernel_shape_from

Returns the blurring grid from a grid and create it as a Grid2DIterate, via an input 2D kernel shape.

bounding_box

Create a Grid2D (see Grid2D.__new__) from an input bounding box with coordinates [y_min, y_max, x_min, x_max], where the shape_native is used to compute the (y,x) grid values within this bounding box.

copy

distances_to_coordinate_from

Returns the distance of every coordinate on the grid from an input (y,x) coordinate.

extent_with_buffer_from

The extent of the grid in scaled units returned as a list [x_min, x_max, y_min, y_max], where all values are buffed such that their extent is further than the grid's extent..

flip_hdu_for_ds9

from_extent

Create a Grid2D (see Grid2D.__new__) by inputting the extent of the (y,x) grid coordinates as an input (x0, x1, y0, y1) tuple.

from_fits

Create a Grid2D (see Grid2D.__new__) from a mask, where only unmasked pixels are included in the grid (if the grid is represented in its native 2D masked values are (0.0, 0.0)).

from_mask

Create a Grid2DIterate (see Grid2DIterate.__new__) from a mask, where only unmasked pixels are included in the grid (if the grid is represented in 2D masked values are (0.0, 0.0)).

from_yx_1d

Create a Grid2D (see Grid2D.__new__) by inputting the grid coordinates as 1D y and x values.

from_yx_2d

Create a Grid2D (see Grid2D.__new__) by inputting the grid coordinates as 2D y and x values.

grid_2d_radial_projected_from

Determine a projected radial grid of points from a 2D region of coordinates defined by an extent [xmin, xmax, ymin, ymax] and with a (y,x) centre.

grid_2d_radial_projected_shape_slim_from

The function grid_scaled_2d_slim_radial_projected_from() determines a projected radial grid of points from a 2D region of coordinates defined by an extent [xmin, xmax, ymin, ymax] and with a (y,x) centre.

grid_2d_via_deflection_grid_from

Returns a new Grid2DIterate from this grid, where the (y,x) coordinates of this grid have a grid of (y,x) values, termed the deflection grid, subtracted from them to determine the new grid of (y,x) values.

grid_at_sub_size_from

rtype:

Grid2D

grid_with_coordinates_within_distance_removed_from

Remove all coordinates from this Grid2D which are within a certain distance of an input list of coordinates.

instance_flatten

Flatten an instance of an autoarray class into a tuple of its attributes (i.e.

instance_unflatten

Unflatten a tuple of attributes (i.e.

invert

iterated_array_from

Iterate over a function that returns an array of values until the it meets a specified fractional accuracy.

iterated_array_jit_from

Create the iterated array from a result array that is computed at a higher sub size leel than the previous grid.

iterated_grid_from

Iterate over a function that returns a grid of values until the it meets a specified fractional accuracy.

iterated_grid_jit_from

Create the iterated grid from a result grid that is computed at a higher sub size level than the previous grid.

iterated_result_from

Iterate over a function that returns an array or grid of values until the it meets a specified fractional accuracy.

max

min

no_mask

Create a Grid2DIterate (see Grid2DIterate.__new__) by inputting the grid coordinates in 1D, for example:

output_to_fits

Output the grid to a .fits file.

padded_grid_from

When the edge pixels of a mask are unmasked and a convolution is to occur, the signal of edge pixels will be 'missing' if the grid is used to evaluate the signal via an analytic function.

relocated_grid_from

Relocate the coordinates of a grid to the border of this grid if they are outside the border, where the border is defined as all pixels at the edge of the grid's mask (see mask._border_1d_indexes).

relocated_mesh_grid_from

Relocate the coordinates of a pixelization grid to the border of this grid.

reshape

rtype:

AbstractNDArray

return_iterated_array_result

Returns the resulting iterated array, by mapping it to 1D and then passing it back as an Array2D structure.

sqrt

rtype:

AbstractNDArray

squared_distances_to_coordinate_from

Returns the squared distance of every coordinate on the grid from an input coordinate.

structure_2d_from

Convert a result from an ndarray to an aa.Array2D or aa.Grid2D structure, where the conversion depends on type(result) as follows:

structure_2d_list_from

Convert a result from a list of ndarrays to a list of aa.Array2D or aa.Grid2D structure, where the conversion depends on type(result) as follows:

sum

threshold_mask_via_arrays_from

Returns a fractional mask from a result array, where the fractional mask describes whether the evaluated value in the result array is within the Grid2DIterate's specified fractional accuracy.

threshold_mask_via_arrays_jit_from

Jitted function to determine the fractional mask, which is a mask where:

threshold_mask_via_grids_from

Returns a fractional mask from a result array, where the fractional mask describes whether the evaluated value in the result array is within the Grid2DIterate's specified fractional accuracy.

threshold_mask_via_grids_jit_from

Jitted function to determine the fractional mask, which is a mask where:

trimmed_after_convolution_from

rtype:

Structure

uniform

Create a Grid2DIterate (see Grid2DIterate.__new__) as a uniform grid of (y,x) values given an input shape_native and pixel scale of the grid:

values_from

Create a ArrayIrregular object from a 1D NumPy array of values of shape [total_coordinates].

with_new_array

Copy this object but give it a new array.

Attributes

array

binned

Return a Grid2D of the binned-up grid in its 1D representation, which is stored with shape [total_unmasked_pixels, 2].

derive_grid

rtype:

DeriveGrid2D

derive_indexes

rtype:

DeriveIndexes2D

derive_mask

rtype:

DeriveMask2D

dtype

flipped

Return the grid as an ndarray of shape [total_unmasked_pixels, 2] with flipped values such that coordinates are given as (x,y) values.

geometry

hdu_for_output

imag

rtype:

AbstractNDArray

in_radians

Return the grid as an ndarray where all (y,x) values are converted to Radians.

native

Return a Grid2D where the data is stored in its native representation, which has shape [sub_size*total_y_pixels, sub_size*total_x_pixels, 2].

ndim

origin

rtype:

Tuple[int, ...]

pixel_area

pixel_scale

rtype:

float

pixel_scale_header

rtype:

Dict

pixel_scales

rtype:

Tuple[float, ...]

real

rtype:

AbstractNDArray

scaled_maxima

The (y,x) maximum values of the grid in scaled units, buffed such that their extent is further than the grid's extent.

scaled_minima

The (y,x) minimum values of the grid in scaled units, buffed such that their extent is further than the grid's extent.

shape

shape_native

rtype:

Tuple[int, ...]

shape_native_scaled_interior

The (y,x) interior 2D shape of the grid in scaled units, computed from the minimum and maximum y and x values of the grid.

shape_slim

rtype:

int

size

slim

Return a Grid2D where the data is stored its slim representation, which is an ndarray of shape [total_unmasked_pixels * sub_size**2, 2].

sub_border_grid

A property that is only computed once per instance and then replaces itself with an ordinary attribute.

sub_shape_native

rtype:

Tuple[int, ...]

sub_shape_slim

rtype:

int

sub_size

rtype:

int

total_area

total_pixels

rtype:

int

unmasked_grid

rtype:

Union[Grid1D, Grid2D]

classmethod no_mask(values, shape_native, pixel_scales, origin=(0.0, 0.0), fractional_accuracy=0.9999, relative_accuracy=None, sub_steps=None)[source]#

Create a Grid2DIterate (see Grid2DIterate.__new__) by inputting the grid coordinates in 1D, for example:

grid=np.array([[1.0, 1.0], [2.0, 2.0], [3.0, 3.0], [4.0, 4.0]])

grid=[[1.0, 1.0], [2.0, 2.0], [3.0, 3.0], [4.0, 4.0]]

From 1D input the method cannot determine the 2D shape of the grid and its mask, thus the shape_native must be input into this method. The mask is setup as a unmasked Mask2D of shape_native.

Parameters:
  • values (Union[ndarray, List]) – The (y,x) coordinates of the grid input as an ndarray of shape [total_unmasked_pixells*(sub_size**2), 2] or a list of lists.

  • shape_native (Tuple[int, int]) – The 2D shape of the mask the grid is paired with.

  • pixel_scales (Union[Tuple[float], Tuple[float, float], float]) – The (y,x) arcsecond-to-pixel units conversion factor of every pixel. If this is input as a float, it is converted to a (float, float).

  • fractional_accuracy (float) – The fractional accuracy the function evaluated must meet to be accepted, where this accuracy is the ratio of the value at a higher sub size to the value computed using the previous sub_size. The fractional accuracy does not depend on the units or magnitude of the function being evaluated.

  • relative_accuracy (Optional[float]) – The relative accuracy the function evaluted must meet to be accepted, where this value is the absolute difference of the values computed using the higher sub size and lower sub size grids. The relative accuracy depends on the units / magnitude of the function being evaluated.

  • sub_steps ([int] or None) – The sub-size values used to iteratively evaluated the function at high levels of sub-gridding. If None, they are setup as the default values [2, 4, 8, 16].

  • origin (Tuple[float, float]) – The origin of the grid’s mask.

Return type:

Grid2DIterate

classmethod uniform(shape_native, pixel_scales, origin=(0.0, 0.0), fractional_accuracy=0.9999, relative_accuracy=None, sub_steps=None)[source]#

Create a Grid2DIterate (see Grid2DIterate.__new__) as a uniform grid of (y,x) values given an input shape_native and pixel scale of the grid:

Parameters:
  • shape_native (Tuple[int, int]) – The 2D shape of the uniform grid and the mask that it is paired with.

  • pixel_scales (Union[Tuple[float], Tuple[float, float], float]) – The (y,x) arcsecond-to-pixel units conversion factor of every pixel. If this is input as a float, it is converted to a (float, float).

  • fractional_accuracy (float) – The fractional accuracy the function evaluated must meet to be accepted, where this accuracy is the ratio of the value at a higher sub size to the value computed using the previous sub_size. The fractional accuracy does not depend on the units or magnitude of the function being evaluated.

  • relative_accuracy (Optional[float]) – The relative accuracy the function evaluted must meet to be accepted, where this value is the absolute difference of the values computed using the higher sub size and lower sub size grids. The relative accuracy depends on the units / magnitude of the function being evaluated.

  • sub_steps ([int] or None) – The sub-size values used to iteratively evaluated the function at high levels of sub-gridding. If None, they are setup as the default values [2, 4, 8, 16].

  • origin (Tuple[float, float]) – The origin of the grid’s mask.

Return type:

Grid2DIterate

classmethod from_mask(mask, fractional_accuracy=0.9999, relative_accuracy=None, sub_steps=None)[source]#

Create a Grid2DIterate (see Grid2DIterate.__new__) from a mask, where only unmasked pixels are included in the grid (if the grid is represented in 2D masked values are (0.0, 0.0)).

The mask’s pixel_scales and origin properties are used to compute the grid (y,x) coordinates.

Parameters:
  • mask (Mask2D) – The mask whose masked pixels are used to setup the sub-pixel grid.

  • fractional_accuracy (float) – The fractional accuracy the function evaluated must meet to be accepted, where this accuracy is the ratio of the value at a higher sub size to the value computed using the previous sub_size. The fractional accuracy does not depend on the units or magnitude of the function being evaluated.

  • relative_accuracy (Optional[float]) – The relative accuracy the function evaluted must meet to be accepted, where this value is the absolute difference of the values computed using the higher sub size and lower sub size grids. The relative accuracy depends on the units / magnitude of the function being evaluated.

  • sub_steps ([int] or None) – The sub-size values used to iteratively evaluated the function at high levels of sub-gridding. If None, they are setup as the default values [2, 4, 8, 16].

Return type:

Grid2DIterate

classmethod blurring_grid_from(mask, kernel_shape_native, fractional_accuracy=0.9999, relative_accuracy=None, sub_steps=None)[source]#

Setup a blurring-grid from a mask, where a blurring grid consists of all pixels that are masked (and therefore have their values set to (0.0, 0.0)), but are close enough to the unmasked pixels that their values will be convolved into the unmasked those pixels. This when computing images from light profile objects.

See Grid2D.blurring_grid_from for a full description of a blurring grid. This method creates the blurring grid as a Grid2DIterate.

Parameters:
  • mask (Mask2D) – The mask whose masked pixels are used to setup the blurring grid.

  • kernel_shape_native (Tuple[int, int]) – The 2D shape of the kernel which convolves signal from masked pixels to unmasked pixels.

  • fractional_accuracy (float) – The fractional accuracy the function evaluated must meet to be accepted, where this accuracy is the ratio of the value at a higher sub size to the value computed using the previous sub_size. The fractional accuracy does not depend on the units or magnitude of the function being evaluated.

  • relative_accuracy (Optional[float]) – The relative accuracy the function evaluted must meet to be accepted, where this value is the absolute difference of the values computed using the higher sub size and lower sub size grids. The relative accuracy depends on the units / magnitude of the function being evaluated.

  • sub_steps ([int] or None) – The sub-size values used to iteratively evaluated the function at high levels of sub-gridding. If None, they are setup as the default values [2, 4, 8, 16].

Return type:

Grid2DIterate

property slim: Grid2DIterate#

Return a Grid2D where the data is stored its slim representation, which is an ndarray of shape [total_unmasked_pixels * sub_size**2, 2].

If it is already stored in its slim representation it is returned as it is. If not, it is mapped from native to slim and returned as a new Grid2D.

Return type:

Grid2DIterate

property native: Grid2DIterate#

Return a Grid2D where the data is stored in its native representation, which has shape [sub_size*total_y_pixels, sub_size*total_x_pixels, 2].

If it is already stored in its native representation it is return as it is. If not, it is mapped from slim to native and returned as a new Grid2D.

This method is used in the child Grid2D classes to create their native properties.

Return type:

Grid2DIterate

property binned: Grid2DIterate#

Return a Grid2D of the binned-up grid in its 1D representation, which is stored with shape [total_unmasked_pixels, 2].

The binning up process converts a grid from (y,x) values where each value is a coordinate on the sub-grid to (y,x) values where each coordinate is at the centre of its mask (e.g. a grid with a sub_size of 1). This is performed by taking the mean of all (y,x) values in each sub pixel.

If the grid is stored in 1D it is return as is. If it is stored in 2D, it must first be mapped from 2D to 1D.

Return type:

Grid2DIterate

grid_2d_via_deflection_grid_from(deflection_grid)[source]#

Returns a new Grid2DIterate from this grid, where the (y,x) coordinates of this grid have a grid of (y,x) values, termed the deflection grid, subtracted from them to determine the new grid of (y,x) values.

This is used by PyAutoLens to perform grid ray-tracing.

Parameters:

deflection_grid (ndarray) – The grid of (y,x) coordinates which is subtracted from this grid.

Return type:

Grid2DIterate

blurring_grid_via_kernel_shape_from(kernel_shape_native)[source]#

Returns the blurring grid from a grid and create it as a Grid2DIterate, via an input 2D kernel shape.

For a full description of blurring grids, checkout blurring_grid_from.

Parameters:

kernel_shape_native (Tuple[int, int]) – The 2D shape of the kernel which convolves signal from masked pixels to unmasked pixels.

Return type:

Grid2DIterate

padded_grid_from(kernel_shape_native)[source]#

When the edge pixels of a mask are unmasked and a convolution is to occur, the signal of edge pixels will be ‘missing’ if the grid is used to evaluate the signal via an analytic function.

To ensure this signal is included the padded grid is used, which is ‘buffed’ such that it includes all pixels whose signal will be convolved into the unmasked pixels given the 2D kernel shape.

Parameters:

kernel_shape_native (Tuple[int, int]) – The 2D shape of the kernel which convolves signal from masked pixels to unmasked pixels.

Return type:

Grid2DIterate

threshold_mask_via_arrays_from(array_lower_sub_2d, array_higher_sub_2d)[source]#

Returns a fractional mask from a result array, where the fractional mask describes whether the evaluated value in the result array is within the Grid2DIterate’s specified fractional accuracy. The fractional mask thus determines whether a pixel on the grid needs to be reevaluated at a higher level of sub-gridding to meet the specified fractional accuracy. If it must be re-evaluated, the fractional masks’s entry is False.

The fractional mask is computed by comparing the results evaluated at one level of sub-gridding to another at a higher level of sub-griding. Thus, the sub-grid size in chosen on a per-pixel basis until the function is evaluated at the specified fractional accuracy.

Parameters:
  • array_lower_sub_2d (Array2D) – The results computed by a function using a lower sub-grid size

  • array_higher_sub_2d (Array2D) – The results computed by a function using a higher sub-grid size.

Return type:

Mask2D

static threshold_mask_via_arrays_jit_from(fractional_accuracy_threshold, relative_accuracy_threshold, threshold_mask, array_higher_sub_2d, array_lower_sub_2d, array_higher_mask)[source]#

Jitted function to determine the fractional mask, which is a mask where:

  • True entries signify the function has been evaluated in that pixel to desired accuracy and therefore does not need to be iteratively computed at higher levels of sub-gridding.

  • False entries signify the function has not been evaluated in that pixel to desired fractional accuracy and therefore must be iterative computed at higher levels of sub-gridding to meet this accuracy.

Return type:

ndarray

iterated_array_from(func, cls, array_lower_sub_2d)[source]#

Iterate over a function that returns an array of values until the it meets a specified fractional accuracy. The function returns a result on a pixel-grid where evaluating it on more points on a higher resolution sub-grid followed by binning lead to a more precise evaluation of the function. The function is assumed to belong to a class, which is input into tthe method.

The function is first called for a sub-grid size of 1 and a higher resolution grid. The ratio of values give the fractional accuracy of each function evaluation. Pixels which do not meet the fractional accuracy are iteratively revaluated on higher resolution sub-grids. This is repeated until all pixels meet the fractional accuracy or the highest sub-size specified in the sub_steps attribute is computed.

If the function return all zeros, the iteration is terminated early given that all levels of sub-gridding will return zeros. This occurs when a function is missing optional objects that contribute to the calculation.

An example use case of this function is when a “image_2d_from” methods in PyAutoGalaxy’s LightProfile module is comomputed, which by evaluating the function on a higher resolution sub-grids sample the analytic light profile at more points and thus more precisely.

Parameters:
  • func (func) – The function which is iterated over to compute a more precise evaluation.

  • cls (cls) – The class the function belongs to.

  • grid_lower_sub_2d – The results computed by the function using a lower sub-grid size

Return type:

Array2D

return_iterated_array_result(iterated_array)[source]#

Returns the resulting iterated array, by mapping it to 1D and then passing it back as an Array2D structure.

Parameters:

iterated_array (Array2D) –

Returns:

The resulting array computed via iteration.

Return type:

iterated_array

static iterated_array_jit_from(iterated_array, threshold_mask_higher_sub, threshold_mask_lower_sub, array_higher_sub_2d)[source]#

Create the iterated array from a result array that is computed at a higher sub size leel than the previous grid.

The iterated array is only updated for pixels where the fractional accuracy is met.

Return type:

ndarray

threshold_mask_via_grids_from(grid_lower_sub_2d, grid_higher_sub_2d)[source]#

Returns a fractional mask from a result array, where the fractional mask describes whether the evaluated value in the result array is within the Grid2DIterate’s specified fractional accuracy. The fractional mask thus determines whether a pixel on the grid needs to be reevaluated at a higher level of sub-gridding to meet the specified fractional accuracy. If it must be re-evaluated, the fractional masks’s entry is False.

The fractional mask is computed by comparing the results evaluated at one level of sub-gridding to another at a higher level of sub-griding. Thus, the sub-grid size in chosen on a per-pixel basis until the function is evaluated at the specified fractional accuracy.

Parameters:
  • grid_lower_sub_2d (Grid2D) – The results computed by a function using a lower sub-grid size

  • grid_higher_sub_2d (grids.Array2D) – The results computed by a function using a higher sub-grid size.

Return type:

Mask2D

static threshold_mask_via_grids_jit_from(fractional_accuracy_threshold, relative_accuracy_threshold, threshold_mask, grid_higher_sub_2d, grid_lower_sub_2d, grid_higher_mask)[source]#

Jitted function to determine the fractional mask, which is a mask where:

  • True entries signify the function has been evaluated in that pixel to desired fractional accuracy and therefore does not need to be iteratively computed at higher levels of sub-gridding.

  • False entries signify the function has not been evaluated in that pixel to desired fractional accuracy and therefore must be iterative computed at higher levels of sub-gridding to meet this accuracy.

Return type:

ndarray

iterated_grid_from(func, cls, grid_lower_sub_2d)[source]#

Iterate over a function that returns a grid of values until the it meets a specified fractional accuracy. The function returns a result on a pixel-grid where evaluating it on more points on a higher resolution sub-grid followed by binning lead to a more precise evaluation of the function. For the fractional accuracy of the grid to be met, both the y and x values must meet it.

The function is first called for a sub-grid size of 1 and a higher resolution grid. The ratio of values give the fractional accuracy of each function evaluation. Pixels which do not meet the fractional accuracy are iteratively revaulated on higher resolution sub-grids. This is repeated until all pixels meet the fractional accuracy or the highest sub-size specified in the sub_steps attribute is computed.

If the function return all zeros, the iteration is terminated early given that all levels of sub-gridding will return zeros. This occurs when a function is missing optional objects that contribute to the calculation.

An example use case of this function is when a “deflections_yx_2d_from” methods in PyAutoLens’s MassProfile module is computed, which by evaluating the function on a higher resolution sub-grid samples the analytic mass profile at more points and thus more precisely.

Parameters:
  • func (Callable) – The function which is iterated over to compute a more precise evaluation.

  • cls (object) – The class the function belongs to.

  • grid_lower_sub_2d (Grid2D) – The results computed by the function using a lower sub-grid size

Return type:

Grid2D

static iterated_grid_jit_from(iterated_grid, threshold_mask_higher_sub, threshold_mask_lower_sub, grid_higher_sub_2d)[source]#

Create the iterated grid from a result grid that is computed at a higher sub size level than the previous grid.

The iterated grid is only updated for pixels where the fractional accuracy is met in both the (y,x) coodinates.

Return type:

Grid2D

iterated_result_from(func, cls)[source]#

Iterate over a function that returns an array or grid of values until the it meets a specified fractional accuracy. The function returns a result on a pixel-grid where evaluating it on more points on a higher resolution sub-grid followed by binning lead to a more precise evaluation of the function.

A full description of the iteration method can be found in the functions iterated_array_from and iterated_grid_from. This function computes the result on a grid with a sub-size of 1, and uses its shape to call the correct function.

Parameters:
  • func (Callable) – The function which is iterated over to compute a more precise evaluation.

  • cls (object) – The class the function belongs to.

Return type:

Union[Array2D, Grid2D]