27 import lsst.meas.algorithms
as measAlg
30 import lsst.pipe.base
as pipeBase
33 from .imageMapReduce
import (ImageMapReduceConfig, ImageMapReduceTask,
36 __all__ = (
"DecorrelateALKernelTask",
"DecorrelateALKernelConfig",
37 "DecorrelateALKernelMapper",
"DecorrelateALKernelMapReduceConfig",
38 "DecorrelateALKernelSpatialConfig",
"DecorrelateALKernelSpatialTask")
43 @anchor DecorrelateALKernelConfig_ 45 @brief Configuration parameters for the DecorrelateALKernelTask 48 ignoreMaskPlanes = pexConfig.ListField(
50 doc=
"""Mask planes to ignore for sigma-clipped statistics""",
51 default=(
"INTRP",
"EDGE",
"DETECTED",
"SAT",
"CR",
"BAD",
"NO_DATA",
"DETECTED_NEGATIVE")
64 @anchor DecorrelateALKernelTask_ 66 @brief Decorrelate the effect of convolution by Alard-Lupton matching kernel in image difference 68 @section ip_diffim_imageDecorrelation_DecorrelateALKernelTask_Contents Contents 70 - @ref ip_diffim_imageDecorrelation_DecorrelateALKernelTask_Purpose 71 - @ref ip_diffim_imageDecorrelation_DecorrelateALKernelTask_Config 72 - @ref ip_diffim_imageDecorrelation_DecorrelateALKernelTask_Run 73 - @ref ip_diffim_imageDecorrelation_DecorrelateALKernelTask_Debug 74 - @ref ip_diffim_imDecorr_DecorrALKernelTask_Example 76 @section ip_diffim_imageDecorrelation_DecorrelateALKernelTask_Purpose Description 78 Pipe-task that removes the neighboring-pixel covariance in an 79 image difference that are added when the template image is 80 convolved with the Alard-Lupton PSF matching kernel. 82 The image differencing pipeline task @link 83 ip.diffim.psfMatch.PsfMatchTask PSFMatchTask@endlink and @link 84 ip.diffim.psfMatch.PsfMatchConfigAL PSFMatchConfigAL@endlink uses 85 the Alard and Lupton (1998) method for matching the PSFs of the 86 template and science exposures prior to subtraction. The 87 Alard-Lupton method identifies a matching kernel, which is then 88 (typically) convolved with the template image to perform PSF 89 matching. This convolution has the effect of adding covariance 90 between neighboring pixels in the template image, which is then 91 added to the image difference by subtraction. 93 The pixel covariance may be corrected by whitening the noise of 94 the image difference. This task performs such a decorrelation by 95 computing a decorrelation kernel (based upon the A&L matching 96 kernel and variances in the template and science images) and 97 convolving the image difference with it. This process is described 98 in detail in [DMTN-021](http://dmtn-021.lsst.io). 100 @section ip_diffim_imageDecorrelation_DecorrelateALKernelTask_Initialize Task initialization 102 @copydoc \_\_init\_\_ 104 @section ip_diffim_imageDecorrelation_DecorrelateALKernelTask_Run Invoking the Task 108 @section ip_diffim_imageDecorrelation_DecorrelateALKernelTask_Config Configuration parameters 110 See @ref DecorrelateALKernelConfig 112 @section ip_diffim_imageDecorrelation_DecorrelateALKernelTask_Debug Debug variables 114 This task has no debug variables 116 @section ip_diffim_imDecorr_DecorrALKernelTask_Example Example of using DecorrelateALKernelTask 118 This task has no standalone example, however it is applied as a 119 subtask of pipe.tasks.imageDifference.ImageDifferenceTask. 121 ConfigClass = DecorrelateALKernelConfig
122 _DefaultName =
"ip_diffim_decorrelateALKernel" 125 """! Create the image decorrelation Task 126 @param *args arguments to be passed to lsst.pipe.base.task.Task.__init__ 127 @param **kwargs keyword arguments to be passed to lsst.pipe.base.task.Task.__init__ 129 pipeBase.Task.__init__(self, *args, **kwargs)
134 self.
statsControl.setAndMask(afwImage.Mask.getPlaneBitMask(self.config.ignoreMaskPlanes))
138 exposure.getMaskedImage().getMask(),
140 var = statObj.getValue(afwMath.MEANCLIP)
144 def run(self, exposure, templateExposure, subtractedExposure, psfMatchingKernel,
145 preConvKernel=None, xcen=None, ycen=None, svar=None, tvar=None):
146 """! Perform decorrelation of an image difference exposure. 148 Decorrelates the diffim due to the convolution of the templateExposure with the 149 A&L PSF matching kernel. Currently can accept a spatially varying matching kernel but in 150 this case it simply uses a static kernel from the center of the exposure. The decorrelation 151 is described in [DMTN-021, Equation 1](http://dmtn-021.lsst.io/#equation-1), where 152 `exposure` is I_1; templateExposure is I_2; `subtractedExposure` is D(k); 153 `psfMatchingKernel` is kappa; and svar and tvar are their respective 154 variances (see below). 156 @param[in] exposure the science afwImage.Exposure used for PSF matching 157 @param[in] templateExposure the template afwImage.Exposure used for PSF matching 158 @param[in] subtractedExposure the subtracted exposure produced by 159 `ip_diffim.ImagePsfMatchTask.subtractExposures()` 160 @param[in] psfMatchingKernel an (optionally spatially-varying) PSF matching kernel produced 161 by `ip_diffim.ImagePsfMatchTask.subtractExposures()` 162 @param[in] preConvKernel if not None, then the `exposure` was pre-convolved with this kernel 163 @param[in] xcen X-pixel coordinate to use for computing constant matching kernel to use 164 If `None` (default), then use the center of the image. 165 @param[in] ycen Y-pixel coordinate to use for computing constant matching kernel to use 166 If `None` (default), then use the center of the image. 167 @param[in] svar image variance for science image 168 If `None` (default) then compute the variance over the entire input science image. 169 @param[in] tvar image variance for template image 170 If `None` (default) then compute the variance over the entire input template image. 172 @return a `pipeBase.Struct` containing: 173 * `correctedExposure`: the decorrelated diffim 174 * `correctionKernel`: the decorrelation correction kernel (which may be ignored) 176 @note The `subtractedExposure` is NOT updated 177 @note The returned `correctedExposure` has an updated PSF as well. 178 @note Here we currently convert a spatially-varying matching kernel into a constant kernel, 179 just by computing it at the center of the image (tickets DM-6243, DM-6244). 180 @note We are also using a constant accross-the-image measure of sigma (sqrt(variance)) to compute 181 the decorrelation kernel. 182 @note Still TBD (ticket DM-6580): understand whether the convolution is correctly modifying 183 the variance plane of the new subtractedExposure. 185 spatialKernel = psfMatchingKernel
186 kimg = afwImage.ImageD(spatialKernel.getDimensions())
187 bbox = subtractedExposure.getBBox()
189 xcen = (bbox.getBeginX() + bbox.getEndX()) / 2.
191 ycen = (bbox.getBeginY() + bbox.getEndY()) / 2.
192 self.log.info(
"Using matching kernel computed at (%d, %d)", xcen, ycen)
193 spatialKernel.computeImage(kimg,
True, xcen, ycen)
199 self.log.info(
"Variance (science, template): (%f, %f)", svar, tvar)
204 if np.isnan(svar)
or np.isnan(tvar):
206 if (np.all(np.isnan(exposure.getMaskedImage().getImage().getArray()))
or 207 np.all(np.isnan(templateExposure.getMaskedImage().getImage().getArray()))):
208 self.log.warn(
'Template or science image is entirely NaNs: skipping decorrelation.')
209 outExposure = subtractedExposure.clone()
210 return pipeBase.Struct(correctedExposure=outExposure, correctionKernel=
None)
213 self.log.info(
"Variance (uncorrected diffim): %f", var)
216 if preConvKernel
is not None:
217 self.log.info(
'Using a pre-convolution kernel as part of decorrelation.')
218 kimg2 = afwImage.ImageD(preConvKernel.getDimensions())
219 preConvKernel.computeImage(kimg2,
False)
220 pck = kimg2.getArray()
221 corrKernel = DecorrelateALKernelTask._computeDecorrelationKernel(kimg.getArray(), svar, tvar,
223 correctedExposure, corrKern = DecorrelateALKernelTask._doConvolve(subtractedExposure, corrKernel)
226 psf = subtractedExposure.getPsf().computeKernelImage(afwGeom.Point2D(xcen, ycen)).getArray()
227 psfc = DecorrelateALKernelTask.computeCorrectedDiffimPsf(corrKernel, psf, svar=svar, tvar=tvar)
228 psfcI = afwImage.ImageD(psfc.shape[0], psfc.shape[1])
229 psfcI.getArray()[:, :] = psfc
231 psfNew = measAlg.KernelPsf(psfcK)
232 correctedExposure.setPsf(psfNew)
235 self.log.info(
"Variance (corrected diffim): %f", var)
237 return pipeBase.Struct(correctedExposure=correctedExposure, correctionKernel=corrKern)
240 def _computeDecorrelationKernel(kappa, svar=0.04, tvar=0.04, preConvKernel=None):
241 """! Compute the Lupton decorrelation post-conv. kernel for decorrelating an 242 image difference, based on the PSF-matching kernel. 243 @param kappa A matching kernel 2-d numpy.array derived from Alard & Lupton PSF matching 244 @param svar Average variance of science image used for PSF matching 245 @param tvar Average variance of template image used for PSF matching 246 @param preConvKernel If not None, then pre-filtering was applied 247 to science exposure, and this is the pre-convolution kernel. 248 @return a 2-d numpy.array containing the correction kernel 250 @note As currently implemented, kappa is a static (single, non-spatially-varying) kernel. 255 kappa = DecorrelateALKernelTask._fixOddKernel(kappa)
256 if preConvKernel
is not None:
257 mk = DecorrelateALKernelTask._fixOddKernel(preConvKernel)
259 if kappa.shape[0] < mk.shape[0]:
260 diff = (mk.shape[0] - kappa.shape[0]) // 2
261 kappa = np.pad(kappa, (diff, diff), mode=
'constant')
262 elif kappa.shape[0] > mk.shape[0]:
263 diff = (kappa.shape[0] - mk.shape[0]) // 2
264 mk = np.pad(mk, (diff, diff), mode=
'constant')
266 kft = np.fft.fft2(kappa)
267 kft2 = np.conj(kft) * kft
268 kft2[np.abs(kft2) < MIN_KERNEL] = MIN_KERNEL
269 denom = svar + tvar * kft2
270 if preConvKernel
is not None:
272 mk2 = np.conj(mk) * mk
273 mk2[np.abs(mk2) < MIN_KERNEL] = MIN_KERNEL
274 denom = svar * mk2 + tvar * kft2
275 denom[np.abs(denom) < MIN_KERNEL] = MIN_KERNEL
276 kft = np.sqrt((svar + tvar) / denom)
277 pck = np.fft.ifft2(kft)
278 pck = np.fft.ifftshift(pck.real)
279 fkernel = DecorrelateALKernelTask._fixEvenKernel(pck)
280 if preConvKernel
is not None:
283 fkernel[fkernel > -np.min(fkernel)] = -np.min(fkernel)
288 fkernel = fkernel[::-1, :]
294 """! Compute the (decorrelated) difference image's new PSF. 295 new_psf = psf(k) * sqrt((svar + tvar) / (svar + tvar * kappa_ft(k)**2)) 297 @param kappa A matching kernel array derived from Alard & Lupton PSF matching 298 @param psf The uncorrected psf array of the science image (and also of the diffim) 299 @param svar Average variance of science image used for PSF matching 300 @param tvar Average variance of template image used for PSF matching 301 @return a 2-d numpy.array containing the new PSF 303 def post_conv_psf_ft2(psf, kernel, svar, tvar):
306 if psf.shape[0] < kernel.shape[0]:
307 diff = (kernel.shape[0] - psf.shape[0]) // 2
308 psf = np.pad(psf, (diff, diff), mode=
'constant')
309 elif psf.shape[0] > kernel.shape[0]:
310 diff = (psf.shape[0] - kernel.shape[0]) // 2
311 kernel = np.pad(kernel, (diff, diff), mode=
'constant')
312 psf_ft = np.fft.fft2(psf)
313 kft = np.fft.fft2(kernel)
314 out = psf_ft * np.sqrt((svar + tvar) / (svar + tvar * kft**2))
317 def post_conv_psf(psf, kernel, svar, tvar):
318 kft = post_conv_psf_ft2(psf, kernel, svar, tvar)
319 out = np.fft.ifft2(kft)
322 pcf = post_conv_psf(psf=psf, kernel=kappa, svar=svar, tvar=tvar)
323 pcf = pcf.real / pcf.real.sum()
327 def _fixOddKernel(kernel):
328 """! Take a kernel with odd dimensions and make them even for FFT 330 @param kernel a numpy.array 331 @return a fixed kernel numpy.array. Returns a copy if the dimensions needed to change; 332 otherwise just return the input kernel. 337 if (out.shape[0] % 2) == 1:
338 out = np.pad(out, ((1, 0), (0, 0)), mode=
'constant')
340 if (out.shape[1] % 2) == 1:
341 out = np.pad(out, ((0, 0), (1, 0)), mode=
'constant')
344 out *= (np.mean(kernel) / np.mean(out))
348 def _fixEvenKernel(kernel):
349 """! Take a kernel with even dimensions and make them odd, centered correctly. 350 @param kernel a numpy.array 351 @return a fixed kernel numpy.array 354 maxloc = np.unravel_index(np.argmax(kernel), kernel.shape)
355 out = np.roll(kernel, kernel.shape[0]//2 - maxloc[0], axis=0)
356 out = np.roll(out, out.shape[1]//2 - maxloc[1], axis=1)
358 if (out.shape[0] % 2) == 0:
359 maxloc = np.unravel_index(np.argmax(out), out.shape)
360 if out.shape[0] - maxloc[0] > maxloc[0]:
364 if out.shape[1] - maxloc[1] > maxloc[1]:
371 def _doConvolve(exposure, kernel):
372 """! Convolve an Exposure with a decorrelation convolution kernel. 373 @param exposure Input afw.image.Exposure to be convolved. 374 @param kernel Input 2-d numpy.array to convolve the image with 375 @return a new Exposure with the convolved pixels and the (possibly 378 @note We re-center the kernel if necessary and return the possibly re-centered kernel 380 kernelImg = afwImage.ImageD(kernel.shape[0], kernel.shape[1])
381 kernelImg.getArray()[:, :] = kernel
383 maxloc = np.unravel_index(np.argmax(kernel), kernel.shape)
384 kern.setCtrX(maxloc[0])
385 kern.setCtrY(maxloc[1])
386 outExp = exposure.clone()
388 afwMath.convolve(outExp.getMaskedImage(), exposure.getMaskedImage(), kern, convCntrl)
394 """Task to be used as an ImageMapper for performing 395 A&L decorrelation on subimages on a grid across a A&L difference image. 397 This task subclasses DecorrelateALKernelTask in order to implement 398 all of that task's configuration parameters, as well as its `run` method. 400 ConfigClass = DecorrelateALKernelConfig
401 _DefaultName =
'ip_diffim_decorrelateALKernelMapper' 404 DecorrelateALKernelTask.__init__(self, *args, **kwargs)
406 def run(self, subExposure, expandedSubExposure, fullBBox,
407 template, science, alTaskResult=None, psfMatchingKernel=None,
408 preConvKernel=None, **kwargs):
409 """Perform decorrelation operation on `subExposure`, using 410 `expandedSubExposure` to allow for invalid edge pixels arising from 413 This method performs A&L decorrelation on `subExposure` using 414 local measures for image variances and PSF. `subExposure` is a 415 sub-exposure of the non-decorrelated A&L diffim. It also 416 requires the corresponding sub-exposures of the template 417 (`template`) and science (`science`) exposures. 421 subExposure : lsst.afw.image.Exposure 422 the sub-exposure of the diffim 423 expandedSubExposure : lsst.afw.image.Exposure 424 the expanded sub-exposure upon which to operate 425 fullBBox : afwGeom.BoundingBox 426 the bounding box of the original exposure 427 template : afw.Exposure 428 the corresponding sub-exposure of the template exposure 429 science : afw.Exposure 430 the corresponding sub-exposure of the science exposure 431 alTaskResult : pipeBase.Struct 432 the result of A&L image differencing on `science` and 433 `template`, importantly containing the resulting 434 `psfMatchingKernel`. Can be `None`, only if 435 `psfMatchingKernel` is not `None`. 436 psfMatchingKernel : Alternative parameter for passing the 437 A&L `psfMatchingKernel` directly. 438 preConvKernel : If not None, then pre-filtering was applied 439 to science exposure, and this is the pre-convolution 442 additional keyword arguments propagated from 443 `ImageMapReduceTask.run`. 447 A `pipeBase.Struct` containing: 448 * `subExposure` : the result of the `subExposure` processing. 449 * `decorrelationKernel` : the decorrelation kernel, currently 454 This `run` method accepts parameters identical to those of 455 `ImageMapper.run`, since it is called from the 456 `ImageMapperTask`. See that class for more information. 458 templateExposure = template
459 scienceExposure = science
460 if alTaskResult
is None and psfMatchingKernel
is None:
461 raise RuntimeError(
'Both alTaskResult and psfMatchingKernel cannot be None')
462 psfMatchingKernel = alTaskResult.psfMatchingKernel
if alTaskResult
is not None else psfMatchingKernel
466 subExp2 = scienceExposure.Factory(scienceExposure, expandedSubExposure.getBBox())
467 subExp1 = templateExposure.Factory(templateExposure, expandedSubExposure.getBBox())
470 logLevel = self.log.getLevel()
471 self.log.setLevel(lsst.log.WARN)
472 res = DecorrelateALKernelTask.run(self, subExp2, subExp1, expandedSubExposure,
473 psfMatchingKernel, preConvKernel)
474 self.log.setLevel(logLevel)
476 diffim = res.correctedExposure.Factory(res.correctedExposure, subExposure.getBBox())
477 out = pipeBase.Struct(subExposure=diffim, decorrelationKernel=res.correctionKernel)
482 """Configuration parameters for the ImageMapReduceTask to direct it to use 483 DecorrelateALKernelMapper as its mapper for A&L decorrelation. 485 mapper = pexConfig.ConfigurableField(
486 doc=
'A&L decorrelation task to run on each sub-image',
487 target=DecorrelateALKernelMapper
501 """Configuration parameters for the DecorrelateALKernelSpatialTask. 503 decorrelateConfig = pexConfig.ConfigField(
504 dtype=DecorrelateALKernelConfig,
505 doc=
'DecorrelateALKernel config to use when running on complete exposure (non spatially-varying)',
508 decorrelateMapReduceConfig = pexConfig.ConfigField(
509 dtype=DecorrelateALKernelMapReduceConfig,
510 doc=
'DecorrelateALKernelMapReduce config to use when running on each sub-image (spatially-varying)',
513 ignoreMaskPlanes = pexConfig.ListField(
515 doc=
"""Mask planes to ignore for sigma-clipped statistics""",
516 default=(
"INTRP",
"EDGE",
"DETECTED",
"SAT",
"CR",
"BAD",
"NO_DATA",
"DETECTED_NEGATIVE")
528 @anchor DecorrelateALKernelSpatialTask_ 530 @brief Decorrelate the effect of convolution by Alard-Lupton matching kernel in image difference 532 @section ip_diffim_imageDecorrelation_DecorrelateALKernelSpatialTask_Contents Contents 534 - @ref ip_diffim_imageDecorrelation_DecorrelateALKernelSpatialTask_Purpose 535 - @ref ip_diffim_imageDecorrelation_DecorrelateALKernelSpatialTask_Config 536 - @ref ip_diffim_imageDecorrelation_DecorrelateALKernelSpatialTask_Run 537 - @ref ip_diffim_imageDecorrelation_DecorrelateALKernelSpatialTask_Debug 538 - @ref ip_diffim_imDecorr_DecorrALKerSpatTask_Example 540 @section ip_diffim_imageDecorrelation_DecorrelateALKernelSpatialTask_Purpose Description 542 Pipe-task that removes the neighboring-pixel covariance in an 543 image difference that are added when the template image is 544 convolved with the Alard-Lupton PSF matching kernel. 546 This task is a simple wrapper around @ref DecorrelateALKernelTask, 547 which takes a `spatiallyVarying` parameter in its `run` method. If 548 it is `False`, then it simply calls the `run` method of @ref 549 DecorrelateALKernelTask. If it is True, then it uses the @ref 550 ImageMapReduceTask framework to break the exposures into 551 subExposures on a grid, and performs the `run` method of @ref 552 DecorrelateALKernelTask on each subExposure. This enables it to 553 account for spatially-varying PSFs and noise in the exposures when 554 performing the decorrelation. 556 @section ip_diffim_imageDecorrelation_DecorrelateALKernelSpatialTask_Initialize Task initialization 558 @copydoc \_\_init\_\_ 560 @section ip_diffim_imageDecorrelation_DecorrelateALKernelSpatialTask_Run Invoking the Task 564 @section ip_diffim_imageDecorrelation_DecorrelateALKernelSpatialTask_Config Configuration parameters 566 See @ref DecorrelateALKernelSpatialConfig 568 @section ip_diffim_imageDecorrelation_DecorrelateALKernelSpatialTask_Debug Debug variables 570 This task has no debug variables 572 @section ip_diffim_imDecorr_DecorrALKerSpatTask_Example Example of using DecorrelateALKernelSpatialTask 574 This task has no standalone example, however it is applied as a 575 subtask of pipe.tasks.imageDifference.ImageDifferenceTask. 576 There is also an example of its use in `tests/testImageDecorrelation.py`. 578 ConfigClass = DecorrelateALKernelSpatialConfig
579 _DefaultName =
"ip_diffim_decorrelateALKernelSpatial" 582 """Create the image decorrelation Task 587 arguments to be passed to 588 `lsst.pipe.base.task.Task.__init__` 590 additional keyword arguments to be passed to 591 `lsst.pipe.base.task.Task.__init__` 593 pipeBase.Task.__init__(self, *args, **kwargs)
598 self.
statsControl.setAndMask(afwImage.Mask.getPlaneBitMask(self.config.ignoreMaskPlanes))
601 """Compute the mean of the variance plane of `exposure`. 604 exposure.getMaskedImage().getMask(),
606 var = statObj.getValue(afwMath.MEANCLIP)
609 def run(self, scienceExposure, templateExposure, subtractedExposure, psfMatchingKernel,
610 spatiallyVarying=True, preConvKernel=None):
611 """! Perform decorrelation of an image difference exposure. 613 Decorrelates the diffim due to the convolution of the 614 templateExposure with the A&L psfMatchingKernel. If 615 `spatiallyVarying` is True, it utilizes the spatially varying 616 matching kernel via the `imageMapReduce` framework to perform 617 spatially-varying decorrelation on a grid of subExposures. 621 scienceExposure : lsst.afw.image.Exposure 622 the science Exposure used for PSF matching 623 templateExposure : lsst.afw.image.Exposure 624 the template Exposure used for PSF matching 625 subtractedExposure : lsst.afw.image.Exposure 626 the subtracted Exposure produced by `ip_diffim.ImagePsfMatchTask.subtractExposures()` 628 an (optionally spatially-varying) PSF matching kernel produced 629 by `ip_diffim.ImagePsfMatchTask.subtractExposures()` 630 spatiallyVarying : bool 631 if True, perform the spatially-varying operation 632 preConvKernel : lsst.meas.algorithms.Psf 633 if not none, the scienceExposure has been pre-filtered with this kernel. (Currently 634 this option is experimental.) 638 a `pipeBase.Struct` containing: 639 * `correctedExposure`: the decorrelated diffim 641 self.log.info(
'Running A&L decorrelation: spatiallyVarying=%r' % spatiallyVarying)
645 if np.isnan(svar)
or np.isnan(tvar):
647 if (np.all(np.isnan(scienceExposure.getMaskedImage().getImage().getArray()))
or 648 np.all(np.isnan(templateExposure.getMaskedImage().getImage().getArray()))):
649 self.log.warn(
'Template or science image is entirely NaNs: skipping decorrelation.')
658 self.log.info(
"Variance (science, template): (%f, %f)", svar, tvar)
659 self.log.info(
"Variance (uncorrected diffim): %f", var)
660 config = self.config.decorrelateMapReduceConfig
662 results = task.run(subtractedExposure, science=scienceExposure,
663 template=templateExposure, psfMatchingKernel=psfMatchingKernel,
664 preConvKernel=preConvKernel, forceEvenSized=
True)
665 results.correctedExposure = results.exposure
669 return exp.getMaskedImage().getMask()
670 gm(results.correctedExposure)[:, :] = gm(subtractedExposure)
673 self.log.info(
"Variance (corrected diffim): %f", var)
676 config = self.config.decorrelateConfig
678 results = task.run(scienceExposure, templateExposure,
679 subtractedExposure, psfMatchingKernel, preConvKernel=preConvKernel)
def run(self, scienceExposure, templateExposure, subtractedExposure, psfMatchingKernel, spatiallyVarying=True, preConvKernel=None)
Perform decorrelation of an image difference exposure.
def __init__(self, args, kwargs)
def run(self, exposure, templateExposure, subtractedExposure, psfMatchingKernel, preConvKernel=None, xcen=None, ycen=None, svar=None, tvar=None)
Perform decorrelation of an image difference exposure.
def __init__(self, args, kwargs)
Statistics makeStatistics(lsst::afw::math::MaskedVector< EntryT > const &mv, std::vector< WeightPixel > const &vweights, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Decorrelate the effect of convolution by Alard-Lupton matching kernel in image difference.
def computeVarianceMean(self, exposure)
def computeCorrectedDiffimPsf(kappa, psf, svar=0.04, tvar=0.04)
Compute the (decorrelated) difference image's new PSF.
Decorrelate the effect of convolution by Alard-Lupton matching kernel in image difference.
def __init__(self, args, kwargs)
Create the image decorrelation Task.
decorrelateMapReduceConfig
def computeVarianceMean(self, exposure)
void convolve(OutImageT &convolvedImage, InImageT const &inImage, KernelT const &kernel, bool doNormalize, bool doCopyEdge=false)
def run(self, subExposure, expandedSubExposure, fullBBox, template, science, alTaskResult=None, psfMatchingKernel=None, preConvKernel=None, kwargs)
Configuration parameters for the DecorrelateALKernelTask.