Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cs_util/cosmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,9 @@ def get_theo_c_ell(
omch2_adj = camb_kwargs["omch2"] - pars.omeganu * (pars.H0 / 100) ** 2
pars.set_cosmology(omch2=omch2_adj)

# Set up lensing source window
pars.min_l = ell.min()
# Set up lensing source window. CAMB's min_l is the scalar-C_ell floor
# (1 or 2 only), so leave it at its default; ell below ell.min() are
# computed and discarded by the interpolation.
pars.set_for_lmax(ell.max())

pars.SourceWindows = [
Expand Down
7 changes: 7 additions & 0 deletions cs_util/tests/test_cosmology.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,13 @@ def test_camb_backend_tomo(self, fast_ell_array, fast_two_bins_data):
except ImportError:
pytest.skip("CAMB not available")

def test_camb_backend_ell_range_independent(self, fast_redshift_data):
"""CAMB C_ell at a given ell does not depend on the requested ell range."""
z, nz = fast_redshift_data
cl_wide = cosmology.get_theo_c_ell(np.array([10, 100, 1000]), z, nz, backend="camb")
cl_high = cosmology.get_theo_c_ell(np.array([100, 1000]), z, nz, backend="camb")
npt.assert_allclose(cl_high["W1xW1"], cl_wide["W1xW1"][1:], rtol=1e-6)

def test_invalid_backend(self, fast_ell_array, fast_redshift_data):
"""Test error with invalid backend."""
z, nz = fast_redshift_data
Expand Down
16 changes: 7 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ dependencies = [
"numpy>=1.26.4",
"matplotlib>=3.8.4",
"swig>=4.2.1",
# Cap scipy < 1.18: scipy 1.18 ported FITPACK from Fortran to C, changing
# RectBivariateSpline(scalar, scalar, grid=False) from a 0-d array to a
# shape-(1,) array. camb's BBN Y_He predictor then fails set_cosmology with
# "only 0-dimensional arrays can be converted to Python scalars", breaking
# every get_cosmo path (and pyccl's Boltzmann spline path likewise). camb
# 1.6.6 is unfixed; lift the cap when camb ships the scipy-1.18 fix. Mirrors
# the same cap in sp_validation.
"scipy>=1.13.0,<1.18",
# scipy 1.18.0 alone returns a shape-(1,) array from
# RectBivariateSpline(scalar, scalar, grid=False), which breaks the BBN Y_He
# predictor of camb < 2.0; scipy 1.18.1 restores the 0-d result.
"scipy>=1.13.0,!=1.18.0",
"vos>=3.6.1",
"keyring>=25.2.0",
"pyccl>=3.0.2",
# pyccl 3.3.5 is the first release whose boltzmann_camb path runs on camb 2
# (LSSTDESC/CCL#1303); pyccl declares no camb dependency, so the floor lives here.
"pyccl>=3.3.5",
"camb>=1.5.9",
"healpy>=1.16.0",
"healsparse>=1.8.0",
Expand Down
Loading