-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG fix and add test for high-z halofit (#932)
* TST add test for high-z halofit * figure out why it passes * TST redo test as ratio at high-z * TST try again to make it fail * try larger range for roots * see what is going on * see if it fails * ENH try again * try again * grr * do not fail for a bit * try this * try this * try this * try this * try this * try this * try this * try this * clean it up * full ci now * full ci now * TST test a bigger range of values * Update pyccl/tests/test_halofit_highz.py * DOC added changelog entry * TST add test at very low sigma9 * BUG expand range for root
- Loading branch information
Showing
4 changed files
with
52 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
# Unreleased | ||
|
||
## Python library | ||
- Fixed high-z halofit behavior (#932) | ||
|
||
# v2.3.0 Changes | ||
|
||
## Python library | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import numpy as np | ||
import pyccl as ccl | ||
import pytest | ||
|
||
COSMO = ccl.Cosmology( | ||
Omega_c=0.27, Omega_b=0.045, h=0.67, sigma8=0.8, n_s=0.96, | ||
transfer_function='bbks', matter_power_spectrum='halofit') | ||
|
||
COSMO_LOWS8 = ccl.Cosmology( | ||
Omega_c=0.27, Omega_b=0.045, h=0.67, sigma8=0.1, n_s=0.96, | ||
transfer_function='bbks', matter_power_spectrum='halofit') | ||
|
||
|
||
@pytest.mark.parametrize("cosmo", [COSMO, COSMO_LOWS8]) | ||
def test_halofit_highz(cosmo): | ||
vals = [(25, 75)] + list(zip(range(0, 98), range(1, 99))) | ||
for zl, zh in vals: | ||
al = 1.0/(1 + zl) | ||
ah = 1.0/(1 + zh) | ||
|
||
k = np.logspace(0, 2, 10) | ||
pkratl = ( | ||
ccl.nonlin_matter_power(cosmo, k, al) | ||
/ ccl.linear_matter_power(cosmo, k, al) | ||
) | ||
pkrath = ( | ||
ccl.nonlin_matter_power(cosmo, k, ah) | ||
/ ccl.linear_matter_power(cosmo, k, ah) | ||
) | ||
|
||
assert np.all(pkratl >= pkrath), (zl, zh, pkratl, pkrath) |
This file contains 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