Skip to content

Commit

Permalink
Improve testMatchOptimisticB.py to catch the matching bug that was fi…
Browse files Browse the repository at this point in the history
…xed.
  • Loading branch information
r-owen committed May 13, 2015
1 parent 48ba23c commit 3b3966c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/testMatchOptimisticB.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def testLinearYDistort(self):
self.singleTestInstance(self.filename, distort.linearYDistort)

def testQuadraticDistort(self):
self.singleTestInstance(self.filename, distort.linearYDistort)
self.singleTestInstance(self.filename, distort.quadraticDistort)

def singleTestInstance(self, filename, distortFunc, doPlot=False):
sourceCat = self.loadSourceCatalog(self.filename)
Expand All @@ -105,7 +105,6 @@ def singleTestInstance(self, filename, distortFunc, doPlot=False):

refCoordKey = refCat.schema["coord"].asKey()
srcCoordKey = sourceCat.schema["coord"].asKey()
numErrors = 0
maxDistErr = afwGeom.Angle(0)
for refObj, source, distRad in matches:
sourceCoord = source.get(srcCoordKey)
Expand All @@ -118,11 +117,9 @@ def singleTestInstance(self, filename, distortFunc, doPlot=False):
refCentroid = refObj.get("centroid")
sourceCentroid = source.getCentroid()
radius = math.hypot(*(refCentroid - sourceCentroid))
numErrors += 1
print("%s at %s != %s at %s; error = %0.1f pix" % (refObj.getId(), refCentroid,
source.getId(), sourceCentroid, radius))
print("num match errors=", numErrors)
self.assertLess(numErrors, 3)
self.fail("ID mismatch: %s at %s != %s at %s; error = %0.1f pix" %
(refObj.getId(), refCentroid, source.getId(), sourceCentroid, radius))

self.assertLess(maxDistErr.asArcseconds(), 1e-7)

def computePosRefCatalog(self, sourceCat):
Expand Down

0 comments on commit 3b3966c

Please sign in to comment.