I would like to use Galsim
to simulate a set of galaxies convolved by PSFs.
The galaxies are simple double sersic profiles that I create using the Sersic
class from galsim (and then Shear to introduce some ellipticity).
The PSFs I'like to use are pixellised images computed from Zemax or CodeV ray-tracing simulations. They have been computed on a grid corresponding to the detector surface. This surface is tilted wrt the chiefray so these PSFs already include the WCS distorsion of the detector tilt.
I would like to compute the PSF-convolved galaxies on the detector surface. A possible way would be :
- to load the psf
psf = galsim.InterpolatedImage(galsim.Image(psf))
- then convolve by the galaxy :
gal = galsim.Convolve(psf, gal)
- then draw on the detector surface (with the tilt in the local_wcs):
gal_image = gal.drawImage(wcs=local_wcs)
I think that I am doing a mistake with the PSF beeing affected twice by the disrtorsion (the original tilt in the Zemax PSF + the local_wcs of the drwImage method). Are my worries correct ?
Shall I apply the local_wcs distortion to the original unconvolved galaxy (by applying a shear corresponding to the local_wcs) and then convolve by the psf and draw it on a non distorted wcs ? Would this correctly take in account the fact that my PSF is already distorted by the detector tilt ?