sp_validation.blinding

Blinds, the theory a blind shifts by, and the call that conceals a SACC.

A blind is a named secret, <paths.blinds>/<name>.blind.json holding a seed, the envelope the hidden point is drawn in and the fiducial point. It is drawn once, python -m sp_validation.blinding init <name>, and never committed (*.blind.json is gitignored). Each catalogue entry of the catalogue config declares blind: none (public) or blind: <name> (blind_of()).

conceal() adds the blind’s shift, t(hidden) − t(fiducial), to every row of a SACC; Smokescreen draws the hidden point from the seed and evaluates the theory t at both points.

A theory is a function theory(params, s):

  • params is a dict of cosmological parameters with the keys of fiducial() (S8, Omega_m, Omega_b, h, n_s, m_nu, w0, wa, logT_AGN, A_IA). The fiducial and hidden points differ only in S8 and Omega_m.

  • s is the sacc.Sacc being concealed: its rows carry a data type, a tracer pair and a θ or ℓ tag, its tracers the n(z).

  • It returns an array shaped like the data, len(s.mean) values in the order of s.data: the prediction for each row, zero where the cosmology has no effect.

For Cℓ_EE/BB/EB bandpowers, for example:

def my_theory(params, s):
    out = np.zeros(len(s.mean))
    ee = s.indices(sacc_io.CL_EE)
    window = s.get_bandpower_windows(ee)
    out[ee] = window.weight.T @ my_cl_ee(params, window.values)
    return out  # Cℓ_BB and Cℓ_EB stay zero

shear() is the default theory; no_signal() is that of a statistic with no cosmological signal (ρ/τ).

The host Snakemake loads this module by path, so at import it needs only the standard library.

exception BlindingError[source]

Bases: RuntimeError

A blind cannot be opened or applied; the message carries no hidden value.

class Blind(name: str, path: Path | None = None)[source]

Bases: object

A blind’s name and the path of its record; none has no record.

name: str
path: Path | None = None
record()[source]

The blind’s {seed, envelope, fiducial}.

_shear_file(entry)[source]
blind_of(catalogues, entry)[source]

The blind: of catalogue-config entry entry.

Refuses an entry that declares none, and entries reading one shear file under different blinds.

registry(catalogues)[source]

The directory a catalogue config keeps its blinds in (paths.blinds).

open_blind(name, catalogues)[source]

Blind name of the catalogue config catalogues; its record must exist.

conceal(s, blind, theory=None)[source]

A copy of SACC s with blind’s shift added to every row.

The shift is t(hidden) − t(fiducial), t being theory (default shear()). A failure raises BlindingError naming only the exception type, so no message or traceback shows the hidden point.

init(name, catalogues)[source]

Draw blind name into the catalogue config’s registry, once.

fiducial()[source]

cs_util’s Planck 2018 point, with feedback and no IA.

no_signal(params, s)[source]

Zeros: the theory of a statistic with no cosmological signal (ρ/τ).

shear(params, s)[source]

Cosmic-shear ξ± and Cℓ_EE from pyccl; zeros for Cℓ_BB and Cℓ_EB.

ξ± is evaluated at each row’s stored θ (TreeCorr’s meanr) and Cℓ_EE through each row’s bandpower window. Any other data type raises: pass your own theory.

cosmology(params)[source]

The pyccl.Cosmology at params, built once per point.

Built through cs_util.cosmo.get_cosmo on the CAMB HMCode2020-feedback route the CosmoSIS inference runs, with σ8 = S8/√(Ωm/0.3); get_cosmo subtracts CAMB’s Ω_ν from Omega_m for Ω_c.

_cosmology(point)[source]
_ell()[source]

The multipoles the ξ± Hankel transform integrates over: every ℓ below 50, then 200 log-spaced up to 6·10⁴.

_lensing(cosmo, params, s, name)[source]
_shear_cl(params, s, rows, ell)[source]
_xi(params, s, rows)[source]

ξ± of one shear pair: Limber Cℓ on _ell(), then CCL’s Hankel transform.

_cl(params, s, rows)[source]

Cℓ_EE of one shear pair through its bandpower window.

main(argv=None)[source]