Skip to content

b_modes: work from plain arrays; fix the MC pure-E/B covariance - #351

Merged
cailmdaley merged 2 commits into
developfrom
refactor/bmodes-arrays-api
Sep 25, 2026
Merged

cailmdaley merged 2 commits into
developfrom
refactor/bmodes-arrays-api

Conversation

@cailmdaley

Copy link
Copy Markdown
Collaborator

b_modes.py now works from plain arrays instead of TreeCorr GGCorrelation objects. This is the part of #251 that doesn't depend on SACC, split out so #251's diff covers only the SACC migration. #251 is built on top of this PR.

  • calculate_pure_eb_correlation returns a dict that carries everything its consumers need: θ, bin edges, ξ± on both grids, and n_eff. calculate_eb_statistics, the plot helpers and save_pure_eb_results read from that dict. New array helpers: bins_from_edges, log_bin_edges, pure_eb_from_xi, pure_eb_covariance_mc, cosebis_scan_from_xi.
  • Callers adapted: in cosmo_val, pure E/B, COSEBIs and summarize_bmodes. In the bmodes paper, calculate_pure_eb_ptes.py, its claims rule, and run_pure_eb_ptes_sweep.sh (which passed flags the script no longer accepts). The pure-E/B .npz key npatch is now n_eff; nothing reads it.
  • Fix: cs_util's get_theo_xi returns {pair: (ξ+, ξ−)}, so the Monte Carlo pure-E/B covariance raised TypeError on develop (in b_modes and in the paper's precompute_pure_eb_chunk.py). It now unpacks the single pair. A new test covers it.

No numbers change. On the same synthetic inputs, develop's and this branch's b_modes agree bit-for-bit in 162 of 162 comparisons. These covered COSEBIs with both jackknife and analytic covariances, the PTE matrices, and a seeded MC covariance; the MC comparison ran with the unpack fix applied to develop.

— Claude (Opus) on behalf of Cail.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HeMhD6yCyrgBz5oz87bCtR

cailmdaley and others added 2 commits September 25, 2026 15:15
calculate_pure_eb_correlation returns a self-describing results dict
(theta, bin edges, xi+/- on both grids, n_eff) in place of the gg/gg_int
objects, so calculate_eb_statistics, the plot helpers and
save_pure_eb_results work from values alone. New seams: bins_from_edges,
log_bin_edges, pure_eb_from_xi, pure_eb_covariance_mc and
cosebis_scan_from_xi. The pure-E/B .npz stores n_eff (the realisation
count behind the covariance) instead of npatch.

Callers in cosmo_val, the bmodes calculate_pure_eb_ptes script, its
claims rule and PTE sweep driver are adapted. No numbers change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HeMhD6yCyrgBz5oz87bCtR
cs_util's get_theo_xi returns {pair: (xi+, xi-)}, so concatenating its
return value raised TypeError and the semi-analytic pure-E/B covariance
(pure_eb_covariance_mc, and the paper's precompute_pure_eb_chunk.py) could
not run. One n(z) is one tracer pair: unpack that single entry, which also
fails loudly if a tomographic n(z) is passed. The new test stubs the
kernel and checks the draws centre on the binned theory mean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HeMhD6yCyrgBz5oz87bCtR
@cailmdaley
cailmdaley merged commit 09616f0 into develop Sep 25, 2026
3 checks passed
cailmdaley added a commit that referenced this pull request Sep 25, 2026
…val-sacc

Brings in #351 (b_modes arrays API + get_theo_xi unpack) and #352 (dead
scripts, doc paths). b_modes.py and test_b_modes.py resolve to develop's
side, which is this branch's version plus the unpack fix and its test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HeMhD6yCyrgBz5oz87bCtR
@cailmdaley
cailmdaley deleted the refactor/bmodes-arrays-api branch September 25, 2026 13:40
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