Skip to content

cat_config: drop duplicate SP_v1.4.6 / SP_v1.3.6 keys, repair the survivor, guard against recurrence - #320

Merged
cailmdaley merged 3 commits into
developfrom
fix/cat-config-duplicate-keys
Sep 5, 2026
Merged

cat_config: drop duplicate SP_v1.4.6 / SP_v1.3.6 keys, repair the survivor, guard against recurrence#320
cailmdaley merged 3 commits into
developfrom
fix/cat-config-duplicate-keys

Conversation

@cailmdaley

@cailmdaley cailmdaley commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

cosmo_val/cat_config.yaml had two top-level SP_v1.4.6: keys and two SP_v1.3.6: keys; PyYAML keeps the last, so the second block of each pair was the live one. The second SP_v1.4.6 was a long-dead one-off variant (SSP_v1.4.6_msel) that merge c22f07568 renamed and kept alongside the real entry; it was never meant to be SP_v1.4.6.

This PR:

  • deletes the two shadowing blocks;
  • repairs the surviving SP_v1.4.6: shear.R: 1.0, cov_th A = 2894.03 deg² / n_e = 5.0935, shear.redshift_distrshear.redshift_path (the key the code reads), shear.mask → entry-level mask: …/mask_map_footprint_nside_4096.fits, as in SP_v1.4.5 and SP_v1.4.6.3;
  • recomputes SP_v1.3.6's cov_th (A, n_e, sigma_e) from its own catalogue on the nside-4096 footprint — it had been left with v1.4.6's numbers; the same code path reproduces SP_v1.4.6.3's committed values bit-for-bit;
  • adds a duplicate-key-rejecting loader and a test that cat_config.yaml parses clean under it (fails on the pre-fix file).

Not touched: SP_v1.4.6_glass_mock, which still carries the old A / n_e pair (see #319).

— Claude on behalf of Cail

…urvivor

`cosmo_val/cat_config.yaml` carried two top-level `SP_v1.4.6:` keys and two
`SP_v1.3.6:` keys. PyYAML keeps the last, so the second block of each pair
was what every consumer saw — and both were stale. They arrived in merge
c22f075, which resolved a conflict by keeping both sides (and renamed the
dead `SSP_v1.4.6_msel` key to `SP_v1.4.6` in the process).

Delete the shadowing blocks and repair the surviving `SP_v1.4.6` to the
post-aa774b65d convention:

  * `cov_th` stays at A = 2894.03 deg^2 / n_e = 5.0935 (the nside-4096
    footprint mask every other live entry uses), not the 2405 / 6.128 pair
    the shadowing block held.
  * `shear.redshift_distr` -> `shear.redshift_path`: the code only ever reads
    `redshift_path`, so the v1.4.6 n(z) was under a key nothing reads while
    the winning block pointed at the v1.0-era `dndz_SP_A.txt`.
  * `shear.mask` (read nowhere) -> entry-level `mask:` pointing at
    `mask_map_footprint_nside_4096.fits`, matching SP_v1.4.5 / SP_v1.4.6.3
    and the mask `A` was measured from.
  * `shear.R: 1.0` — the delivered e1/e2 columns already have the response
    applied; the shadowing block's `R: 0.92` double-counted it and inflated
    xi_pm by 1/R^2 = 18% against a covariance that never sees R.

`SP_v1.3.6`'s surviving block already carries the nside-4096 footprint mask;
its cov_th still holds the old 2405 / 6.128 pair and needs regenerating
separately.
`yaml.safe_load` silently keeps the last of a repeated key, so a merge that
resolves a conflict by keeping both sides leaves the shadowed block invisible
to every consumer *and* to every test. That is how two `SP_v1.4.6` and two
`SP_v1.3.6` entries survived on develop.

Add a `yaml.SafeLoader` subclass whose `construct_mapping` raises on a
repeated key, and assert `cosmo_val/cat_config.yaml` parses clean with it.
Fails on the pre-fix config with `duplicate key 'SP_v1.3.6' at line 522
(first seen at line 148)`.
…e-4096 footprint

aa774b6 repointed SP_v1.3.6's mask to the 2894 deg² footprint but left its
cov_th holding v1.4.6's old numbers. Recomputed from v1.3.6's own catalogue
with sp_validation.survey; the same code path reproduces SP_v1.4.6.3's
committed A / n_e / sigma_e bit-for-bit. n_psf left as it was.
@cailmdaley
cailmdaley force-pushed the fix/cat-config-duplicate-keys branch from 6cf2638 to ed0a0f6 Compare September 5, 2026 14:08
@cailmdaley

Copy link
Copy Markdown
Collaborator Author

LGTM

@cailmdaley
cailmdaley merged commit 556e56a into develop Sep 5, 2026
3 checks passed
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