Repository navigation
CLOE JAX likelihood, harmonic 3×2pt forecast and GLASS 3×2pt mocks - #502
Draft
cailmdaley wants to merge 4 commits into
Draft
cailmdaley wants to merge 4 commits into
cailmdaley wants to merge 4 commits into
Conversation
sp_validation.cloe vendors the CLOE JAX theory from euclid-spt-6x2pt at 2fc432e3 (theory/, byte-identical, cloelib_patches its separable layer), reads harmonic SACC data vectors with their bandpower windows (vector.py), runs them through cloerun as an external probe (probe.py), and builds the UNIONS v2 x LSx 3x2pt forecast from a survey recipe: masks, spectra, coupled-bandpower iNKA and super-sample covariance, a noiseless SACC, Fisher and chains (survey.py, covariance.py, forecast.py, workflow/cloe/). sacc_io gains lens tracers and add_cl. The image gains the cloe extra and the pinned CosmoPower-JAX networks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JK7o9FiKmtK4WCS6BGAKwu
Lognormal matter shells 0.01 wide in z, mixed linearly into lens density and source convergence (lensing + NLA), Poisson lenses and noisy E-mode shear, measured with the forecast's coupled-bandpower estimator and written as the forecast SACC with the mock's bands. The shell spectra are rescaled from cold to total matter, n(z) regridded with Akima as the theory does, and the lognormal spectra clipped where not positive definite; the mock's expectation is what the clipped fields realise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JK7o9FiKmtK4WCS6BGAKwu
…s by model Vector.from_sacc and cut read only the harmonic E-mode types, so a pseudo-C_ell SACC with BB/EB (or real-space statistics) gives the vector of its E modes. The GLASS 3x2pt mock's lens fields carry magnification (5s - 2) kappa and its NLA term the (1 + z) power about the pivot, as the theory does; the SSC tracers carry the same NLA, and its docstring says why magnification stays out of that term. The mock refuses an n(z) above its top shell. reads() drops magnification slopes without magnification and log T_AGN off the feedback engine, and the forecast's spectra filter the input point through it. Unchanged for unions_v2_lsx (5s - 2 = 0, eta_IA = 0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JK7o9FiKmtK4WCS6BGAKwu
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JK7o9FiKmtK4WCS6BGAKwu
This branch has not been deployed
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.
CLOE JAX likelihood, harmonic 3×2pt forecast and GLASS 3×2pt mocks
This PR adds
sp_validation.cloe, a differentiable likelihood for any SACC of harmonic spectra (shear, galaxy–shear, galaxy clustering), and runs the UNIONS v2 × LSx 3×2pt forecast and its GLASS mocks through it.The theory is CLOE's (cloelib's background, NLA, Limber, CosmoPower-JAX HMcode-2020 with baryonic feedback), traced by JAX, so it is jit-, vmap- and grad-able; a 3×2pt chain takes 7 minutes on 64 cores.
runs the whole forecast in 30 minutes on 64 cores, from
config/cloe/unions_v2_lsx.yaml(the survey recipe: v2.0.0 n(z),survey_tomo.json, footprint, LSx lens bins, priors, scale cuts): masks, theory spectra, coupled-bandpower covariance (Gaussian iNKA + super-sample), a noiseless SACC, Fisher widths, GLASS mocks and nautilus chains through cloerun.Each rule is one step of
python -m sp_validation.cloe.forecastorpython -m sp_validation.mocks.glass_3x2pt, so every step also runs by hand.What is new
cloe/vector.py: data vectors as linear maps of C_ℓ.Vector.from_saccreads a SACC's E-mode spectra (shear EE, galaxy–shear, galaxy clustering) with their bandpower windows, covariance and n(z), ignoring B modes and real-space points;cutapplies scale cuts (shear ℓ range, linear-bias cut k_max h χ(⟨z⟩) on lens bins, lens–source pairs). The ξ±, γt, w and COSEBIs operators are here too, but no SACC reader uses them yet.cloe/probe.py: the likelihood of a SACC as a cloerun external probe, checking the SACC's blind stamp.cloe/survey.py,covariance.py,forecast.py: the forecast pipeline.mocks/glass_3x2pt.py: GLASS mocks of the same survey, measured with the same estimator and written as SACCs.sacc_iogains lens tracers (lens_<i>), thegalaxy_density_clandgalaxy_shearDensity_cl_etypes andadd_cl;add_pseudo_clis unchanged in behaviour.[cloe]extra (jax 0.12.1, cloelib 0.11, cosmopower-jax, interpax 0.3.16, nautilus, cloerun atcailmdaley/cloerun@56ac7bc6);uv.lockonly adds packages. The image fetches the four CosmoPower-JAX networks by sha256 from the emulator repository's commit 61144e21 (python -m sp_validation.cloe.networks), because the sigma8 network on itsmainhas changed.Vendored theory
src/sp_validation/cloe/theory/holds six files copied byte for byte fromlikelihood/euclid_spt_like/ofcailmdaley/euclid-spt-6x2ptat commit 2fc432e3:cloe.py,cloe_jax.py,cloelib_patches.py,jax_hmcode.py,jax_vector.py,vector.py.Every commit touching them there is by Cail Daley (four, co-authored by Claude Opus); the JAX adapter came into that repository from the Euclid cmbx pipeline with its numerics unchanged.
Only theory is vendored: no Euclid or SPT data or configuration.
Ruff skips the directory so that a diff against the source stays empty.
cloelib_patches.pyis a separate layer: six patches (P1, P3–P6, P8), each a mixin on one cloelib class that makes the Limber sum fast and traceable under JAX, written against cloelib 0.11 alone.Each is meant to go upstream into CLOE; once cloelib carries one, its layer is deleted here, and over time this module disappears.
Relation to what sp_validation has
pseudo_cldecouples spin-2 × spin-2 bandpowers per pair through NaMaster workspaces. The forecast instead uses coupled pseudo-C_ℓ over the mean mask product, whose window and covariance follow in closed form from the mask couplings for all 45 spectra of mixed spin; both estimators carry the same information. NaMaster still computes every coupling matrix.mocks/glass.pyis the shear-only Paper II mock (σ8-normalised Planck18, 200 Mpc shells). Narrow lens bins need shells 0.01 wide in z and every tracer as a linear mix of shells, so the 3×2pt mock calls GLASS directly; it uses the sameglass.ext.camb.matter_clsand that module'sCosmology_from_camb.blinding.pyand the CosmoSIS templates are not changed. Blinding on this theory is the next step.Validation
All numbers below come from that Snakemake run on fir, in the sp_validation image
ddd58fe0with the[cloe]extra installed into a sandbox; the same steps run by hand give identical chains.Theory against CosmoSIS (the UNIONS template's modules: CAMB
mead2020_feedback, NLA, kmax 20), at the input point and 30 points across the prior, as band shifts in σ of the forecast's Gaussian + SSC covariance:The largest shear shift is at ℓ < 30, where CosmoSIS omits the spin-2 prefactor; the galaxy autos above 0.1σ are at ℓ > 200, beyond the linear-bias cut.
Forecast (noiseless vector, shear 300 < ℓ < 1600, 31 sampled parameters; reference: the forecast's own chains made outside sp_validation with the same inputs):
Two seeds of the reference differ by 0.0003 in σ(S8), so the two codes agree within sampler noise.
sp_validation averages the release's nside-4096 footprint onto nside 1024, where the reference upgraded an nside-512 map; that lowers every band error by about 0.5%.
GLASS 3×2pt mocks (lognormal shells, Poisson lenses, shape noise, the forecast's masks and estimator): ten seeds have a mean χ² of 317 for the 315 kept bands against the model and its Gaussian + SSC covariance (range 271–355), and their mean sits on the model within its error in every family.
A chain on seed 1 gives S8 = 0.847 ± 0.021 and Ωm = 0.290 ± 0.034 for an input of 0.839 and 0.319.
The mock's own expectation departs from the model by up to 0.2σ in the lowest lens-auto bands, where the model's Limber approximation meets the mock's exact projection.
Not in this PR
No data vector was measured or read and no blind was drawn.
The lens n(z) shapes, the split of lenses between bins and the lens mask are estimates (marked in the recipe), since the LSx files are only on nibi.
— Claude Opus on behalf of Cail
🤖 Generated with Claude Code
https://claude.ai/code/session_01JK7o9FiKmtK4WCS6BGAKwu