From 2b610e2438b78b6ca7de19726c17cae9f15845d2 Mon Sep 17 00:00:00 2001 From: Cail Daley Date: Sat, 11 Jul 2026 14:30:57 +0200 Subject: [PATCH] =?UTF-8?q?Remove=20vestigial=20FHP/MK=20NOSHEAR=E2=86=901?= =?UTF-8?q?P=20Tpsf=20substitution=20(#257)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The metacal estimator and calibrate_comprehensive_cat.py carried a workaround that overwrote the metacal no-shear reconvolution-PSF size with the 1P value — a real fix for an older ShapePipe catalogue whose no-shear PSF was wrong, now a no-op under the current stack: ngmix builds one magnitude-dilated reconv PSF and reuses it across all metacal types, so NOSHEAR and 1P are bit-identical per object. - calibration.py: drop the overwrite; the no-shear branch simply uses the no-shear reconv-PSF column it already reads. - 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 Claude-Session: https://claude.ai/code/session_01Xthu9uZC17TsaeXh899fhc --- scripts/calibration/calibrate_comprehensive_cat.py | 10 ---------- src/sp_validation/calibration.py | 8 -------- src/sp_validation/tests/test_calibration.py | 4 ++-- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/scripts/calibration/calibrate_comprehensive_cat.py b/scripts/calibration/calibrate_comprehensive_cat.py index 4b15ed89..fb3ef3ca 100644 --- a/scripts/calibration/calibrate_comprehensive_cat.py +++ b/scripts/calibration/calibrate_comprehensive_cat.py @@ -191,16 +191,6 @@ for key in add_cols: add_cols_data[key] = cat.get_col(dat, key, mask_combined._mask, mask_metacal) -# Keep original NOSHEAR column, override with 1P PSF values (FHP/MK hack) -print( - "FHP/MK hack: explicit copying of the metacal no-shear (updated from 1p)" - + " PSF size" -) -add_cols_data["NGMIX_T_PSF_RECONV_NOSHEAR_orig"] = add_cols_data[ - "NGMIX_T_PSF_RECONV_NOSHEAR" -] -add_cols_data["NGMIX_T_PSF_RECONV_NOSHEAR"] = gal_metacal.ns["Tpsf"][mask_metacal] - # %% # Additional post-processing columns to write to output cat add_cols_post = [ diff --git a/src/sp_validation/calibration.py b/src/sp_validation/calibration.py index 9032bc63..37ed67b4 100644 --- a/src/sp_validation/calibration.py +++ b/src/sp_validation/calibration.py @@ -789,14 +789,6 @@ def _read_data(self, data, mask): f"Unsupported shape prefix '{self._prefix}'; only 'NGMIX' is supported" ) - print("FHP/MK hack using p1 PSF for ns in cuts") - indices = np.where(mask)[0] - col_1p = f"{self._prefix}_T_PSF_RECONV_1P" - new_psf = data[col_1p][indices] - - # Overwriting incorrect no-shear PSF size to the one from 1p - ns["Tpsf"] = new_psf - self.m1 = m1 self.p1 = p1 self.m2 = m2 diff --git a/src/sp_validation/tests/test_calibration.py b/src/sp_validation/tests/test_calibration.py index 40621c19..0a66aed5 100644 --- a/src/sp_validation/tests/test_calibration.py +++ b/src/sp_validation/tests/test_calibration.py @@ -296,8 +296,8 @@ def test_metacal_R_matrix_recovers_injected_response(): re-runs with slope 5.0 and confirms R11 tracks it (5.0 != 2.0), so a change that decouples R from the input numbers fails. - NOTE: the estimator prints an 'FHP/MK hack' line and an unweighted / - weighted response line; these are expected stdout, not errors. + NOTE: the estimator prints an unweighted / weighted response line; this + is expected stdout, not an error. """ data, n = _build_ngmix_catalog(slope_11=2.0, slope_22=3.0, step=0.01) mask = np.ones(n, dtype=bool)