Skip to content

Fix one-multipole shift in the pseudo-Cℓ Gaussian covariance theory - #372

Closed
cailmdaley wants to merge 1 commit into
developfrom
fix/pseudo-cl-theory-ell-index
Closed

cailmdaley wants to merge 1 commit into
developfrom
fix/pseudo-cl-theory-ell-index

Conversation

@cailmdaley

Copy link
Copy Markdown
Collaborator

Bug. calculate_pseudo_cl_eb_cov built the fiducial C_ℓ and the pixel window on ℓ = 1..lmax. NaMaster's arrays for fields built with lmax=b_lmax (noise bias, coupling matrix, gaussian_covariance inputs) run over ℓ = 0..b_lmax, with index = ℓ. So the theory at ℓ was fed in at ℓ−1. For a single-bin Planck18 spectrum the input was 41% too high at ℓ=2, 14% too high at ℓ=3, about 2–3% low at ℓ=5–20, and 1% low at ℓ=100.

Separately, the method raised TypeError on develop: cs_util's get_theo_c_ell now returns a dict keyed by bin pair.

Fix.

  • New pseudo_cl.pixelised_theory_cl(cl_of_ell, nside, b_lmax) returns pw²(ℓ)·C_ℓ on ℓ = 0..b_lmax, with zeros below ℓ=2. The covariance method uses it with pseudo_cl_geometry and takes the "W1xW1" entry.
  • The GLASS mock pseudo-Cℓ helpers now label the coupled-spectrum ℓ row 0..lmax−1, matching compute_coupled_cell. Only the label changes.

Verified in the CI container (NaMaster 3.0.1):

  • Array lengths are b_lmax+1, and a full-sky delta at index 10 couples to index 10.
  • New tests pin the ℓ↔index convention against NaMaster's own coupling and run the covariance method end to end on the synthetic catalogue. Without the fix, the end-to-end test fails with the TypeError.
  • test_pseudo_cl.py + test_sacc_writers.py: 29 passed. Ruff is clean.

This applies cleanly alongside #366, which adds the pixel window to the bandpower windows.

🤖 Generated with Claude Code

NaMaster arrays for fields built with lmax=b_lmax run over l = 0..b_lmax
with index equal to l. The iNKA covariance built its fiducial C_l (and pixel
window) on l = 1..lmax, so the theory at l landed at index l-1: every input
multipole was shifted down by one (41% at l=2, 14% at l=3, ~2-3% at l=5-20,
1% at l=100 for a Planck18 single-bin spectrum).

Add pseudo_cl.pixelised_theory_cl, which evaluates a theory C_l on NaMaster's
l = 0..b_lmax grid (zero at l < 2) times pw^2(l), and use it in
calculate_pseudo_cl_eb_cov with the shared pseudo_cl_geometry. It also takes
the single-bin "W1xW1" entry from cs_util's get_theo_c_ell, which returns a
dict keyed by bin pair; the covariance method raised TypeError without it.

Label the coupled-spectrum ell row in the GLASS mock pseudo-Cl helpers as
0..lmax-1, matching compute_coupled_cell.

Tests pin the l <-> index convention against NaMaster's own coupling and
smoke-test the covariance method end to end on the synthetic catalog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cailmdaley
cailmdaley requested a review from sachaguer October 1, 2026 23:04

@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.

Same comment as for the pixel window function PR. This is already done in a previous of my PR in the extent to tomography. Future PRs should source from the feature/sp_validation-extent-to-tomo or merge the latter first to develop. Note that some open PRs for real space and leakage are still opened and plug to this branch.

@cailmdaley

Copy link
Copy Markdown
Collaborator Author

Ok closing this, we should get the API change merged ASAP if it is holding back ~most other PRs

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