Skip to content

Commit a409055

Browse files
Jammy2211Jammy2211claude
authored
Short-circuit set_snr_of_snr_light_profiles when no SNR profiles present (#471)
Previously the method always ray-traced the full grid before looking for LightProfileSNR instances, which is wasted work for simulators that use only regular light profiles (e.g. the cluster simulator, which uses SersicSph and SersicCore and ray-traced a 1000x1000 grid through 5 dPIE profiles + an NFW halo for nothing). Scan the tracer's light profiles up-front; if none are LightProfileSNR, return before any ray-tracing. Co-authored-by: Jammy2211 <JNightingale2211@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6c3951d commit a409055

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

autolens/lens/tracer.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,15 @@ def set_snr_of_snr_light_profiles(
12061206
The psf of the simulated imaging which can change the S/N of the light profile due to spreading out
12071207
the emission.
12081208
"""
1209+
has_snr_profile = any(
1210+
isinstance(light_profile, LightProfileSNR)
1211+
for galaxies in self.planes
1212+
for galaxy in galaxies
1213+
for light_profile in galaxy.cls_list_from(cls=ag.LightProfile)
1214+
)
1215+
if not has_snr_profile:
1216+
return
1217+
12091218
grid = aa.Grid2D.uniform(
12101219
shape_native=grid.shape_native,
12111220
pixel_scales=grid.pixel_scales,

0 commit comments

Comments
 (0)