Skip to content

Commit

Permalink
Merge branch 'tickets/DM-26067'
Browse files Browse the repository at this point in the history
  • Loading branch information
plazas committed Jul 23, 2020
2 parents 5e0f401 + f99012f commit 20dd8cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions python/lsst/cp/pipe/ptc.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,9 @@ def runDataRef(self, dataRef, visitPairs):
doRealSpace = self.config.covAstierRealSpace
muDiff, varDiff, covAstier = self.measureMeanVarCov(exp1, exp2, region=amp.getBBox(),
covAstierRealSpace=doRealSpace)
if np.isnan(muDiff) or np.isnan(varDiff) or np.isnan(covAstier):
msg = f"NaN mean or cov in amp {ampNumber} in visit pair {v1}, {v2} of detector {detNum}."
if np.isnan(muDiff) or np.isnan(varDiff) or (covAstier is None):
msg = (f"NaN mean or var, or None cov in amp {ampNumber} in visit pair {v1}, {v2} "
"of detector {detNum}.")
self.log.warn(msg)
nAmpsNan += 1
continue
Expand Down Expand Up @@ -632,7 +633,7 @@ def measureMeanVarCov(self, exposure1, exposure2, region=None, covAstierRealSpac
mu1 = afwMath.makeStatistics(im1Area, afwMath.MEANCLIP, im1StatsCtrl).getValue()
mu2 = afwMath.makeStatistics(im2Area, afwMath.MEANCLIP, im2StatsCtrl).getValue()
if np.isnan(mu1) or np.isnan(mu2):
return np.nan, np.nan, np.nan
return np.nan, np.nan, None
mu = 0.5*(mu1 + mu2)

# Take difference of pairs
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ptc.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def test_meanVarMeasurementAllNan(self):

self.assertTrue(np.isnan(mu))
self.assertTrue(np.isnan(varDiff))
self.assertTrue(np.isnan(covDiff))
self.assertTrue(covDiff is None)

def test_getInitialGoodPoints(self):
xs = [1, 2, 3, 4, 5, 6]
Expand Down

0 comments on commit 20dd8cc

Please sign in to comment.