Skip to content

fix: resolve the Delaunay zeroed edge ring against the mapper's grid, not pixels - #527

Merged
Jammy2211 merged 1 commit into
mainfrom
claude/delaunay-edge-ring-zeroed-8l4u1z
Sep 5, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
claude/delaunay-edge-ring-zeroed-8l4u1z

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Closes #526.

Delaunay(pixels, zeroed_pixels) inflated self.pixels by zeroed_pixels and derived the zeroed edge-ring indices from that inflated count, while AbstractInversion.zeroed_ids_to_keep offset each mapper's block by mesh.pixels. Every autolens_workspace feature script and the Euclid pipeline pass the appended grid length as pixels, so mesh.pixels overstated the mapper's real parameter count by the ring size. For one mapper the error cancelled (the ring was still zeroed, which is why nothing ever failed); with two or more pixelized mappers the first mapper's ring stayed live and interior vertices were zeroed instead. The same inflated pixels plus the index-array zeroed_pixels property also broke the to_dict round-trip (a Delaunay fit reloaded from tracer.json crashed).

The ring is now a property of the grid the mapper is actually built from: always its last zeroed_pixels vertices, resolved through mapper.params, whatever pixels says. Both call forms in the wild zero the same vertices, and every mapper's ring lands in the right place.

API Changes

  • Delaunay.pixels is now the count the caller passed (the interior vertices), no longer inflated by zeroed_pixels; Delaunay.total_pixels gives the sum.
  • Delaunay.zeroed_pixels is now the plain int count (it was a derived index array); the indices come from the new Delaunay.zeroed_pixels_from(pixels).
  • New AbstractMesh.zeroed_pixels_from(pixels) (returns a mesh's own zeroed_pixels index array, or nothing) and Mapper.zeroed_pixels (the mesh's ring resolved against mapper.params).
  • zeroed_ids_to_keep sizes blocks by mapper.params and reads mapper.zeroed_pixels.
  • A Delaunay mesh round-trips through to_dict/from_dict with integer pixels and zeroed_pixels.

No downstream reader of mesh.pixels or the Delaunay zeroed_pixels array exists in PyAutoGalaxy or PyAutoLens; the only consumer was zeroed_ids_to_keep.

Test Plan

  • test_autoarray/inversion/pixelization/mesh/test_delaunay.py — counts stored as passed, zeroed_pixels_from under both call forms, subclasses, the rectangular family, the dict round-trip, Mapper.zeroed_pixels.
  • test_autoarray/inversion/inversion/test_abstract.pyzeroed_ids_to_keep with one Delaunay mapper (both forms, with and without linear light profiles ahead of the block) and with two mappers (the regression: the first ring used to land five indices too low).
  • test_delaunay_nn.py assertion updated to the new counts.
  • Full suite: 1369 passed, 62 skipped (Python 3.12, numba installed).
  • CI matrix (3.12 + 3.13).
Full API Changes (for automation & release notes)

Changed

  • autoarray.mesh.Delaunay.__init__(pixels, zeroed_pixels=0, areas_factor=0.5)self.pixels = int(pixels) (was int(pixels) + zeroed_pixels); self.zeroed_pixels = int(zeroed_pixels or 0) (was a property returning np.arange(pixels - n, pixels)). Applies to DelaunayNN, KNearestNeighbor, KNNBarycentric.
  • AbstractInversion.zeroed_ids_to_keep — block sizes from mapper.params, local ids from mapper.zeroed_pixels.

Added

  • Delaunay.total_pixelspixels + zeroed_pixels.
  • Delaunay.zeroed_pixels_from(pixels)np.arange(pixels - zeroed_pixels, pixels).
  • AbstractMesh.zeroed_pixels_from(pixels) — the mesh's zeroed_pixels index array, or an empty array.
  • Mapper.zeroed_pixelsself.mesh.zeroed_pixels_from(pixels=self.params).

Migration

  • Before: mesh.zeroed_pixels (index array); mesh.pixels (total including ring).
  • After: mapper.zeroed_pixels or mesh.zeroed_pixels_from(grid_length) for indices; mesh.zeroed_pixels is the count; mesh.total_pixels for the total.
  • Call sites passing the appended grid length as pixels keep working; the documented form is pixels=<interior count> (workspace and Euclid PRs follow).

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XCQK1pjQx7YH5e9dtWrX76


Generated by Claude Code

… not `pixels` (#526)

`Delaunay(pixels, zeroed_pixels)` inflated `self.pixels` by `zeroed_pixels`
and derived the zeroed ring from that count, while `zeroed_ids_to_keep`
offset each mapper's block by `mesh.pixels`. A caller passing the appended
grid length as `pixels` (every workspace feature script and the Euclid
pipeline) therefore overstated the block by the ring size: for one mapper the
error cancelled, for two or more the first mapper's ring stayed live and
interior vertices were zeroed instead. The inflated `pixels` plus the
index-array `zeroed_pixels` property also broke the `to_dict` round-trip.

- `Delaunay.__init__` stores `pixels` and `zeroed_pixels` as the ints passed
  (so the mesh round-trips through `to_dict`); `total_pixels` adds the ring
  back on; `zeroed_pixels_from(pixels)` returns the last `zeroed_pixels`
  indices of a grid of that length.
- `AbstractMesh.zeroed_pixels_from(pixels)` returns a mesh's own index array
  (the rectangular family) or nothing.
- `Mapper.zeroed_pixels` resolves the mesh's ring against `params`, the real
  parameter count.
- `zeroed_ids_to_keep` uses `mapper.params` and `mapper.zeroed_pixels`, so
  the ring is the appended edge points whatever `pixels` says, for every
  mapper.

Tests: mesh semantics, the dict round-trip and both call forms
(`test_delaunay.py`); `zeroed_ids_to_keep` with one and two Delaunay mappers
(`test_abstract.py`); the DelaunayNN assertion updated to the new counts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XCQK1pjQx7YH5e9dtWrX76
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Sep 5, 2026 — with Claude
@Jammy2211
Jammy2211 merged commit a0e5c61 into main Sep 5, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the claude/delaunay-edge-ring-zeroed-8l4u1z branch September 5, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: resolve the Delaunay zeroed edge ring against the mapper's grid, not pixels

2 participants