Skip to content

sacc_io: SACC read/write layer for the standard data-product layout #244

Description

@cailmdaley

Introduce src/sp_validation/sacc_io.py: a single module that writes every sp_validation weak-lensing data product (ξ±, pseudo-Cℓ, COSEBIs, pure-E/B, ρ/τ PSF diagnostics, n(z), covariance) into self-describing SACC files in one fixed, self-consistent layout. This is pure format work — it defines the on-disk contract that the converter, migration, and blinding stages all consume, and nothing about it depends on where theory comes from.

Desired end state

Per-statistic builder functions, mirror reader functions, a covariance assembler, and thin save/load helpers, with round-trip tests proving every product's numeric payload survives write→read bit-exact (insertion order, covariance alignment, and n(z) all reconstruct exactly).

Each catalogue version is serialized as one SACC file{version}.sacc — holding everything: NZ tracers source_i, coarse ξ±, pseudo-Cℓ (EE/BB/EB) with bandpower windows, COSEBIs at the fiducial scale cut, pure-E/B, ρ/τ, and the fine-grid ξ± COSEBIs/pure-EB integration input as grid='fine' tagged points. The covariance is BlockDiagonal: the analysis blocks with zero cross-blocks (the same independence assumption the current assembly makes), plus a dense per-pair fine block from the analytic integration covariance when it exists, with the TreeCorr varxip/varxim diagonal as the explicit degraded fallback. Insertion order puts the analysis points contiguous first, then the fine points, so the blocks tile the mean.

At the production fine binning (1000 θ bins, 0.5–300′) the dense fine block is ~32 MB per pair — unremarkable. Extreme convergence-check grids (the one-off 10 000-bin run) degrade to a diagonal fine block; they don't fork the file format.

The API is tomography-native throughout (bins=(i,j); single-bin is (0,0)); NZ tracers are named source_i.

Acceptance

Round-trip tests pass bit-exact for every product; the terminal file builds and reloads with insertion order, covariance alignment, and n(z) intact.

— Fable on behalf of Cail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions