def testBuildCandidateListByInsertion(self): """Build a candidate list by inserting candidates""" self.cell = afwMath.SpatialCell("Test", afwGeom.Box2I()) for x, y in ([5, 0], [1, 1], [2, 2], [0, 0], [4, 4], [3, 4]): self.cell.insertCandidate(testLib.TestCandidate(x, y, getFlux(x))) self.assertEqual(self.cell[0].getXCenter(), 0)
def setUp(self): candidateList = afwMath.SpatialCellCandidateList() self.nCandidate = 5 for i in (0, 1, 4, 3, 2): # must be all numbers in range(self.nCandidate) x, y = i, 5*i candidateList.append(testLib.TestCandidate(x, y, getFlux(x))) self.cell = afwMath.SpatialCell("Test", afwGeom.Box2I(), candidateList) self.assertEqual(self.cell.getLabel(), "Test")