Currently we PSF-match then warp when making PSF-matched coadds. In the case where the output projection is simply a rotation, translation or scaling (circularly symmetric) this is OK if matching to a symmetric model. But for the general case of any affine transform, warping after PSF-matching will undo the PSF-matching. Also, currently we cannot make PSF-matched co-adds with calexps which were processed with PsfexPsf because ModelPsfMatchTask requires that the input PSF be a KernelPsf. => we can make PSF-matched co-adds for SDSS which uses PcaPSF by default but not HSC which uses Psfex by default. (PcaPsf inherits from KernelPsf, and PsfexPsf inherits from ImagePsf.)
This ticket will make the appropriate changes to WarpPsf, ModelPsfMatchTask and WarpAndPsfMatchTask, to make PSF-matching warpedPSFs and PsfexPSFs possible and swap the order of operations. Some emergent considerations for warping first:
1) Warping first shrinks area on which to model the PSF. Need to pad by the spatial cell size.
2) Warped PSF is currently not guaranteed to be: square, the same size for each image, or the same size across one image. The PSF matcher requires that the model PSF and the science PSF be the same dimensions. Make minimal changes to WarpedPsf to produce square PSFs and PSFs of constant dimensions across the image. Push (modelPsf = self.config.modelPsf.apply() if self.config.doPsfMatch else None) down a level to adapt to the WarpedPSF size rather than be specified by the user. This requires that PSFs have cheap method revealing their dimensions.
3) Spatial Variation. Currently, a WarpedPsf is an ImagePsf but is not a KernelPsf.
This ticket will include testing. Not in the scope of this ticket is testing and improvement of the performance of the PSF modeling and matching.