Assert that two lists of IcrsCoords represent almost the same point on the sky.
61 """!Assert that two lists of IcrsCoords represent almost the same point on the sky 63 @warning the coordinate systems are not compared; instead both sets of angles are converted to ICRS 64 and the angular separation measured. 66 @param[in] testCase unittest.TestCase instance the test is part of; 67 an object supporting one method: fail(self, msgStr) 68 @param[in] coordlist0 list of IcrsCoords 0 69 @param[in] coordlist1 list of IcrsCoords 1 70 @param[in] maxDiff maximum angular separation, an lsst.afw.geom.Angle 71 @param[in] msg exception message prefix; details of the error are appended after ": " 73 testCase.assertEqual(len(coordlist0), len(coordlist1), msg=msg)
74 sepArr = np.array([sp0.toIcrs().angularSeparation(sp1.toIcrs())
75 for sp0, sp1
in zip(coordlist0, coordlist1)])
76 badArr = sepArr > maxDiff
78 msg =
"" if msg
is None else msg +
": " 79 maxInd = np.argmax(sepArr)
80 testCase.fail(
"%sIcrsCoordLists differ in %s places; max separation is at %s: %s\" > %s\"" %
81 (msg, np.sum(badArr), maxInd, sepArr[maxInd].asArcseconds(),
82 maxDiff.asArcseconds()))
85 @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.