Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RingsSkyMap: catch exceptions from wcs #5

Merged
merged 5 commits into from Sep 30, 2016
Merged

Conversation

r-owen
Copy link
Contributor

@r-owen r-owen commented Sep 28, 2016

wcs.skyToPixel can throw an exception if the coordinate is very
far off the image. That just means it isn't the image we're looking
for.

Thanks to Johnny Greco for reporting this bug.

wcs.skyToPixel can throw an exception if the coordinate is very
far off the image. That just means it isn't the image we're looking
for.

Thanks to Johnny Greco for reporting this bug.
TractInfo.findPatch was subject to the problem that if the
coordinate is a long way off the tract, the wcs conversions
will fail.
This makes it consistent with the same pattern elsewhere, and
safer to use because it's more explicit.
pixelInd = afwGeom.Point2I(self.getWcs().skyToPixel(coord.toIcrs()))
try:
pixel = self.getWcs().skyToPixel(coord.toIcrs())
except (lsst.pex.exceptions.DomainError, lsst.pex.exceptions.RuntimeError):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to safely reject coord that are not instances of Coord it might be safer to do this:

icrsCoord = coord.toIcrs()
try:
    pixel = self.getWcs().skyToPixel(icrsCoord)
...

We want to allow any ICRS conversions to bubble up, so they
shouldn't be in the try/except block.
@PaulPrice PaulPrice merged commit 561d4c0 into master Sep 30, 2016
@ktlim ktlim deleted the tickets/DM-7770 branch August 25, 2018 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants