CCL
CCL copied to clipboard
Emulator support for CCL
Update: This now relies on CCLObject
(PR934), so leaving it as draft until PR934 is reviewed. In particular, it makes use of the caching framework implemented there.
I have built some infrastructure for CCL to work with emulators, be it power spectrum emulators, or halo model emulators. This loads the emulator to memory only once (per thread) given a current config. It should be straightforward to use.
I have added 2 examples: baccoemu
for the linear, non-linear, and baryons-non-linear matter power spectrum (which can be loaded and used directly from Cosmology
using its own emulated transfer function: ccl.CosmologyVanillaLCDM(transfer_function='bacco')
and a halo mass function emulator (Bocquet20
), which can be directly accessed just like every other mass function in the halo model.
The base infrastructure lives in pyccl.emulator
with some additional definitions (for power spectra) in pyccl.pk2d
.
Branch Dependency Visualization
Pull Request Test Coverage Report for Build 1717838142
- 388 of 389 (99.74%) changed or added relevant lines in 7 files are covered.
- 3 unchanged lines in 1 file lost coverage.
- Overall coverage increased (+0.4%) to 97.276%
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
---|---|---|---|
pyccl/emulator.py | 153 | 154 | 99.35% |
<!-- | Total: | 388 | 389 |
Files with Coverage Reduction | New Missed Lines | % |
---|---|---|
pyccl/halos/concentration.py | 3 | 99.06% |
<!-- | Total: | 3 |
Totals | |
---|---|
Change from base Build 1532031833: | 0.4% |
Covered Lines: | 4786 |
Relevant Lines: | 4920 |
💛 - Coveralls
@nikfilippas I'd like to decouple this from the v3 PR, as this requires a more involved discussion among others in CCL, but the v3 branch is a lot more urgent (since it's blocking the addition of new science as per our plan). Can you do that?
No problem, I'll decouple it once we get to the v3 branch review. Note, this merely provides a framework for emulators to work, i.e. if a user wants they can use our code instead of having to build an external adapter module to link the emulator they want to use with CCL. The two I am testing here are only examples, and I'm happy to remove them (also for licensing reasons) and only leave the framework.