SourceDetectionTask has long returned a Struct containing, among other elements, a background that is a lsst.afw.math.BackgroundMI from the "re-estimate background" component of detection.
DM-12995 introduced DynamicDetectionTask (a sub-class of SourceDetectionTask) which modifies the detection threshold using forced photometry of sky objects, but neglected to use these sky objects to modify the background level. To remedy this, DM-13741 introduces a second background modification in the source detection process, but that needs to propagate out to the user (for capture and eventual persistence). I propose that this should be done by modifying the background returned from the SourceDetectionTask to be a list of backgrounds (as a lsst.afw.math.BackgroundList.
An alternative involving no change to the existing API would be to add another BackgroundMI to the output Struct just for the second background modification. However, this would require that the user know to look for the additional output, which is contrary to the principle of being able to arbitrarily retarget the detection task; it also makes the gathering of the multiple backgrounds a bit more complicated.
As far as I can see, our use of this interface is confined to CalibrateTask, CharacterizeImageTask and DetectCoaddSourcesTask, and those are easily updated.
A proposed implementation is available on
DM-13741 for those interested. I'm currently testing it.