Skip to content

Commit e2f37be

Browse files
cailmdaleyclaude
andcommitted
test: make_data gains psf_shear for an elliptical PSF
The PSF property tests (reconv rounder/larger than orig, pristine prefit) need a non-round PSF to exercise. Add an optional psf_shear=(0,0) param to the make_data test helper that shears the Moffat PSF; the default is a no-op, so every existing caller is unchanged. Test-helper only, no pipeline behaviour change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 413c5dd commit e2f37be

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/shapepipe/testing/simulate.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def make_data(
2121
psf_fwhm=0.55,
2222
pixel_scale=0.1857,
2323
img_size=201,
24+
psf_shear=(0.0, 0.0),
2425
):
2526
"""Simulate an exponential galaxy with Moffat PSF.
2627
@@ -48,6 +49,12 @@ def make_data(
4849
Pixel scale in arcsec/pixel. Default 0.1857.
4950
img_size : int, optional
5051
Stamp size in pixels (square). Default 201.
52+
psf_shear : tuple of float, optional
53+
Ellipticity (g1, g2) applied to the Moffat PSF. Default (0, 0), a
54+
round PSF. A non-round PSF is what the PSF-leakage / additive-bias
55+
guardrail needs: the PSF carries a shape that an unbiased deconvolution
56+
must remove from a round galaxy. The same sheared PSF is used both to
57+
convolve the object and as the PSF model stamp.
5158
5259
Returns
5360
-------
@@ -71,7 +78,9 @@ def make_data(
7178
if not share_shift:
7279
dy, dx = rng.uniform(low=-scale / 2, high=scale / 2, size=2)
7380

74-
psf = galsim.Moffat(beta=2.5, fwhm=psf_fwhm)
81+
psf = galsim.Moffat(beta=2.5, fwhm=psf_fwhm).shear(
82+
g1=psf_shear[0], g2=psf_shear[1]
83+
)
7584
obj = galsim.Convolve(
7685
psf,
7786
galsim.Exponential(half_light_radius=gal_hlr, flux=gal_flux).shear(

0 commit comments

Comments
 (0)