Skip to content

feat: SimulatorImaging.via_tracer_from auto-default xp from parent use_jax - #539

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/simulator-imaging-use-jax
May 24, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/simulator-imaging-use-jax

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Companion PR to the PyAutoArray PR adding use_jax=True to aa.SimulatorImaging. Changes the via_tracer_from override to default xp=None and fall back to self._xp (inherited from the parent).

After both PRs merge:

simulator = al.SimulatorImaging(exposure_time=300.0, psf=psf, use_jax=True)
dataset = simulator.via_tracer_from(tracer=tracer, grid=grid)  # JAX-backed

API Changes

  • Changed signature: al.SimulatorImaging.via_tracer_from(tracer, grid, xp=None) — xp now defaults to None, meaning "fall back to self._xp" (inherited from the parent aa.SimulatorImaging). Explicit xp= still honoured.

See full details below.

Test Plan

  • PyAutoLens 317/317 tests pass.
  • Eager cross-xp parity (via the autolens_workspace_test parity script bundled with the workspace_test follow-up).
Full API Changes

Changed signature

  • al.SimulatorImaging.via_tracer_from(tracer, grid, xp=None) — was xp=np. New behaviour: xp=None falls back to self._xp from the parent (jnp if use_jax=True, np otherwise).

Migration

  • No breaking changes. Existing callers passing xp=np or no xp= continue to work.

Depends on

  • Jammy2211/PyAutoArray PR adding use_jax to aa.SimulatorImaging (this PR's self._xp reference comes from the parent class). Merge PyAutoArray PR first.

🤖 Generated with Claude Code

…se_jax

Changes via_tracer_from(xp=np) to via_tracer_from(xp=None) with auto-fallback
to self._xp inherited from aa.SimulatorImaging. When the simulator is
constructed with use_jax=True, via_tracer_from now routes xp=jnp through
tracer.padded_image_2d_from and via_image_from without the user passing it
explicitly.

Depends on Jammy2211/PyAutoArray PR adding the use_jax constructor flag +
_xp property to the parent aa.SimulatorImaging.

Part of Phase 2 PR 2 of z_features/jax_user_intro.md.

Issue: PyAutoArray#334

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label May 24, 2026
@Jammy2211
Jammy2211 merged commit 0ef58b7 into main May 24, 2026
4 of 6 checks passed
@Jammy2211
Jammy2211 deleted the feature/simulator-imaging-use-jax branch May 24, 2026 15:40
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant