-
Notifications
You must be signed in to change notification settings - Fork 21
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
DM-10973: Make SkyWcs transform to IcrsCoord instead of SpherePoint #247
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,8 @@ | |
|
||
import warnings | ||
|
||
import numpy as np | ||
|
||
import lsst.utils.tests | ||
import lsst.afw.geom as afwGeom | ||
|
||
|
@@ -54,6 +56,31 @@ def assertCoordsAlmostEqual(testCase, coord0, coord1, maxDiff=0.001*afwGeom.arcs | |
(msg, measDiff.asArcseconds(), maxDiff.asArcseconds())) | ||
|
||
|
||
@lsst.utils.tests.inTestCase | ||
def assertCoordListsAlmostEqual(testCase, coordlist0, coordlist1, maxDiff=0.001*afwGeom.arcseconds, msg=None): | ||
"""!Assert that two lists of IcrsCoords represent almost the same point on the sky | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the exclamation mark? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So Doxygen recognizes it as Doxygen documentation |
||
|
||
@warning the coordinate systems are not compared; instead both sets of angles are converted to ICRS | ||
and the angular separation measured. | ||
|
||
@param[in] testCase unittest.TestCase instance the test is part of; | ||
an object supporting one method: fail(self, msgStr) | ||
@param[in] coordlist0 list of IcrsCoords 0 | ||
@param[in] coordlist1 list of IcrsCoords 1 | ||
@param[in] maxDiff maximum angular separation, an lsst.afw.geom.Angle | ||
@param[in] msg exception message prefix; details of the error are appended after ": " | ||
""" | ||
testCase.assertEqual(len(coordlist0), len(coordlist1), msg=msg) | ||
sepArr = np.array([sp0.toIcrs().angularSeparation(sp1.toIcrs()) | ||
for sp0, sp1 in zip(coordlist0, coordlist1)]) | ||
badArr = sepArr > maxDiff | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume angularSeparation is defined to be always positive. Probably is, but just checking. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||
if np.any(badArr): | ||
maxInd = np.argmax(sepArr) | ||
testCase.fail("%s: IcrsCoordLists differ in %s places; max separation is at %s: %s\" > %s\"%s" % | ||
(msg, np.sum(badArr), maxInd, sepArr[maxInd].asArcseconds(), | ||
maxDiff.asArcseconds())) | ||
|
||
|
||
@lsst.utils.tests.inTestCase | ||
def assertCoordsNearlyEqual(*args, **kwargs): | ||
warnings.warn("Deprecated. Use assertCoordsAlmostEqual", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
Array::size
private? Otherwise this seems like a pretty pointless (and confusing) function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because for
GenericEndpoint.getNPoints
Array is a 2-dimensional ndarray and so can't usesize