Skip to content

Commit d4cd012

Browse files
Jammy2211claude
authored andcommitted
fix: register Galaxy redshift as no_flatten aux in register_tracer_classes
Plane bookkeeping (Tracer.plane_index_via_redshift_from, reached by any jitted PointSolver.solve(..., plane_redshift=...) on a multi-plane tracer) compares redshifts to derive a static plane index, which is impossible when redshift enters the trace as a leaf. Mirrors the cosmology no_flatten registration; found fixing autolens_workspace cluster/simulator.py's per-source plane_redshift solve (#678 phase D). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DnTmLoJjJgMTze5uAbg1Jd
1 parent d838ca5 commit d4cd012

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

autolens/jax/registration.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,21 @@ def register_tracer_classes(tracer) -> bool:
4242
return False
4343

4444
from autoarray.abstract_ndarray import register_instance_pytree
45+
from autogalaxy.galaxy.galaxy import Galaxy
4546
from autolens.lens.tracer import Tracer
4647

4748
register_instance_pytree(Tracer, no_flatten=("cosmology",))
4849

50+
# ``redshift`` rides as aux data, like the cosmology: plane bookkeeping
51+
# (``Tracer.plane_index_via_redshift_from``, reached by any jitted
52+
# ``PointSolver.solve(..., plane_redshift=...)`` on a multi-plane tracer)
53+
# compares redshifts to derive a static plane index, which is impossible
54+
# if the redshift enters the trace as a leaf. On this hand-built /
55+
# simulator path redshifts are per-fit constants; the model-fit path uses
56+
# ``autofit.jax.register_model``, whose classifier already keeps declared
57+
# redshifts constant.
58+
register_instance_pytree(Galaxy, no_flatten=("redshift",))
59+
4960
for galaxy in tracer.galaxies:
5061
_register_object_classes(galaxy)
5162

0 commit comments

Comments
 (0)