Beispiel #1
0
    def makeTestCandidateCellSet(self):
        """Populate a SpatialCellSet"""

        if False:  # Print the bboxes for the cells
            print()
            for i in range(len(self.cellSet.getCellList())):
                cell = self.cellSet.getCellList()[i]
                print(
                    i, "%3d,%3d -- %3d,%3d" %
                    (cell.getBBox().getMinX(), cell.getBBox().getMinY(),
                     cell.getBBox().getMaxX(), cell.getBBox().getMaxY()),
                    cell.getLabel())
        self.assertEqual(len(self.cellSet.getCellList()), 6)

        self.NTestCandidates = 0  # number of candidates
        for x, y in ([5, 0], [1, 1], [2, 2], [0, 0], [4,
                                                      4], [3,
                                                           4]):  # all in cell0
            self.cellSet.insertCandidate(testLib.TestCandidate(x, y, -x))
            self.NTestCandidates += 1

        self.cellSet.insertCandidate(testLib.TestCandidate(305, 0,
                                                           100))  # in cell1
        self.NTestCandidates += 1
        self.cellSet.insertCandidate(testLib.TestCandidate(
            500, 500, 100))  # the top right corner of cell5
        self.NTestCandidates += 1
Beispiel #2
0
    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)
Beispiel #3
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")
Beispiel #4
0
 def tst():
     self.cellSet.insertCandidate(testLib.TestCandidate(
         501, 501, 100))  # Doesn't fit