From ce0daa19397c6f680ef8f9f0f32f3ed305402599 Mon Sep 17 00:00:00 2001 From: Lee Kelvin Date: Fri, 27 Sep 2024 12:09:06 -0700 Subject: [PATCH] Preserve total flux for injected Trail types --- python/lsst/source/injection/inject_engine.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/lsst/source/injection/inject_engine.py b/python/lsst/source/injection/inject_engine.py index d584da1..ac4a153 100644 --- a/python/lsst/source/injection/inject_engine.py +++ b/python/lsst/source/injection/inject_engine.py @@ -290,6 +290,8 @@ def make_galsim_trail( linear_wcs = wcs.linearizePixelToSky(sky_coords, arcseconds) mat = linear_wcs.getMatrix() object = object.transform(mat[0, 0], mat[0, 1], mat[1, 0], mat[1, 1]) + # Rescale flux; transformation preserves surface brightness, not flux. + object *= 1.0 / np.abs(mat[0, 0] * mat[1, 1] - mat[0, 1] * mat[1, 0]) return object # type: ignore