Exemplo n.º 1
0
 def testReadFitsWcsStripMetadata(self):
     metadata = self.makeMetadata()
     self.assertEqual(len(metadata.toList()), 32)
     readFitsWcs(metadata, strip=False)
     self.assertEqual(len(metadata.toList()), 32)
     readFitsWcs(metadata, strip=True)
     self.assertEqual(len(metadata.toList()), 18)
Exemplo n.º 2
0
    def testReadFitsWcsStripMetadata(self):
        metadata = self.makeMetadata()
        nKeys = len(metadata.toList())
        nToStrip = 12
        frameSet1 = readFitsWcs(metadata, strip=False)
        self.assertEqual(type(frameSet1), ast.FrameSet)
        self.assertEqual(len(metadata.toList()), nKeys)

        # read again, this time stripping metadata
        frameSet2 = readFitsWcs(metadata, strip=True)
        self.assertEqual(len(metadata.toList()), nKeys - nToStrip)
        self.assertEqual(frameSet1, frameSet2)

        # having stripped the metadata, it should not be possible to create a WCS
        with self.assertRaises(lsst.pex.exceptions.TypeError):
            readFitsWcs(metadata, strip=False)
Exemplo n.º 3
0
    def testReadFitsWcsStripMetadata(self):
        metadata = self.makeMetadata()
        nKeys = len(metadata.toList())
        nToStrip = 12
        frameSet1 = readFitsWcs(metadata, strip=False)
        self.assertEqual(type(frameSet1), ast.FrameSet)
        self.assertEqual(len(metadata.toList()), nKeys)

        # read again, this time stripping metadata
        frameSet2 = readFitsWcs(metadata, strip=True)
        self.assertEqual(len(metadata.toList()), nKeys - nToStrip)
        self.assertEqual(frameSet1, frameSet2)

        # having stripped the metadata, it should not be possible to create a WCS
        with self.assertRaises(lsst.pex.exceptions.TypeError):
            readFitsWcs(metadata, strip=False)
Exemplo n.º 4
0
    def testReadFitsWcsFixRadecsys(self):
        # compare a WCS made with RADESYS against one made with RADECSYS,
        # using a system other than FK5, since that is the default;
        # both should be the same because readFitsWcs replaces RADECSYS with RADESYS
        metadata1 = self.makeMetadata()
        metadata1.set("RADESYS", "ICRS")
        frameSet1 = readFitsWcs(metadata1, strip=False)
        self.assertEqual(metadata1.get("RADESYS"), "ICRS")

        metadata2 = self.makeMetadata()
        metadata2.remove("RADESYS")
        metadata2.set("RADECSYS", "ICRS")
        frameSet2 = readFitsWcs(metadata2, strip=False)
        # metadata will have been corrected by readFitsWcs
        self.assertFalse(metadata2.exists("RADECSYS"))
        self.assertEqual(metadata2.get("RADESYS"), "ICRS")
        self.assertEqual(frameSet1, frameSet2)
Exemplo n.º 5
0
    def testReadFitsWcsFixRadecsys(self):
        # compare a WCS made with RADESYS against one made with RADECSYS,
        # using a system other than FK5, since that is the default;
        # both should be the same because readFitsWcs replaces RADECSYS with RADESYS
        metadata1 = self.makeMetadata()
        metadata1.set("RADESYS", "ICRS")
        frameSet1 = readFitsWcs(metadata1, strip=False)
        self.assertEqual(metadata1.getScalar("RADESYS"), "ICRS")

        metadata2 = self.makeMetadata()
        metadata2.remove("RADESYS")
        metadata2.set("RADECSYS", "ICRS")
        frameSet2 = readFitsWcs(metadata2, strip=False)
        # metadata will have been corrected by readFitsWcs
        self.assertFalse(metadata2.exists("RADECSYS"))
        self.assertEqual(metadata2.getScalar("RADESYS"), "ICRS")
        self.assertEqual(frameSet1, frameSet2)
Exemplo n.º 6
0
    def testIgnoreNan(self):
        """Test that NaN in a property list does not crash the WCS extraction.
        """
        metadata = self.makeMetadata()
        metadata["ISNAN"] = float("NaN")

        # This will issue a warning from C++ but that warning can not be
        # redirected to python logging machinery.
        # This code causes a SIGABRT without DM-21355 implemented
        frameSet1 = readFitsWcs(metadata, strip=False)
        self.assertEqual(type(frameSet1), ast.FrameSet)