665 preConvKernel=None, **kwargs):
666 """Perform decorrelation operation on `subExposure`, using
667 `expandedSubExposure` to allow for invalid edge pixels arising from
668 convolutions.
669
670 This method performs A&L decorrelation on `subExposure` using
671 local measures for image variances and PSF. `subExposure` is a
672 sub-exposure of the non-decorrelated A&L diffim. It also
673 requires the corresponding sub-exposures of the template
674 (`template`) and science (`science`) exposures.
675
676 Parameters
677 ----------
678 subExposure : `lsst.afw.image.Exposure`
679 the sub-exposure of the diffim
680 expandedSubExposure : `lsst.afw.image.Exposure`
681 the expanded sub-exposure upon which to operate
682 fullBBox : `lsst.geom.Box2I`
683 the bounding box of the original exposure
684 template : `lsst.afw.image.Exposure`
685 the corresponding sub-exposure of the template exposure
686 science : `lsst.afw.image.Exposure`
687 the corresponding sub-exposure of the science exposure
688 alTaskResult : `lsst.pipe.base.Struct`
689 the result of A&L image differencing on `science` and
690 `template`, importantly containing the resulting
691 `psfMatchingKernel`. Can be `None`, only if
692 `psfMatchingKernel` is not `None`.
693 psfMatchingKernel : Alternative parameter for passing the
694 A&L `psfMatchingKernel` directly.
695 preConvKernel : If not None, then pre-filtering was applied
696 to science exposure, and this is the pre-convolution
697 kernel.
698 kwargs :
699 additional keyword arguments propagated from
700 `ImageMapReduceTask.run`.
701
702 Returns
703 -------
704 A `pipeBase.Struct` containing:
705
706 - ``subExposure`` : the result of the `subExposure` processing.
707 - ``decorrelationKernel`` : the decorrelation kernel, currently
708 not used.
709
710 Notes
711 -----
712 This `run` method accepts parameters identical to those of
713 `ImageMapper.run`, since it is called from the
714 `ImageMapperTask`. See that class for more information.
715 """
716 templateExposure = template
717 scienceExposure = science
718 if alTaskResult is None and psfMatchingKernel is None:
719 raise RuntimeError('Both alTaskResult and psfMatchingKernel cannot be None')
720 psfMatchingKernel = alTaskResult.psfMatchingKernel if alTaskResult is not None else psfMatchingKernel
721
722
723
724 subExp2 = scienceExposure.Factory(scienceExposure, expandedSubExposure.getBBox())
725 subExp1 = templateExposure.Factory(templateExposure, expandedSubExposure.getBBox())
726
727
728 logLevel = self.log.level
729 self.log.setLevel(self.log.WARNING)
730 res = DecorrelateALKernelTask.run(self, subExp2, subExp1, expandedSubExposure,
731 psfMatchingKernel, preConvKernel, **kwargs)
732 self.log.setLevel(logLevel)
733
734 diffim = res.correctedExposure.Factory(res.correctedExposure, subExposure.getBBox())
735 out = pipeBase.Struct(subExposure=diffim, )
736 return out
737
738