Skip to content

Commit

Permalink
TractInfo: move ICRS conversion out of try/except
Browse files Browse the repository at this point in the history
We want to allow any ICRS conversions to bubble up, so they
shouldn't be in the try/except block.
  • Loading branch information
PaulPrice committed Sep 30, 2016
1 parent 8f06875 commit 561d4c0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/lsst/skymap/tractInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ def findPatch(self, coord):
@note This routine will be more efficient if coord is ICRS.
"""
icrsCoord = coord.toIcrs()
try:
pixel = self.getWcs().skyToPixel(coord.toIcrs())
pixel = self.getWcs().skyToPixel(icrsCoord)
except (lsst.pex.exceptions.DomainError, lsst.pex.exceptions.RuntimeError):
# Point must be way off the tract
raise LookupError("Unable to determine pixel position for coordinate %s" % (coord,))
Expand All @@ -187,8 +188,9 @@ def findPatchList(self, coordList):
"""
box2D = afwGeom.Box2D()
for coord in coordList:
icrsCoord = coord.toIcrs()
try:
pixelPos = self.getWcs().skyToPixel(coord.toIcrs())
pixelPos = self.getWcs().skyToPixel(icrsCoord)
except (lsst.pex.exceptions.DomainError, lsst.pex.exceptions.RuntimeError):
# the point is so far off the tract that its pixel position cannot be computed
continue
Expand Down Expand Up @@ -311,8 +313,9 @@ def __getitem__(self, index):

def contains(self, coord):
"""Does this tract contain the coordinate?"""
icrsCoord = coord.toIcrs()
try:
pixels = self.getWcs().skyToPixel(coord.toIcrs())
pixels = self.getWcs().skyToPixel(icrsCoord)
except (lsst.pex.exceptions.DomainError, lsst.pex.exceptions.RuntimeError):
# Point must be way off the tract
return False
Expand Down

0 comments on commit 561d4c0

Please sign in to comment.