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 two SACC files:

  • {version}.sacc — the analysis vector: NZ tracers, coarse ξ±, pseudo-Cℓ (EE/BB/EB) with bandpower windows, COSEBIs at the fiducial scale cut, pure-E/B, ρ/τ, and a FullCovariance assembled from per-statistic blocks with zero cross-blocks.
  • {version}_xi_fine.sacc — the COSEBIs/pure-EB integration input: the same NZ tracers, fine ξ± (10000 bins), and a DiagonalCovariance from TreeCorr varxip/varxim.

The two-file split is mandatory: sacc requires covariance.size == len(mean), and a 10000-bin fine grid cannot coexist with a full analysis covariance in one file (the dense fine block alone is multi-GB single-bin). 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; both terminal files build and reload 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