Copied over routines from ptsrc_photom_flt.