Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion python/lsst/meas/algorithms/maskStreaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def __init__(self, data, weights, line=None, detectionMask=None):
self.mask = (weights != 0)

self._initLine = line
self.modelFailure = False
self.setLineMask(line, maxStreakWidth=0, nSigmaMask=10, detectionMask=detectionMask)

def getLineXY(self, line):
Expand Down Expand Up @@ -227,6 +228,11 @@ def setLineMask(self, line, maxStreakWidth, nSigmaMask, logger=None, detectionMa
# happens when, for example, the streak ends in the middle of
# the image.
lineEnds = self.getLineXY(line)
if lineEnds.size == 0:
if logger is not None:
logger.debug("Calculated line not contained in image bounding box")
self.modelFailure = True
return
xA = lineEnds[0, 0] - self._xmax / 2.
yA = lineEnds[0, 1] - self._ymax / 2.

Expand Down Expand Up @@ -895,7 +901,7 @@ def _fitProfile(self, lines, maskedImage, detectionMask=None):
line.sigma = self.config.invSigma**-1
lineModel = LineProfile(data, weights, line=line, detectionMask=detectionMask)
# Skip any lines that do not cover any data (sometimes happens because of chip gaps)
if lineModel.lineMask.sum() == 0:
if lineModel.modelFailure or lineModel.lineMask.sum() == 0:
continue

fit, fitFailure = lineModel.fit(dChi2Tol=self.config.dChi2Tolerance, log=self.log,
Expand Down