示例#1
0
class HscRingsTestCase(lsst.utils.tests.TestCase):
    def setUp(self):
        # This matches the HSC SSP configuration, on which the problem was discovered
        config = RingsSkyMap.ConfigClass()
        config.numRings = 120
        config.projection = "TAN"
        config.tractOverlap = 1.0 / 60  # Overlap between tracts (degrees)
        config.pixelScale = 0.168
        self.skymap = RingsSkyMap(config)

    def tearDown(self):
        del self.skymap

    def testDm7770(self):
        """Test that DM-7770 has been fixed

        These operations previously caused:
            lsst::pex::exceptions::RuntimeError: 'Error: wcslib
            returned a status code of 9 at sky 30.18, -3.8 deg:
            One or more of the world coordinates were invalid'

        We are only testing function, and not the actual results.
        """
        coordList = [
            lsst.afw.geom.SpherePoint(ra, dec, lsst.afw.geom.degrees)
            for ra, dec in [(30.18, -3.8), (31.3, -3.8), (31.3,
                                                          -2.7), (30.18, -2.7)]
        ]
        for coord in coordList:
            self.skymap.findAllTracts(coord)
        self.skymap.findTractPatchList(coordList)
示例#2
0
class HscRingsTestCase(lsst.utils.tests.TestCase):
    def getConfig(self):
        """Return a configuration matching that used for the HSC SSP"""
        config = RingsSkyMap.ConfigClass()
        config.numRings = 120
        config.projection = "TAN"
        config.tractOverlap = 1.0/60  # Overlap between tracts (degrees)
        config.pixelScale = 0.168
        return config

    def setUp(self):
        self.skymap = RingsSkyMap(self.getConfig())

    def tearDown(self):
        del self.skymap

    def testDm7770(self):
        """Test that DM-7770 has been fixed

        These operations previously caused:
            lsst::pex::exceptions::RuntimeError: 'Error: wcslib
            returned a status code of 9 at sky 30.18, -3.8 deg:
            One or more of the world coordinates were invalid'

        We are only testing function, and not the actual results.
        """
        coordList = [lsst.afw.geom.SpherePoint(ra, dec, lsst.afw.geom.degrees) for
                     ra, dec in [(30.18, -3.8), (31.3, -3.8), (31.3, -2.7), (30.18, -2.7)]]
        for coord in coordList:
            self.skymap.findAllTracts(coord)
        self.skymap.findTractPatchList(coordList)

    def testDm14809(self):
        """Test that DM-14809 has been fixed"""
        skyMapTestCase.checkDm14809(self, self.skymap)

        # Check that the first tract in the last ring exists
        coord = self.getFirstTractLastRingCoord()
        tract = self.skymap.findTract(coord)
        self.assertTrue(tract.contains(coord))

    def testWraparound(self):
        """Check wrapping at RA=0

        How-to-reproduce of a bug identified by Sogo Mineo.
        """
        tractId = 9712
        deviation = 10 / 3600.0  # 10 arcsec
        tract = self.skymap[tractId]
        center = tract.getCtrCoord()
        centerRa = center.getRa().asDegrees()
        centerDec = center.getDec().asDegrees()
        for devRa in [-deviation, deviation]:
            coord = lsst.afw.geom.SpherePoint(centerRa + devRa, centerDec, lsst.afw.geom.degrees)
            foundTractId = self.skymap.findTract(coord).getId()
            self.assertEqual(tractId, foundTractId)

    def getFirstTractLastRingCoord(self):
        """Return the coordinates of the first tract in the last ring

        This tract is missing in version=0, but this is fixed in version=1.in
        """
        ringNum = self.skymap.config.numRings - 1
        ringSize = math.pi/(self.skymap.config.numRings + 1)
        firstRingStart = ringSize*0.5 - 0.5*math.pi
        dec = ringNum*ringSize + firstRingStart
        return lsst.afw.geom.SpherePoint(self.skymap.config.raStart*lsst.afw.geom.degrees,
                                         dec*lsst.afw.geom.radians)
class HscRingsTestCase(lsst.utils.tests.TestCase):
    def getConfig(self):
        """Return a configuration matching that used for the HSC SSP"""
        config = RingsSkyMap.ConfigClass()
        config.numRings = 120
        config.projection = "TAN"
        config.tractOverlap = 1.0/60  # Overlap between tracts (degrees)
        config.pixelScale = 0.168
        return config

    def setUp(self):
        self.skymap = RingsSkyMap(self.getConfig())

    def tearDown(self):
        del self.skymap

    def testDm7770(self):
        """Test that DM-7770 has been fixed

        These operations previously caused:
            lsst::pex::exceptions::RuntimeError: 'Error: wcslib
            returned a status code of 9 at sky 30.18, -3.8 deg:
            One or more of the world coordinates were invalid'

        We are only testing function, and not the actual results.
        """
        coordList = [lsst.geom.SpherePoint(ra, dec, lsst.geom.degrees) for
                     ra, dec in [(30.18, -3.8), (31.3, -3.8), (31.3, -2.7), (30.18, -2.7)]]
        for coord in coordList:
            self.skymap.findAllTracts(coord)
        self.skymap.findTractPatchList(coordList)

    def testDm14809(self):
        """Test that DM-14809 has been fixed"""
        skyMapTestCase.checkDm14809(self, self.skymap)

        # Check that the first tract in the last ring exists
        coord = self.getFirstTractLastRingCoord()
        tract = self.skymap.findTract(coord)
        self.assertTrue(tract.contains(coord))

    def testWraparound(self):
        """Check wrapping at RA=0

        How-to-reproduce of a bug identified by Sogo Mineo.
        """
        tractId = 9712
        deviation = 10 / 3600.0  # 10 arcsec
        tract = self.skymap[tractId]
        center = tract.getCtrCoord()
        centerRa = center.getRa().asDegrees()
        centerDec = center.getDec().asDegrees()
        for devRa in [-deviation, deviation]:
            coord = lsst.geom.SpherePoint(centerRa + devRa, centerDec, lsst.geom.degrees)
            foundTractId = self.skymap.findTract(coord).getId()
            self.assertEqual(tractId, foundTractId)

    def getFirstTractLastRingCoord(self):
        """Return the coordinates of the first tract in the last ring

        This tract is missing in version=0, but this is fixed in version=1.in
        """
        ringNum = self.skymap.config.numRings - 1
        ringSize = math.pi/(self.skymap.config.numRings + 1)
        firstRingStart = ringSize*0.5 - 0.5*math.pi
        dec = ringNum*ringSize + firstRingStart
        return lsst.geom.SpherePoint(self.skymap.config.raStart*lsst.geom.degrees,
                                     dec*lsst.geom.radians)