Skip to content

Exclude only scipy 1.18.0, require pyccl>=3.3.5, fix the camb-backend C_ℓ at ℓ_min - #93

Merged
cailmdaley merged 4 commits into
developfrom
fix/lift-scipy-cap-camb2
Sep 28, 2026
Merged

cailmdaley merged 4 commits into
developfrom
fix/lift-scipy-cap-camb2

Conversation

@cailmdaley

@cailmdaley cailmdaley commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #94.

What

  • pyproject.toml: scipy>=1.13.0,!=1.18.0 (the <1.18 cap is gone) and pyccl>=3.3.5; camb>=1.5.9 is unchanged. pyccl ≤3.3.4 fails its boltzmann_camb path under camb 2 (camb-2 breaks CCL LSSTDESC/CCL#1303), and get_cosmo uses that path. pyccl declares no camb dependency, so nothing else stops that pairing.
  • cosmo.get_theo_c_ell(backend="camb") no longer sets pars.min_l = ell.min(). CAMB's min_l is the scalar-C_ell floor and only accepts 1 or 2. On camb 1.6.6 that line underestimated C_ell at ell.min() by about 7.5%. On camb 2.0 any ell.min() > 10 fails with "You need to normalize realistically to use lensing", because the lensing sanity check reads C_φφ at L=10. New test: C_ell at a given ell doesn't depend on the requested ell range.

Why
scipy 1.18.0 made RectBivariateSpline(scalar, scalar, grid=False) return shape (1,), and camb <2.0's BBN Y_He predictor then broke set_cosmology. That also broke pyccl's boltzmann_camb, which calls that predictor. scipy 1.18.1 returns a 0-d array again, and camb 2.0 copes with either, so the only pairing that ever broke is scipy 1.18.0 with camb <2.0. Excluding that one scipy release is enough. camb 1.x and 2.x both work, and applications choose through their locks. This unblocks sp_validation's lock: its shear_psf_leakage dependency could not coexist with the <1.18 cap.

Test (sp_validation image; scipy 1.18.1, camb 2.0.4, pyccl 3.3.6): 74 passed. Before the change (scipy 1.17.1, camb 1.6.6, pyccl 3.3.4): 73 passed. The new test fails on camb 2.0.4 without the min_l fix. Everything also passes on camb 1.6.6 with the fix. CCL-path drift from camb 1.6.6 to 2.0.4: P(k) ≤2e-5, ξ± ≤1.3e-6, σ8 unchanged. camb-backend C_ell ≤7e-4.

A trap for camb-backend users: pyccl 3.3.6 sets the process-global camb.config.AccuracyTarget to 0 whenever it runs CAMB (camb 2.x's default is 1). Direct CAMB calls made after that (the camb backend, _ccl_to_camb) change with it: σ8 at fixed As moves by 7.6e-5.

Merge before the sp_validation lock refresh (to follow).

— Claude (Opus) on behalf of Cail

🤖 Generated with Claude Code

https://claude.ai/code/session_01LsAQRxNg6yDsUX4y2SWxTJ

cailmdaley and others added 2 commits September 28, 2026 12:51
camb 2.0 makes its BBN Y_He predictor return a scalar, so set_cosmology
works under scipy 1.18.0 (whose RectBivariateSpline returned shape (1,)
for scalar input). With that floor the scipy cap has no reason to exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LsAQRxNg6yDsUX4y2SWxTJ
get_theo_c_ell set pars.min_l = ell.min(), but CAMB's min_l is the
scalar-C_ell floor and only takes 1 or 2. With camb 1.6.6 this
underestimated C_ell at ell.min() by ~7.5%; with camb 2.0 any
ell.min() > 10 raises 'You need to normalize realistically to use
lensing' (the lensing sanity check reads C_phi at L=10). Add a test that
C_ell at a given ell does not depend on the requested ell range.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LsAQRxNg6yDsUX4y2SWxTJ
cailmdaley and others added 2 commits September 28, 2026 15:31
…amb 2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The breakage needed scipy 1.18.0 together with camb < 2.0; scipy 1.18.1
restores the 0-d spline result, so excluding the one scipy release is enough.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cailmdaley cailmdaley changed the title Lift the scipy<1.18 cap; require camb>=2.0 Exclude only scipy 1.18.0, require pyccl>=3.3.5, fix the camb-backend C_ℓ at ℓ_min Sep 28, 2026
@cailmdaley

Copy link
Copy Markdown
Collaborator Author

LGTM

@cailmdaley
cailmdaley merged commit e14cd68 into develop Sep 28, 2026
5 checks passed
@cailmdaley
cailmdaley deleted the fix/lift-scipy-cap-camb2 branch September 28, 2026 14:25
cailmdaley added a commit to CosmoStat/sp_validation that referenced this pull request Sep 30, 2026
* Lift the scipy cap; require camb>=2.0

camb 2.0 makes its BBN Y_He predictor return a scalar, so set_cosmology
works under scipy 1.18.0 (whose RectBivariateSpline returned shape (1,)
for scalar input) and the scipy cap has no reason to exist.

camb 2.0 moves the glass-mock CAMB fingerprint beyond the test's 1e-6
tolerance (As +1.4e-4, P(k) up to 2.9e-4 relative), so regenerate that
reference under camb 2.0.4. The test now pins camb.config.AccuracyTarget
to CAMB's default: pyccl's CAMB path sets that process-global to 0, which
made the reference test depend on whether a pyccl test ran first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LsAQRxNg6yDsUX4y2SWxTJ

* Require pyccl>=3.3.5 (boltzmann_camb on camb 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* uv.lock: camb 2.0.4, scipy 1.18.1, pyccl 3.3.6, cs_util/shear_psf_leakage develop heads

cs_util develop@e14cd686 (CosmoStat/cs_util#93) and shear_psf_leakage
develop@649edf4a (CosmoStat/shear_psf_leakage#45) lift their scipy caps and
admit camb 2; shear_psf_leakage no longer pulls gsl or stats.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LsAQRxNg6yDsUX4y2SWxTJ

* test_glass_mock: widen the tolerance instead of pinning AccuracyTarget

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Relock on the merged pyproject: camb 2.0.4, shear_psf_leakage develop tip

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W4pb4vZJimNoYkWqQCqEwR

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_theo_c_ell(backend="camb"): C_ℓ at ℓ_min is wrong (min_l set to ell.min())

1 participant