In this issue I'd like to discuss if the current PRF extraction and application method makes sense or whether it can be replaced by an oversampled PSF estimation.
cc @astrofrog @bsipocz @larrybradley @adonath @eteq
Current method
@adonath implemented as part of his GSoC the create_prf function, which creates a DiscretePRF object which is then used via psf_photometry for PSF fitting photometry to estimate source fluxes (and optionally positions). A full example for Spitzer data analysis using this is here.
If I understand correctly the DiscretePRF
class represents the PSF pre-sampled for a 2d grid of sub-pixel positions (i.e. 100 PSF images for an oversampling factor of 10), and the way PRF estimation in create_prf
works is that only stars where the position falls into a given sub-pixel are used in psf_photometry
when fitting data with that PRF.
The problem
The problem with the current approach is that if the number of stars is limited, then there will be subpixels with few or no star to estimate the PSF for that subpixel, resulting in failing or poor psf_photometry
results.
A proposal
How about instead of a function create_prf
that estimates a DiscretePRF
model, we write a create_psf
function that estimates a DiscretePSF
model?
But instead of being a 4-dimensional array like DiscretePRF
of shape (nx, ny, n_subpix, n_subpix)
it's a 2-dimensional array of shape (nx * n_subpix, ny * n_subpix)
, i.e. simply a high-resolution image of the PSF ... if I'm not mistaken that's also the format psfex uses.
create_psf
would re-sample the stars onto this high-resolution image and then psf_photometry
would re-sample the high-resolution PSF image onto the actual data grid or pre-compute a PRF object if that is actually needed for speed.
The big difference would be that the PSF used in psf_photometry
for every star would contain the info from every star available for PSF estimation, thus largely getting rid of the problem described above.
Am I missing something and there's a good use case for the current method that would not be covered by this alternative proposal? If so, can you please point me to a webpage or paper describing why it's better?