Jim Bosch: do you think you would be able to review this? I extracted the code that incorporated the model uncertainty from DM-14574, to make the reviews less onerous; some of the preparatory code for that is still in this ticket, because I couldn't separate the cleanups from the actual fixes.
The bug in the photometry uncertainty calculation that I thought I'd found turns out not to exist (both the simple and constrained models end up with the flux and fluxErr calculations taking exactly the same form). Instead, I added the model uncertainty, which we should be including as part of the chi2. It doesn't shift the test calculations much, and it doesn't seem to help the HSC PDR1 data, but we might as well get it right.
The work for this was done on
DM-14574, but I've rebased it over to here to make the review of this and that easier.