Skip to content

Firecrown likelihood for the tomographic ξ± layout + CAMB↔CCL cross-check#250

Closed
cailmdaley wants to merge 2 commits into
feat/sacc-2-sacc-iofrom
feat/sacc-5-firecrown-likelihood
Closed

Firecrown likelihood for the tomographic ξ± layout + CAMB↔CCL cross-check#250
cailmdaley wants to merge 2 commits into
feat/sacc-2-sacc-iofrom
feat/sacc-5-firecrown-likelihood

Conversation

@cailmdaley

Copy link
Copy Markdown
Collaborator

Closes #248. PR 5 of the PRD #241 series (row 5 of §7); stacked on #245 (sacc_io).

What

A minimal firecrown Gaussian ξ± likelihood (sp_validation.blinding_likelihood) — the theory engine PR 6's Smokescreen will call — plus a CAMB↔CCL cross-check test validating that the two theory stacks agree on our binning. No blinding wiring in this PR (that's PR 6).

Why

Smokescreen shifts the data by t(hidden) − t(fiducial), computed through firecrown + CCL, while inference runs CosmoSIS + CAMB. The shift only means what we intend if the stacks agree at fixed cosmology (PRD #241 §5). The likelihood is the only code that knows the data vector's exact layout (bin pairs, θ grid), so its compute_theory_vector is how theory gets aligned element-wise with the data.

How it works

  • Consumes the analysis SACC ({version}.sacc), extracting the coarse ξ± subset (past COSEBIs/pseudo-Cℓ/ρ/τ) with its aligned covariance — required, since firecrown models every point it reads and Smokescreen enforces sacc.mean == likelihood data vector.
  • Generic over N tomographic bins (today's single-bin data = n=1); theory vectors realign to SACC insertion order via each statistic's sacc_indices, independent of statistic listing order.
  • TheoryConfig is the single config surface: fiducial cosmology + model choices, defaults mirroring the CosmoSIS v1.4.6.3 _A_cell fiducial — S8=0.80, Ωm=0.30 (converted to CCL-native σ8/Ωc with the neutrino density correctly subtracted), Ωb=0.0469, h=0.70, nₛ=0.96, mν=0.06 eV, HMCode2020+feedback (logT_AGN=7.5) via CAMB, NLA wired but off by default (the shift nearly cancels IA; flipping to the inference stack's A=1.0 is one config value), normal-hierarchy neutrinos. The PRD's open fiducial choice changes config values, not code.
  • Fine-grid ξ± shift is out of scope here — PR 6 computes it as a direct CCL theory difference.

Validated

19 tests. Likelihood: construction from a sacc_io file, theory-vector shape/determinism/SACC-alignment (order-independence pinned against a genuinely reversed statistic order), 2-bin N-generality, config fail-fast. Cross-check: firecrown+CCL vs an independent CAMB-P(k)→CCL path agree to 0.21% (ξ+) / 0.10% (ξ−) at fiducial and 0.25%/0.12% at a blind-sized offset (tolerances 0.5%/1.0%). The σ8-vs-A_s convention is settled inside the test — CAMB's A_s is iterated to share CCL's σ8 (a nominal A_s leaves σ8 ~3% off, which would blow the comparison to ~9–10%; the reconciliation is load-bearing and tested). The cross-check validates P(k)-recipe + amplitude consistency, not CCL's Limber+Hankel independently (both paths use it; documented in the module).

An independent adversarial review before opening drove the full attack list empirically and found no correctness bugs (verdict: open as-is). Highlights: the Ωm↔(σ8, Ωc, Ων) conversion verified to 5 decimals through firecrown's own CCLFactory path; Smokescreen 1.5.6's actual loader driven end-to-endConcealDataVector construction, _verify_sacc_consistency, concealing-factor calculation and application all succeed against this module, with the applied shift exactly matching the theory difference; extract-covariance alignment stress-tested on a 3-pair file with non-contiguous insertion order. One review note for PR 6: Smokescreen's loader never passes theory_config overrides — the module's defaults ARE the fiducial in the blinding path (overrides are reachable only from direct callers), and Smokescreen's shifts_dict values replace parameters rather than add (its documented-vs-actual gotcha).

Fast tests run in the default suite (~8 s); CCL/CAMB theory tests are slow with a fast smoke variant. Full fast suite green up to the two known pre-existing environmental failures (candide data paths from a worktree; snakemake absent from the local venv), both confirmed present at the base commit with this PR's files absent.

— Claude (Fable, with Opus implementation agents) on behalf of Cail.

🤖 Generated with Claude Code

https://claude.ai/code/session_016Ko89uZF84ez6HEDcTWbJe

cailmdaley and others added 2 commits July 10, 2026 03:27
The blinding box's theory engine and its validation (PRD #241 §5).

blinding_likelihood.py — a minimal firecrown Gaussian likelihood over the
tomographic coarse ξ± subset of a sacc_io analysis file. Smokescreen (PR 6)
calls only its compute_theory_vector to form the Muir et al. shift
t(hidden)−t(fid). Generic over N source bins; extracts the coarse ξ± block
(past COSEBIs/pseudo-Cℓ/ρ/τ) with its aligned covariance before handing to
firecrown, as firecrown models every point it reads and Smokescreen requires
sacc.mean == likelihood data vector. TheoryConfig is the single config
surface for the fiducial cosmology + model choices (HMCode2020 via CAMB, NLA
IA off by default, normal-hierarchy neutrinos), defaults mirroring the
CosmoSIS v1.4.6.3 _A_cell fiducial. theory_vector_sacc_order realigns
firecrown's statistic-ordered vector to SACC insertion order via
sacc_indices, independent of statistic order.

test_camb_ccl_crosscheck.py — firecrown+CCL vs an independent CAMB-P(k)→CCL
path predict the same ξ± at fixed cosmology. Settles σ8-vs-A_s inside the
test (CAMB A_s iterated to share CCL's σ8; nominal A_s is ~3% off).
Observed: ξ+ 0.21% / ξ− 0.10% at fiducial, 0.25%/0.12% at a blind-sized
offset; tolerances 0.5%/1.0%. Validates P(k)+amplitude consistency, not
CCL's Limber+Hankel independently (documented).

Observed green: likelihood 7 fast + 6 slow; cross-check 1 fast + 4 slow.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…10%)

Adversarial review measured the fixture floor at xi+ 0.213% / xi- 0.102%
- xi- tighter than xi+, inverting the old comment's ~0.3%/~0.6% claim and
its rationale. Comments now state the observed floor; the looser xi-
tolerance stays as prudential margin, said honestly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Ko89uZF84ez6HEDcTWbJe
@cailmdaley

Copy link
Copy Markdown
Collaborator Author

Retiring this PR under the amended plan (see the plan-amendment comment on #241): the SACC/blinding stream now runs on the UNIONS-WL/Smokescreen fork, whose theory entry point is a plain theory_fn callable with a built-in CCL backend — the standalone firecrown likelihood this PR built is no longer a deliverable, and there is no successor PR. The CAMB↔CCL cross-check developed here survives: it moves into the blinding PR (#253) as a theory-consistency test on the same CCL backend that PR introduces (σ8-matched amplitude convention, matched halofit_version strings, 0.5%/1.0% ξ± tolerances).

This PR is to be closed without merging (close left to Cail).

— Fable on behalf of Cail.

@cailmdaley cailmdaley closed this Jul 10, 2026
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.

1 participant