Use hmf's Yung24 fitting function directly in HMF test#740
Use hmf's Yung24 fitting function directly in HMF test#740steven-murray wants to merge 3 commits into
Conversation
hmf v3.6.2 added the Yung+24 mass function fit, so the hand-copied polynomial coefficients and formula in test_new_hmf_matches_reference can be replaced with a direct call to hmf's own Yung24 class, avoiding duplicated fit parameters. Bumps the hmf dependency accordingly. Fixes #710 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR refactors the YUNG24 branch of the HMF reference test to use hmf’s built-in Yung24 fitting function instead of a hand-maintained polynomial implementation, and bumps the hmf dependency to the first version that provides that fitter. Sequence diagram for using hmf Yung24 fitter in HMF testsequenceDiagram
participant Test as test_new_hmf_matches_reference
participant HMF as hmf
participant Y24 as Yung24
Test->>HMF: mass_function.fitting_functions.Yung24
activate HMF
HMF->>Y24: __call__(mass, redshift, cosmology)
activate Y24
Y24-->>HMF: halo_mass_function
deactivate Y24
HMF-->>Test: reference_hmf
deactivate HMF
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
hmf>=3.6.2requirement is duplicated in two separate lists insetup.py; consider defining it once (e.g., a variable or shared requirement list) to avoid divergence if it needs to be updated again.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `hmf>=3.6.2` requirement is duplicated in two separate lists in `setup.py`; consider defining it once (e.g., a variable or shared requirement list) to avoid divergence if it needs to be updated again.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Addresses Sourcery review feedback on PR #740. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Addressed the duplicated 🤖 Addressed by Claude Code |
|
|
Re the Codecov "JUnit XML file not found" warning: this is a downstream symptom, not something introduced by this PR. The "Run Unit Tests" CI step is failing, which causes "Run Integration Tests" (where I compared the failing tests on this branch against the tip of 🤖 Addressed by Claude Code |
jordanflitter
left a comment
There was a problem hiding this comment.
Thanks @steven-murray, I made a minor comment.
The tests are failing because of astropy v8. I fixed that in #737 by modifying line 288 in classy_interfrace.py, see https://github.com/21cmfast/21cmFAST/pull/737/changes#diff-010c965001daef1fe0c45b5b8e24e3c87b2c1168c638a8846c97948d9a0e9765.
Also, shouldn't this branch be rebased on top of release-v4.3? I think it should.
I approved it anyways :)
Both fits are now available directly via hmf's MassFunction (matched transfer function, growth model, and cosmology), so the separate PS-growth-calibration codepath for YUNG24 is no longer needed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Summary
YUNG24_PHYSICAL_PARAMSdict and inlined polynomial formula intest_new_hmf_matches_referencewith a direct call tohmf.mass_function.fitting_functions.Yung24, matching the approach already used for REED07.hmfdependency to>=3.6.2insetup.py, since that's the first version with the Yung24 fit.Fixes #710
Test plan
pytest tests/test_cfuncs.py -k test_new_hmf_matches_referencepasses for bothREED07andYUNG24branches (EH/BBKSpower spectra).pytest tests/test_cfuncs.pypasses (84 passed, 4 pre-existing xfails).ruff check/pre-commit hooks pass.🤖 Generated with Claude Code
Summary by Sourcery
Replace hand-coded Yung24 halo mass function implementation in tests with direct use of hmf's Yung24 fitting function and bump the hmf dependency version accordingly.
Enhancements:
Build: