Skip to content

feat: simulate_substructure end-to-end jittable simulator#544

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/simulate-substructure-e2e
May 27, 2026
Merged

feat: simulate_substructure end-to-end jittable simulator#544
Jammy2211 merged 1 commit into
mainfrom
feature/simulate-substructure-e2e

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

  • Adds simulate_substructure to autolens/lens/substructure_util.py — a pure jnp function that chains scan-based multi-plane ray-tracing (prompt 2), source light evaluation, FFT PSF convolution, and Poisson noise via jax.random.PRNGKey
  • Supports prng_key=None to skip noise for deterministic comparisons
  • The complete theta -> noisy_image pipeline compiles under jax.jit

API

from autolens.lens.substructure_util import simulate_substructure

image = simulate_substructure(
    grid, image_shape, halo_params, halo_mask, scaling_matrix,
    macro_deflections_fn, macro_plane_mask, sheet_kappas,
    source_image_fn, psf_kernel, exposure_time, background_sky_level,
    prng_key=jax.random.PRNGKey(42),
    halo_profile_cls=ag.mp.NFWTruncatedSph,
)

Test plan

  • Pre-convolution lensed image matches existing Tracer path (atol=1e-4)
  • jax.jit(simulate_substructure) compiles and matches eager result
  • Poisson noise produces different, non-NaN image vs clean
  • Different PRNGKeys produce different noise realizations
  • Companion PR: autolens_workspace_test#128

Ref: PyAutoLens#542 (prompt 3 of 4)

🤖 Generated with Claude Code

Adds simulate_substructure to substructure_util.py — a pure jnp
function chaining scan-based ray-tracing, source light evaluation,
FFT PSF convolution, and Poisson noise via jax.random.PRNGKey.
Supports prng_key=None to skip noise for deterministic comparison.

Ref: PyAutoLens#542 prompt 3 of 4.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit f982dd0 into main May 27, 2026
6 checks passed
@Jammy2211 Jammy2211 deleted the feature/simulate-substructure-e2e branch May 27, 2026 11:15
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