Skip to content

fix: los_halos simulators drop the silent placeholder coefficients - #681

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/los-sampler-colossus-mass-function
Nov 19, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/los-sampler-colossus-mass-function

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Part of PyAutoLabs/PyAutoLens#867. Merge after the PyAutoLens PR (PyAutoLabs/PyAutoLens#868).

What

scripts/imaging/features/advanced/los_halos/simulator.py and simulator_jax.py caught ImportError and fell back to placeholder coefficients: [-1.9, 8.0] for the mass function and [-3.0, 40.0] for the concentration relation. The hmf import path itself was broken, so the fallback ran every time, with no message in simulator_jax.py. Compared with the real fits, the placeholders under-count halos by up to 20% at z = 0.9, and the concentration placeholder is off by up to 56%.

  • Both simulators now let LOSSampler compute the Sheth-Tormen and Ludlow+16 coefficients with colossus (cosmology_name_colossus="planck15").
  • In simulator_jax.py, the batched-realisation loop fits the coefficients once with colossus and reuses them for every seed.
  • The docstrings say colossus is required (pip install colossus or autolens[los]). If it is missing, the run stops with the library's message. There is no silent fallback.
  • Notebooks are not edited. They are regenerated from the scripts at release.

Evidence (with the library branch, PYAUTO_TEST_MODE=2)

  • simulator.py: runs end to end with real coefficients.
  • simulator_jax.py: runs end to end, including the batch of 8 images.
  • simulator.py with colossus blocked stops with:
    ImportError: The line-of-sight halo sampler (autolens.lens.los) computes the Sheth-Tormen halo mass function ... with the optional dependency colossus, which is not installed. Install it with pip install colossus(orpip install autolens[los]) ...
  • Targeted smoke: no curated smoke script references the change, so the import check scripts/imaging/modeling.py ran: PASS.
  • Independent review: CLEAN (see the library PR).

🤖 Generated with Claude Code

Jammy2211 and others added 2 commits November 19, 2026 19:01
…yAutoLens#867)

The simulators caught ImportError and fell back to [-1.9, 8.0] / [-3.0, 40.0],
which under-count halos by up to 20% at z = 0.9; because the hmf import path
was itself broken, the fallback ran every time. LOSSampler now computes the
Sheth-Tormen and Ludlow+16 coefficients with colossus and stops with a clear
message when colossus is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (PyAutoLens#867)

The batched-realisation loop still passed the removed placeholder variables
(NameError). The coefficients are now fitted once with colossus and reused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Decision taken (decide-and-flag): the plan on PyAutoLens#867 said the simulators would stop passing coefficients and let LOSSampler compute them. simulator.py and the single-image part of simulator_jax.py do that. The batched-realisation loop in simulator_jax.py builds one LOSSampler per seed, so it now fits the colossus coefficients once with mass_function_ab_from / mass_concentration_ab_from and passes them to every sampler, instead of refitting them 8 times. They are the real colossus values, not placeholders. Alternative: drop the explicit arrays and let each sampler refit.

@Jammy2211 Jammy2211 added the decision-taken Autonomous run took a flagged decision label Nov 19, 2026
@Jammy2211
Jammy2211 merged commit e1bd4c7 into main Nov 19, 2026
8 checks passed
@Jammy2211
Jammy2211 deleted the feature/los-sampler-colossus-mass-function branch November 19, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

decision-taken Autonomous run took a flagged decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant