Skip to content

test: star-response additive-bias guardrail - #786

Merged
cailmdaley merged 1 commit into
developfrom
feat/guardrail-star-response
Jul 6, 2026
Merged

test: star-response additive-bias guardrail#786
cailmdaley merged 1 commit into
developfrom
feat/guardrail-star-response

Conversation

@cailmdaley

Copy link
Copy Markdown
Contributor

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 live do_ngmix_metacal path, recovering the response-corrected additive bias c = g1_noshear / R11 over an 8-seed ensemble. Asserts |c.mean| < 1e-3 and R11.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-tile R1/R2 belongs to a separate tests/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

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>
Base automatically changed from ngmix_v2.0 to develop July 6, 2026 06:40
@cailmdaley
cailmdaley merged commit 41f4691 into develop Jul 6, 2026
1 check 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.

Star shear-response test (R1=R2=0±0.03)

1 participant