Skip to content

Remove vestigial FHP/MK NOSHEAR←1P Tpsf substitution (guaranteed no-op)#267

Open
cailmdaley wants to merge 1 commit into
developfrom
remove-noshear-1p-hack
Open

Remove vestigial FHP/MK NOSHEAR←1P Tpsf substitution (guaranteed no-op)#267
cailmdaley wants to merge 1 commit into
developfrom
remove-noshear-1p-hack

Conversation

@cailmdaley

Copy link
Copy Markdown
Collaborator

Closes #257.

Removes the vestigial FHP/MK NOSHEAR←1P Tpsf substitution from the two sites that carried it. This was a real workaround when written (b076413, Jan 2026) — for an older ShapePipe catalogue whose metacal no-shear reconvolution-PSF size was wrong, the code overwrote it with the 1P value in the galaxy size cut and mirrored the substitution onto the output column (keeping the original as _NOSHEAR_orig).

It is now a guaranteed no-op under the current stack:

  • ngmix builds one magnitude-dilated reconvolution PSF and reuses it for all metacal types (noshear literally reuses the 1p object) — the reconv-PSF size is identical across noshear/1p/1m/2p/2m by construction.
  • ShapePipe's ngmix module fits that reconv PSF once per object and broadcasts the same scalar into all five per-type columns — so _NOSHEAR and _1P are bit-identical for every object.
  • Confirmed empirically on the fiducial sim tile: the preserved _orig column is bit-identical to the hacked column.

Changes

  • calibration.py (metacal._read_data): replace the silent overwrite of ns["Tpsf"] with a one-line np.testing.assert_array_equal(NOSHEAR, 1P) regression guard, so any future producer-side divergence fails loudly instead of being silently patched.
  • scripts/calibration/calibrate_comprehensive_cat.py: drop the override and the now-redundant NGMIX_T_PSF_RECONV_NOSHEAR_orig column.
  • test_calibration.py: update the estimator-stdout note (the estimator no longer prints an FHP/MK hack line).

Verification

No output changes under the current stack. test_calibration.py runs green in the container (8 passed) — the two metacal-estimator tests now exercise the new guard (the synthetic catalogue has NOSHEAR == 1P, so it holds).

Note for downstream readers (independent of this removal): the per-type NGMIX_T_PSF_RECONV_<TYPE> columns all carry the same object-level NOSHEAR-kernel value by design — the _1P/_2P labels are not physically distinct reconv-PSF measurements.

— Opus, on behalf of Cail

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xthu9uZC17TsaeXh899fhc

The metacal estimator and calibrate_comprehensive_cat.py carried a
workaround that overwrote the metacal no-shear reconvolution-PSF size
with the 1P value. It was a real fix for an older ShapePipe catalogue
whose no-shear PSF was wrong, but is a guaranteed no-op under the current
stack: ngmix builds one magnitude-dilated reconv PSF and reuses it across
all metacal types, and ShapePipe fits it once per object and broadcasts
the same scalar into every per-type column, so NOSHEAR and 1P are
bit-identical for every object.

- calibration.py: replace the silent overwrite with an
  np.testing.assert_array_equal(NOSHEAR, 1P) regression guard, so any
  future producer-side divergence fails loudly instead of being patched.
- calibrate_comprehensive_cat.py: drop the override and the now-redundant
  NGMIX_T_PSF_RECONV_NOSHEAR_orig column.
- test_calibration.py: update the estimator-stdout note (no hack line now).

No output changes under the current stack. test_calibration.py: 8 passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xthu9uZC17TsaeXh899fhc
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.

Remove vestigial FHP/MK NOSHEAR←1P Tpsf substitution (guaranteed no-op under the current stack)

1 participant