Details
-
Type:
Bug
-
Status: To Do
-
Resolution: Unresolved
-
Fix Version/s: None
-
Component/s: pipe_tasks
-
Labels:
-
Team:Alert Production
-
Urgent?:No
Description
doDecorrelation defaults to True, and we've been trying some tests with setting useScoreImageDetection to true as well. The problem seems to arise from this section starting on line 972:
if self.config.doDecorrelation and self.config.doSubtract: |
preConvKernel = None
|
if self.config.useGaussianForPreConvolution: |
preConvKernel = preConvPsf.getLocalKernel()
|
if self.config.useScoreImageDetection: |
scoreExposure = self.decorrelate.run(exposureOrig,
|
subtractRes.warpedExposure,
|
scoreExposure,
|
subtractRes.psfMatchingKernel,
|
spatiallyVarying=self.config.doSpatiallyVarying,
|
preConvKernel=preConvKernel,
|
templateMatched=True,
|
preConvMode=True).correctedExposure
|
|
# Note that the subtracted exposure is always decorrelated, # even if the score image is used for detection |
subtractedExposure = self.decorrelate.run(exposureOrig,
|
subtractRes.warpedExposure,
|
subtractedExposure,
|
subtractRes.psfMatchingKernel,
|
spatiallyVarying=self.config.doSpatiallyVarying,
|
preConvKernel=None,
|
templateMatched=self.config.convolveTemplate,
|
preConvMode=False).correctedExposure
|
Note that the subtractedExposure = self.decorrelate.run(... line is not part of an elif or else related to the if self.config.useScoreImageDetection; it runs either way. However, that causes a problem later when it turns out the subtractedExposure can initially be None when useScoreImage is true. Look starting at line 952:
if self.config.useScoreImageDetection: |
scoreExposure = subtractRes.subtractedExposure
|
else: |
subtractedExposure = subtractRes.subtractedExposure
|
So subtractedExposure is only set if useScoreImageDetection is false. Then the problem happens because when you try to pass it as an argument in
subtractedExposure = self.decorrelate.run(exposureOrig, subtractRes.warpedExposure,
|
subtractedExposure, ...)
|
It's getting passed in as None. I think we didn't notice this in earlier tests because doDecorrelation was false when I tried this about a month ago, so then you don't hit that first block I mentioned.
Just for completeness, here is the pipetask error:
File "/project/kherner/PREOPS-598_reprocSprint/pipe_tasks/python/lsst/pipe/tasks/imageDifference.py", line 986, in run
|
subtractedExposure = self.decorrelate.run(exposureOrig, subtractRes.warpedExposure,
|
File "/software/lsstsw/stack_20220125/stack/miniconda3-py38_4.9.2-1.0.0/Linux64/ip_diffim/g5706f010af+628387ea21/python/lsst/ip/diffim/imageDecorrelation.py", line 894, in run
|
var = self.computeVarianceMean(subtractedExposure)
|
File "/software/lsstsw/stack_20220125/stack/miniconda3-py38_4.9.2-1.0.0/Linux64/ip_diffim/g5706f010af+628387ea21/python/lsst/ip/diffim/imageDecorrelation.py", line 837, in computeVarianceMean
|
statObj = afwMath.makeStatistics(exposure.getMaskedImage().getVariance(),
|
AttributeError: 'NoneType' object has no attribute 'getMaskedImage'
|
There are several ways out of this, but we should figure out what we really want to do in this case.