Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions scripts/calibration/calibrate_comprehensive_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
18 changes: 11 additions & 7 deletions src/sp_validation/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,13 +789,17 @@ 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
# The reconvolution-PSF size is identical across all metacal types by
# construction: ngmix builds one magnitude-dilated reconv PSF and reuses
# it for noshear/1p/1m/2p/2m, and ShapePipe fits it once per object and
# broadcasts the same scalar into every per-type column. A historical
# workaround overwrote the no-shear value with the 1P value for an older
# catalogue whose no-shear PSF was wrong; that is now a guaranteed no-op.
# Assert the invariant so any future producer-side divergence fails
# loudly instead of being silently patched (see issue #257).
np.testing.assert_array_equal(
ns["Tpsf"], masked_data[f"{self._prefix}_T_PSF_RECONV_1P"]
)

self.m1 = m1
self.p1 = p1
Expand Down
4 changes: 2 additions & 2 deletions src/sp_validation/tests/test_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading