Skip to content

refactor(cosmology): move cosmology into cs_util.cosmo; delete local module#223

Merged
cailmdaley merged 4 commits into
developfrom
refactor/cosmology-to-cs_util
Jul 6, 2026
Merged

refactor(cosmology): move cosmology into cs_util.cosmo; delete local module#223
cailmdaley merged 4 commits into
developfrom
refactor/cosmology-to-cs_util

Conversation

@cailmdaley

@cailmdaley cailmdaley commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Companion to CosmoStat/cs_util#76 and part of CosmoStat/cs_util#75 — the two-PR consolidation of the collaboration's cosmology into cs_util.cosmo (the library home), per a conversation with Martin.

What this does

Deletes src/sp_validation/cosmology.py (its theory-curve machinery now lives in cs_util.cosmo via #76) and repoints every consumer:

Consumer import now
b_modes.py from cs_util.cosmo import get_theo_xi
cosmo_val/core.py from cs_util.cosmo import get_cosmo
cosmo_val/pseudo_cl.py from cs_util.cosmo import get_theo_c_ell
papers/bmodes/scripts/precompute_pure_eb_chunk.py from cs_util.cosmo import get_theo_xi
scratch/guerrini/namaster_utils.py from cs_util.cosmo import get_cosmo, get_theo_c_ell

Also drops "cosmology" from sp_validation.__all__, updates two doc/comment references, and removes the now-duplicated tests/test_cosmology.py (moved to cs_util). No call sites change — the functions are byte-identical, only their home moved.

Dependency

sp_validation now tracks cs_util's develop branch directly (git dependency) rather than a PyPI pin — cs_util releases are infrequent while the two repos iterate together:

cs_util @ git+https://github.com/CosmoStat/cs_util.git@develop

This repoint needs the new cosmology functions, which land via #76, so this goes green once #76 merges into cs_util develop — merge order is simply #76 → this. No release step, no version retarget.

Locally: all changed files compile, the repoint targets resolve in cs_util.cosmo, and no references to the old module remain.

— Claude on behalf of Cail

…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 and others added 3 commits July 4, 2026 01:13
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
workflow/rules/covariance.smk imported sp_validation.cosmology.PLANCK18
inside the cosmology_params rule's embedded python — a runtime break
once cosmology.py is deleted. Repoint it and the two comment/docstring
references (generate_cosmocov_ini.py, papers/bmodes config) to
cs_util.cosmo.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ExsQmDDttuhMxSZ6BWmMr9
@cailmdaley cailmdaley requested a review from sachaguer July 6, 2026 08:58

@sachaguer sachaguer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@cailmdaley cailmdaley merged commit 713b742 into develop Jul 6, 2026
3 checks passed
@cailmdaley cailmdaley deleted the refactor/cosmology-to-cs_util branch July 6, 2026 09:13
cailmdaley added a commit that referenced this pull request Jul 11, 2026
…o sp_validation/cosmology.py

`develop` deliberately deleted src/sp_validation/cosmology.py (#223), moving
cosmology to cs_util.cosmo; this branch must not resurrect it. Per the UNIONS
layering — cs_util is the cosmology *library* (generic machinery), sp_validation
holds *configuration* and *survey-specific implementations* — the blinding
theory surface belongs in the blinding namespace, not a local cosmology module.

Rename cosmology.py → blinding_theory.py. TheoryConfig (configuration) and the
three master-layout backends in blinding.py (coarse/fine ξ±, pseudo-Cℓ —
survey-specific) are correctly homed here. The generic pieces — the CCL-native
ξ± path (xi_ccl/cl_ee), the independent CAMB P(k)→Pk2D path (xi_camb), the
σ8/A_s rescale (camb_As_for_sigma8) — live here FOR NOW with an explicit
module-docstring note that they are cosmology-library code destined for
cs_util.cosmo. Module-scope imports stay numpy-only (dataclasses + numpy).

Updated all importers: blinding.py, test_blinding.py, and
test_camb_ccl_crosscheck.py (module ref + alias). No sp_validation/cosmology.py
anywhere. Affected tests (blinding + CAMB↔CCL cross-check) green with
cosmo_numba: 30 passed, 0 skipped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KpaRHk3QwN13myduQ3hJyf
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.

2 participants