The code in this ticket adds doScaleTemplateVariance config option to ImageDifferenceTask. If enabled, ScaleVarianceTask is invoked in ImageDifferenceTask to rescale the template before PSF matching and subtraction. The resulting rescaling factor is saved as metadata entry scaleTemplateVarianceFactor.
Also, full module API document generation is now enabled for ScaleVarianceTask.
Note, this implementation adjusts the template variance at the ImageDifferenceTask level, after the template is created as an Exposure from the coadd patches, covering the same sky area as the science image (plus some margin). This is before the Warper resamples the template onto exactly the same pixel grid as the science Exposure. The resampling may involve scale change. If we want the variance correction after this step, then this configuration option should be introduced independently into both the AL and ZOGY subtasks.
There are logs attached of a HiTS2015 test run (visit=412060, ccd=25), which actually down scales the template variance and increases the number of detections by about 1% here.