test: star-response additive-bias guardrail - #786
Merged
Conversation
Add tests/science/test_star_response.py, the PSF-leakage sibling of test_mbias.py. A round galaxy (shear=(0,0)) seen through an elliptical PSF (psf_shear=(0.05,0)) is driven through the live do_ngmix_metacal; the per-object response R11 corrects the noshear estimate to the additive bias c = g_noshear / R11, which an unbiased deconvolution drives to zero. Self-contained: reuses the make_data simulator (now carrying psf_shear) and the same response machinery test_mbias already exercises, with no dependence on external star-grid intermediates. Asserts the c null on a small deterministic seed ensemble (additive bias is statistical): the in-container ensemble gives c.mean=-5.1e-6, c.std=2.3e-5, R11~0.925, so |c| < 1e-3 clears the observed null by >20x while catching real leakage. Asserts c (the additive bias of the recovered metacal shear, the pipeline-level statistic and exactly what the digital twin's run_star_response.py measures: c=-5e-6) rather than Fabian's off-diagonal R1=R2=0+/-0.03, which would need the full 2x2 response matrix and a real star grid the self-contained single-object sim does not provide. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #763. Part of the #765 verification-suite epic (Tier 1: fast CI tripwires).
Adds
tests/science/test_star_response.py: a round galaxy convolved with an elliptical PSF (e1 = 0.05) through the livedo_ngmix_metacalpath, recovering the response-corrected additive biasc = g1_noshear / R11over an 8-seed ensemble. Asserts|c.mean| < 1e-3andR11.min > 0.1.Not a tautology: fault-injecting a broken PSF deconvolution drives
c → 0.066, failing the tolerance by ~13×. The null reproduces the digital-twin result to the digit. The docstring records the caveats: the c-not-R correction, the exact-true-PSF idealization, and that real-data per-tileR1/R2belongs to a separatetests/cluster/candide test.Scope note (Tier 1): this is a gross-breakage tripwire (
C_TOL~200× the observed |c|), ideal noise, exact true PSF as model — "wired and not broken", not "validated". Validation is the epic's Tier-2 image-sim pass.— Claude on behalf of Cail
🤖 Generated with Claude Code
https://claude.ai/code/session_01G4PVdk8w8vTxBuCahjGhXh