sacc_io converters: SACC → CosmoSIS 2pt-FITS (byte-verified) + SACC ↔ OneCovariance#249
Draft
cailmdaley wants to merge 5 commits into
Draft
sacc_io converters: SACC → CosmoSIS 2pt-FITS (byte-verified) + SACC ↔ OneCovariance#249cailmdaley wants to merge 5 commits into
cailmdaley wants to merge 5 commits into
Conversation
cailmdaley
force-pushed
the
feat/sacc-2-sacc-io
branch
from
July 16, 2026 00:39
55cb97d to
4489dd4
Compare
Adds twopoint_convert (SACC → 2pt-FITS, byte-compatible with cosmosis_fitting) and one_covariance_io (SACC ↔ OneCovariance glue), with their test suites. Rebuilt on feat/sacc-2-sacc-io so the diff is converter-only; adapted to that branch's canonical sacc_io — ξ reads use grid='reporting' (was 'coarse'). Optional-block probing (pseudo-Cℓ, τ) stays on raw s.indices behind get_data_types/use_rho_tau guards, so the new fail-loud sacc_io readers don't trip on absent blocks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzUt7VbtXwr2SCHUdiQTyt
cailmdaley
force-pushed
the
feat/sacc-3-2pt-converter
branch
from
July 16, 2026 09:34
700a885 to
64b2b5f
Compare
…acc-3-2pt-converter
…ty selections Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MN9VazXKHUHQg16kiG7Ufk
One module whose job is converting between the SACC product and external analysis-tool file formats (CosmoSIS 2pt-FITS, OneCovariance). Public API unchanged; sacc_io untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01766vawzi2XqrgoyHmeHEY9
Cail's ruling: a single sacc_io.py carries the format contract and the external-tool converters (CosmoSIS 2pt-FITS, OneCovariance). Public API unchanged; the sacc_io import name every downstream branch uses is untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01766vawzi2XqrgoyHmeHEY9
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.
Closes #246. PR 3 of the PRD #241 series (base: #245,
sacc_io).What & why
Extends
sp_validation.sacc_iowith converters between the SACC data product and external analysis-tool file formats. SACC stays the standard product; the current CosmoSIS inference chain runs unchanged behind it (PRD #241 §2: "converter first, native likelihood later"). One module now carries the whole SACC surface: format contract, guarded selection, and converters.sacc_to_twopoint_fits(s, path, *, rho_stats_hdu=None, tau_stats_hdu=None, n_bins=1)converts an analysis SACC into the 2pt-FITS read by2pt_likeand the ρ/τ2pt_like_xi_sysfork. Single-bin v1: it raises onn_bins != 1and on any ξ pair beyond(source_0, source_0). Tomographic emission lands with the tomographic round. RHO_STATS is copied verbatim from a sidecar FITS; the 2pt layout carries per-modevarrho_*variances the SACC does not store, and no consumer reads them.[redshift]config stanza, plus acovariance_list_*.datreader that produces dense blocks paired with SACC selectors forassemble_covariance. Coupled to OneCovariance only through its file formats, not as a dependency.Every data and covariance selection goes through the guarded selection with
grid="reporting"(loud on empty). Integration-grid points in the analysis SACC can never leak into the 2pt-FITS. (SACC covariances carry no tags of their own; blocks are addressed through data-point indices, which do — filtering the points filters the covariance with them.)No public API outside
sacc_iochanges; no existing behavior is modified.Validation
Byte equality against the current writer (astropy writes FITS deterministically): build a reference with
cosmosis_fitting.py's own HDU-builders, build a SACC from the same inputs, convert, assert byte-for-byte identity.test_sacc_io_twopoint.py(CI): all three product shapes (plain-ξ; ξ+Cℓ; ξ+ρ/τ), the truncated-but-cross-correlated[τ₀+; τ₂+]covariance block, perturbation teeth, sidecar fail-fast, an encoded-covariance test that fails on any transposition, and byte-identity with integration-grid points present (regression pinning the grid-filtered covariance gather).test_sacc_io_realdata.py(candide-localskipif): byte-equal observed for realSP_v1.4.6_leak_corrandglass_mockproducts. No real data committed.test_sacc_io_one_covariance.py: reshaping, column selection, n(z) round-trip, fail-fast paths.81 tests green, including the 4 real-data byte-compares on candide.
Legacy writer
cosmo_inference/scripts/cosmosis_fitting.pyremains the pipeline's 2pt-FITS writer for now; this converter is its byte-verified equivalent. PR 4 (#251) migrates the pipeline onto the SACC path and retires it. The swap happens downstream, not here.— Claude (Fable, with Opus/Sonnet implementation agents) on behalf of Cail.
🤖 Generated with Claude Code
https://claude.ai/code/session_016Ko89uZF84ez6HEDcTWbJe