autoarray.inversion.regularization.ConstantSplit#

class ConstantSplit[source]#

Bases: Constant

Regularization which uses the derivatives at a cross of four points around each pixel centre and a single value to smooth an inversion’s solution.

The size of this cross is determined via the size of the source-pixel, for example if the source pixel is a Delaunay pixel the area of the pixel is computed and the distance of each point of the cross is given by the area times 0.5.

For this regularization scheme, there is only 1 regularization coefficient that is applied to all neighboring pixels. This means that the matrix B only needs to regularize pixels in one direction (e.g. pixel 0 regularizes pixel 1, but NOT visa versa). For example:

B = [-1, 1] [0->1]

[0, -1] 1 does not regularization with 0

Note that for this scheme the indexes of entries in the regularization matrix are not the source pixel indexes but the indexes of each source pixel index cross.

A small numerical value of 1.0e-8 is added to all elements in constant regularization matrix, to ensure that it is positive definite.

A full description of regularization and this matrix can be found in the parent AbstractRegularization class.

JAX & gradient support (2026-07 gradient sweep): differentiable and FD-certified on the Delaunay mesh family (e.g. the KNN meshes), whose interpolators supply pure-xp split mappings. Structurally incompatible with the rectangular meshes, whose interpolator reuses its per-query 4-corner mappings for the split path (shape error) — use Constant or Adapt there.

Parameters:

coefficient (float) – The regularization coefficient which controls the degree of smooth of the inversion reconstruction.

Methods

log_det_regularization_matrix_term_from

Returns log det H of this scheme's regularization matrix computed from a factorization the scheme itself knows about, or None when no such shortcut exists (the default).

regularization_matrix_from

Returns the regularization matrix with shape [pixels, pixels].

regularization_term_from

Returns this scheme's contribution to the regularization term s^T H s computed from a factorization the scheme itself knows about, or None when no such shortcut exists (the default).

regularization_weights_from

Returns the regularization weights of this regularization scheme.

Attributes

is_split_regularization

Whether this scheme is a "split" regularization variant, which regularizes using a split-cross calculation of the mesh's mappings rather than the mappings themselves.

is_split_regularization = True#

Whether this scheme is a “split” regularization variant, which regularizes using a split-cross calculation of the mesh’s mappings rather than the mappings themselves.

Split schemes require the mesh’s interpolator to provide _mappings_sizes_weights_split, which only the adaptive meshes (e.g. Delaunay, DelaunayNN, KNNBarycentric) do. Pixelization uses this flag together with AbstractMesh.supports_split_regularization to reject unsupported combinations at construction.

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

Returns the regularization matrix with shape [pixels, pixels].

Parameters:

linear_obj (LinearObj) – The linear object (e.g. a Mapper) which uses this matrix to perform regularization.

Return type:

The regularization matrix.