feat(cosmo): consolidate sp_validation cosmology theory-curve machinery into cs_util.cosmo#76
Open
cailmdaley wants to merge 1 commit into
Open
feat(cosmo): consolidate sp_validation cosmology theory-curve machinery into cs_util.cosmo#76cailmdaley wants to merge 1 commit into
cailmdaley wants to merge 1 commit into
Conversation
…ry into cs_util.cosmo Move the cosmology theory-curve machinery from sp_validation.cosmology into cs_util.cosmo so cs_util is the single home for the collaboration's cosmology primitives (per a conversation with M. Kilbinger). Additive: no existing cs_util.cosmo symbol changes, so shear_psf_leakage (get_cosmo_default, xipm_theo) is unaffected. Adds: - PLANCK18 fiducial-cosmology dict - get_cosmo: flexible Planck18-default cosmology builder (individual, CCL, CAMB, or CosmoCov parameter formats) - get_theo_c_ell, c_ell_to_xi, get_theo_xi: angular power spectra and shear correlation functions, CCL and CAMB backends - _ccl_to_camb / _camb_to_ccl / _cosmocov_to_ccl parameter converters - tests/test_cosmology.py, ported from sp_validation Caps scipy < 1.18 (mirroring sp_validation): scipy 1.18's FITPACK-to-C port changed a RectBivariateSpline return shape that breaks camb's BBN Y_He predictor in set_cosmology (and pyccl's Boltzmann spline path likewise). With the cap the full cosmo suite passes for real on py3.10 AND py3.12 (numpy 2.5): 31/31. This also removes the numpy>=2.5 xfail on test_xipm_theo -- a stopgap for the same root cause (#70/#71) -- which now passes. Bumps version 0.2.1 -> 0.2.2. No new dependency (camb, pyccl already required). Part of #75; the sp_validation delete + repoint follows in a companion PR. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013NCc4BHtZ4Lx6n9zuUwEeP
173f3b0 to
fa0b8a0
Compare
cailmdaley
added a commit
to CosmoStat/sp_validation
that referenced
this pull request
Jul 3, 2026
…module Companion to CosmoStat/cs_util#76, which brings sp_validation's cosmology theory-curve machinery into cs_util.cosmo (the single home for the collaboration's cosmology primitives, per a conversation with Martin). Deletes src/sp_validation/cosmology.py and repoints every consumer to cs_util.cosmo: - package: b_modes.py, cosmo_val/core.py, cosmo_val/pseudo_cl.py - scripts: papers/bmodes/scripts/precompute_pure_eb_chunk.py, scratch/guerrini/namaster_utils.py - docs/comments: workflow/common.py, papers/bmodes/config/covariance.md Drops "cosmology" from sp_validation.__all__ and removes the now-duplicated tests/test_cosmology.py (moved to cs_util alongside the code). No call sites change -- the functions are byte-identical, only their home moved. Temporarily sources cs_util from #76's branch so this PR validates before #76 merges; restore "cs_util>=0.2.2" once #76 merges and 0.2.2 ships to PyPI. Part of CosmoStat/cs_util#75. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013NCc4BHtZ4Lx6n9zuUwEeP
cailmdaley
added a commit
to CosmoStat/sp_validation
that referenced
this pull request
Jul 3, 2026
cs_util releases are infrequent while the two repos iterate together, so sp_validation tracks cs_util's develop branch directly as a git dependency rather than a version pin. Replaces the temporary pointer at #76's feature branch (which would break when that branch is deleted on merge). This PR's cosmology repoint goes green once CosmoStat/cs_util#76 merges into develop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013NCc4BHtZ4Lx6n9zuUwEeP
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #75 (PR 1 of 2 — the cs_util side).
Moves the cosmology theory-curve machinery from
sp_validation.cosmologyintocs_util.cosmo, so cs_util is the single home for the collaboration's cosmology primitives (per a conversation with Martin).What moves in
PLANCK18fiducial-cosmology dictget_cosmo— flexible Planck18-default cosmology builder (individual / CCL / CAMB / CosmoCov parameter formats)get_theo_c_ell,c_ell_to_xi,get_theo_xi— angular power spectra and shear correlation functions (CCL and CAMB backends)_ccl_to_camb/_camb_to_ccl/_cosmocov_to_cclconverterstests/test_cosmology.py, ported from sp_validationAdditive — nothing existing changes
get_cosmo_default, thesigma_critfamily, andxipm_theoare untouched (the diff is a header update plus one appended block), soshear_psf_leakage(which importsget_cosmo_default+xipm_theo) is unaffected. No new dependency — cs_util already requirescambandpyccl.Real py3.12 support via a scipy cap
scipy 1.18 ported FITPACK to C, changing a
RectBivariateSplinereturn shape that breaks camb's BBNY_Hepredictor inset_cosmology— and pyccl's Boltzmann spline path — withTypeError: only 0-dimensional arrays can be converted to Python scalars. This capsscipy<1.18(mirroring sp_validation), so the full cosmo suite passes for real on py3.10 and py3.12 (numpy 2.5): 31/31, no xfails. That also lets us drop the numpy≥2.5 xfail ontest_xipm_theo(a stopgap for the same root cause, #70/#71), which now passes. Lift the cap when camb ships the fix — cmbant/CAMB#202 (workaround committed for camb's next release).get_theo_xiproduces the expected cosmic-shear ξ± (ξ+ ~1.5e-4 at 1′ → ~7e-7 at 200′).Bumps version
0.2.1 → 0.2.2. The companion sp_validation PR (delete + repoint) follows.— Claude on behalf of Cail