Ejemplo n.º 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,
                    f"{cell.getBBox().getMinX():3d},{cell.getBBox().getMinY():3d} -- "
                    f"{cell.getBBox().getMaxX():3d},{cell.getBBox().getMaxY():3d}",
                    cell.getLabel())
        self.assertEqual(len(self.cellSet.getCellList()), 6)

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

        # in cell1
        self.cellSet.insertCandidate(afwMath.TestCandidate(305, 0, 100))
        self.NTestCandidates += 1
        # the top right corner of cell5
        self.cellSet.insertCandidate(afwMath.TestCandidate(500, 500, 100))
        self.NTestCandidates += 1
Ejemplo n.º 2
0
    def testBuildCandidateListByInsertion(self):
        """Build a candidate list by inserting candidates"""

        self.cell = afwMath.SpatialCell("Test", lsst.geom.Box2I())

        for x, y in ([5, 0], [1, 1], [2, 2], [0, 0], [4, 4], [3, 4]):
            self.cell.insertCandidate(afwMath.TestCandidate(x, y, getFlux(x)))

        self.assertEqual(self.cell[0].getXCenter(), 0)
Ejemplo n.º 3
0
    def setUp(self):
        candidateList = []
        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(afwMath.TestCandidate(x, y, getFlux(x)))

        self.cell = afwMath.SpatialCell("Test", afwGeom.Box2I(), candidateList)
        self.assertEqual(self.cell.getLabel(), "Test")
Ejemplo n.º 4
0
 def tst():
     # Doesn't fit
     self.cellSet.insertCandidate(afwMath.TestCandidate(501, 501, 100))