Repository navigation
fix: LOSSampler mass function from colossus, drop hmf - #868
Merged
Merged
Conversation
mass_function_ab_from imported `hmf.fitting_functions`, which moved in hmf 3.7, and hmf was never a declared dependency, so LOSSampler with no precomputed coefficients raised ModuleNotFoundError. The Sheth-Tormen mass function is now computed with colossus (model='sheth99'), which the sampler already used for the Ludlow+16 concentration relation. - colossus becomes the `los` optional extra (in `optional`, which CI installs) - a missing colossus raises an ImportError naming it and how to install it - `cosmology_astropy` is deprecated and ignored, with a DeprecationWarning Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #867
What
LOSSamplerwith no precomputed coefficients raisedModuleNotFoundError: No module named 'hmf'.hmfwas never a declared dependency, andhmf.fitting_functionsmoved in hmf 3.7. The Sheth-Tormen mass function is now computed with colossus (massFunction,model='sheth99'). The sampler already used colossus for the Ludlow+16 concentration relation.mass_function_ab_fromfits colossussheth99on the same mass grid as before. It gains acosmology_nameargument (default"planck15").cosmology_astropyis still accepted inmass_function_ab_fromandLOSSampler, but it is ignored and raises aDeprecationWarning. Existing calls keep working.ImportErrorthat names colossus and gives the install command.pyproject.tomlhas a newlos = ["colossus"]extra. It is included inoptional, which CI installs, so the new tests run in CI rather than being skipped.Workspace PR (merge after this one): see the linked autolens_workspace PR.
Evidence
Witness (no hmf installed, colossus installed;
LOSSampler(z_lens=0.5, z_source=1.0, seed=1), no coefficients passed, test mode off):The new unit test
test__los_sampler__default_coefficients_match_sheth_tormen_referenceasserts the same limits.pytest -n 4 test_autolens/lens/test_los.pygives 9 passed. Three tests are new: the Witness, the clear message when colossus is missing, and thecosmology_astropydeprecation warning.pyauto-heart smoke --targetedran the import checkautolens_workspace/scripts/imaging/modeling.py: PASS.M2dndM(ratio 1.000), against a hand-built Sheth-Tormen calculation from colossussigma(R)(ratio 0.99999997), and against the formula of the old hmf SMT model.API change
This is a backward-compatible signature change: one keyword added, one keyword deprecated. No public name is added or removed. No other library depends on
autolens.lens.los.Follow-ups (not in this PR)
autolens_workspace_developer/los/simulator.pyhas the same silent placeholder fallback. That repo was not claimed for this task.heart/config/colab_gate.yamlhas anhmfentry forlos.py. It is stale now thatlos.pyno longer imports hmf.🤖 Generated with Claude Code