Skip to content

Commit 538ccab

Browse files
Jammy2211claude
authored andcommitted
feat: SimulatorImaging.via_tracer_from auto-defaults xp from parent use_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>
1 parent a90f888 commit 538ccab

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

autolens/imaging/simulator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
class SimulatorImaging(aa.SimulatorImaging):
2424

25-
def via_tracer_from(self, tracer : Tracer, grid : aa.type.Grid2DLike, xp=np) -> aa.Imaging:
25+
def via_tracer_from(self, tracer : Tracer, grid : aa.type.Grid2DLike, xp=None) -> aa.Imaging:
2626
"""
2727
Simulate an `Imaging` dataset from an input `Tracer` object and a 2D grid of (y,x) coordinates.
2828
@@ -50,6 +50,9 @@ def via_tracer_from(self, tracer : Tracer, grid : aa.type.Grid2DLike, xp=np) ->
5050
in order to generate the image of the galaxies via their light profiles.
5151
"""
5252

53+
if xp is None:
54+
xp = self._xp
55+
5356
tracer.set_snr_of_snr_light_profiles(
5457
grid=grid,
5558
exposure_time=self.exposure_time,

0 commit comments

Comments
 (0)