Skip to content

Adaptive pixelisations (Delaunay, KNNBarycentric) crash in FitImaging; ConstantSplit broken on RectangularUniform #332

Description

@rhayes777

Title: Adaptive pixelisations (Delaunay, KNNBarycentric) crash in FitImaging; ConstantSplit regularization broken on RectangularUniform

Repo: Jammy2211/PyAutoArray

Tag: @Jammy2211


While auditing the released 2026.5.21.1 libraries against the documented public
API, I found two related defects in the inversion path. Both are reproducible with
the snippets below in a fresh uv venv (uv pip install autolens, Python 3.12.8).

1. Delaunay and KNNBarycentric raise AttributeError inside FitImaging

import numpy as np
import autolens as al

psf = al.Convolver.from_gaussian(shape_native=(11, 11), sigma=0.1,
                                 pixel_scales=0.05, normalize=True)
grid = al.Grid2D.uniform(shape_native=(50, 50), pixel_scales=0.05, over_sample_size=2)
tracer_true = al.Tracer(galaxies=[
    al.Galaxy(redshift=0.5,
              mass=al.mp.Isothermal(centre=(0, 0), ell_comps=(0.1, 0.0),
                                    einstein_radius=1.2)),
    al.Galaxy(redshift=1.0,
              bulge=al.lp.Sersic(centre=(0.05, 0), intensity=0.3,
                                 effective_radius=0.1, sersic_index=2)),
])
sim = al.SimulatorImaging(exposure_time=300, background_sky_level=0.1, psf=psf,
                          add_poisson_noise_to_data=True, noise_seed=1)
dataset = sim.via_tracer_from(tracer=tracer_true, grid=grid)
mask = al.Mask2D.circular(shape_native=dataset.shape_native,
                          pixel_scales=dataset.pixel_scales, radius=2.0)
dataset = dataset.apply_mask(mask=mask)

lens = al.Galaxy(redshift=0.5,
                 mass=al.mp.Isothermal(centre=(0, 0), ell_comps=(0.1, 0),
                                       einstein_radius=1.2))
pix  = al.Pixelization(
    mesh=al.mesh.Delaunay(pixels=100),                # or KNNBarycentric(pixels=100)
    regularization=al.reg.Constant(coefficient=1.0),
)
source = al.Galaxy(redshift=1.0, pixelization=pix)
tracer = al.Tracer(galaxies=[lens, source])

fit = al.FitImaging(dataset=dataset, tracer=tracer)
fit.log_evidence    # AttributeError
File "autoarray/inversion/mesh/border_relocator.py", line 446, in relocated_mesh_grid_from
    grid.array[self.border_slim], xp=xp
AttributeError: 'NoneType' object has no attribute 'array'

The Optional[BorderRelocator] guard at mesh/abstract.py:90 is in place, but the
grid argument passed into BorderRelocator.relocated_mesh_grid_from() is
None, so the failure happens one level deeper at
border_relocator.py:446 (grid.array[self.border_slim]).

Effect: in the released wheel Delaunay and KNNBarycentric are unusable in
FitImaging. RectangularUniform works fine.

2. ConstantSplit regularization is broken on RectangularUniform

Same simulation as above, but swap the regularization:

pix = al.Pixelization(
    mesh=al.mesh.RectangularUniform(shape=(15, 15)),
    regularization=al.reg.ConstantSplit(coefficient=1.0),
)
AttributeError: 'InterpolatorRectangularUniform' object has no attribute
'_mappings_sizes_weights_split'

Constant works on the same mesh; only the Split variant is broken.

Environment

  • autolens / autogalaxy / autoarray / autofit / autoconf == 2026.5.21.1
  • Python 3.12.8, macOS arm64, fresh uv venv.

What I tried next

  • Read the upstream Jammy2211/PyAutoArray:autoarray/inversion/mesh/mesh/abstract.py
    on main; the if border_relocator is not None guard is identical to the
    installed file. The issue is that callers in autogalaxy / autolens now invoke
    the new mesh API (without the old image_mesh= kwarg) without setting up a
    source_plane_data_grid, leaving it None.

  • The new Delaunay(pixels=N) / KNNBarycentric(pixels=N) constructors no
    longer take an explicit image-plane mesh. If that's intentional, the wiring
    to set up the data grid / border relocator probably needs to move inside the
    mesh classes themselves.

Happy to dig further if useful. Full reproducer scripts live at
work/edge_case_tests/06_inversion.py in the audit workspace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions