Skip to content

Commit db7fdc9

Browse files
authored
Merge pull request #540 from PyAutoLabs/feature/simulator-interferometer-use-jax
feat: SimulatorInterferometer.via_tracer_from auto-default xp from parent use_jax
2 parents 0ef58b7 + e4e70cc commit db7fdc9

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

autolens/interferometer/simulator.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
class SimulatorInterferometer(aa.SimulatorInterferometer):
24-
def via_tracer_from(self, tracer, grid):
24+
def via_tracer_from(self, tracer, grid, xp=None):
2525
"""
2626
Returns a realistic simulated image by applying effects to a plain simulated image.
2727
@@ -42,11 +42,14 @@ def via_tracer_from(self, tracer, grid):
4242
A seed for random noise_maps generation
4343
"""
4444

45-
image = tracer.image_2d_from(grid=grid)
45+
if xp is None:
46+
xp = self._xp
4647

47-
return self.via_image_from(image=image)
48+
image = tracer.image_2d_from(grid=grid, xp=xp)
49+
50+
return self.via_image_from(image=image, xp=xp)
4851

49-
def via_galaxies_from(self, galaxies, grid):
52+
def via_galaxies_from(self, galaxies, grid, xp=None):
5053
"""Simulate imaging data for this data, as follows:
5154
5255
1) Setup the image-plane grid of the Imaging arrays, which defines the coordinates used for the ray-tracing.
@@ -64,7 +67,7 @@ def via_galaxies_from(self, galaxies, grid):
6467

6568
tracer = Tracer(galaxies=galaxies)
6669

67-
return self.via_tracer_from(tracer=tracer, grid=grid)
70+
return self.via_tracer_from(tracer=tracer, grid=grid, xp=xp)
6871

6972
def via_deflections_and_galaxies_from(
7073
self, deflections: aa.VectorYX2D, galaxies: List[ag.Galaxy]

0 commit comments

Comments
 (0)