Esempio n. 1
0
    def testAngleAliases(self):
        with self.assertWarns(FutureWarning):
            self.assertEqual(afwGeom.Angle(1), lsst.geom.Angle(1))

        self.assertIs(afwGeom.radians, lsst.geom.radians)
        self.assertIs(afwGeom.degrees, lsst.geom.degrees)
        self.assertIs(afwGeom.hours, lsst.geom.hours)
        self.assertIs(afwGeom.arcminutes, lsst.geom.arcminutes)
        self.assertIs(afwGeom.arcseconds, lsst.geom.arcseconds)

        self.assertIs(afwGeom.PI, lsst.geom.PI)
        self.assertIs(afwGeom.TWOPI, lsst.geom.TWOPI)
        self.assertIs(afwGeom.HALFPI, lsst.geom.HALFPI)
        self.assertIs(afwGeom.ONE_OVER_PI, lsst.geom.ONE_OVER_PI)
        self.assertIs(afwGeom.SQRTPI, lsst.geom.SQRTPI)
        self.assertIs(afwGeom.INVSQRTPI, lsst.geom.INVSQRTPI)
        self.assertIs(afwGeom.ROOT2, lsst.geom.ROOT2)

        with self.assertWarns(FutureWarning):
            self.assertEqual(afwGeom.degToRad(1), lsst.geom.degToRad(1))
        with self.assertWarns(FutureWarning):
            self.assertEqual(afwGeom.radToDeg(1), lsst.geom.radToDeg(1))
        with self.assertWarns(FutureWarning):
            self.assertEqual(afwGeom.radToArcsec(1), lsst.geom.radToArcsec(1))
        with self.assertWarns(FutureWarning):
            self.assertEqual(afwGeom.radToMas(1), lsst.geom.radToMas(1))
        with self.assertWarns(FutureWarning):
            self.assertEqual(afwGeom.arcsecToRad(1), lsst.geom.arcsecToRad(1))
        with self.assertWarns(FutureWarning):
            self.assertEqual(afwGeom.masToRad(1), lsst.geom.masToRad(1))
Esempio n. 2
0
    def testTransformSlalib(self):
        """Test Camera.transform against data computed using SLALIB

        These test data come from SLALIB using SLA_PCD with 0.925 and
        a plate scale of 20 arcsec/mm
        """
        testData = [
            (-1.84000000, 1.04000000, -331.61689069, 187.43563387),
            (-1.64000000, 0.12000000, -295.42491556, 21.61645724),
            (-1.44000000, -0.80000000, -259.39818797, -144.11010443),
            (-1.24000000, -1.72000000, -223.48275934, -309.99221457),
            (-1.08000000, 1.36000000, -194.56520533, 245.00803635),
            (-0.88000000, 0.44000000, -158.44320430, 79.22160215),
            (-0.68000000, -0.48000000, -122.42389383, -86.41686623),
            (-0.48000000, -1.40000000, -86.45332534, -252.15553224),
            (-0.32000000, 1.68000000, -57.64746955, 302.64921514),
            (-0.12000000, 0.76000000, -21.60360306, 136.82281940),
            (0.08000000, -0.16000000, 14.40012984, -28.80025968),
            (0.28000000, -1.08000000, 50.41767773, -194.46818554),
            (0.48000000, -2.00000000, 86.50298919, -360.42912163),
            (0.64000000, 1.08000000, 115.25115701, 194.48632746),
            (0.84000000, 0.16000000, 151.23115189, 28.80593369),
            (1.04000000, -0.76000000, 187.28751874, -136.86395600),
            (1.24000000, -1.68000000, 223.47420612, -302.77150507),
            (1.40000000, 1.40000000, 252.27834478, 252.27834478),
            (1.60000000, 0.48000000, 288.22644118, 86.46793236),
            (1.80000000, -0.44000000, 324.31346653, -79.27662515),
        ]

        for cw in self.cameraList:
            camera = cw.camera
            for point in testData:
                fpGivenPos = afwGeom.Point2D(point[2], point[3])
                fpGivenCP = camera.makeCameraPoint(fpGivenPos, FOCAL_PLANE)
                pupilGivenPos = afwGeom.Point2D(afwGeom.degToRad(point[0]),
                                                afwGeom.degToRad(point[1]))
                pupilGivenCP = camera.makeCameraPoint(pupilGivenPos, PUPIL)

                fpComputedCP = camera.transform(pupilGivenCP, FOCAL_PLANE)
                self.assertCamPointAlmostEquals(fpComputedCP, fpGivenCP)

                pupilComputedCP = camera.transform(fpGivenCP, PUPIL)
                self.assertCamPointAlmostEquals(pupilComputedCP, pupilGivenCP)
Esempio n. 3
0
    def testTransformSlalib(self):
        """Test Camera.transform against data computed using SLALIB

        These test data come from SLALIB using SLA_PCD with 0.925 and
        a plate scale of 20 arcsec/mm
        """
        testData = [(-1.84000000, 1.04000000, -331.61689069, 187.43563387),
                    (-1.64000000, 0.12000000, -295.42491556, 21.61645724),
                    (-1.44000000, -0.80000000, -259.39818797, -144.11010443),
                    (-1.24000000, -1.72000000, -223.48275934, -309.99221457),
                    (-1.08000000, 1.36000000, -194.56520533, 245.00803635),
                    (-0.88000000, 0.44000000, -158.44320430, 79.22160215),
                    (-0.68000000, -0.48000000, -122.42389383, -86.41686623),
                    (-0.48000000, -1.40000000, -86.45332534, -252.15553224),
                    (-0.32000000, 1.68000000, -57.64746955, 302.64921514),
                    (-0.12000000, 0.76000000, -21.60360306, 136.82281940),
                    (0.08000000, -0.16000000, 14.40012984, -28.80025968),
                    (0.28000000, -1.08000000, 50.41767773, -194.46818554),
                    (0.48000000, -2.00000000, 86.50298919, -360.42912163),
                    (0.64000000, 1.08000000, 115.25115701, 194.48632746),
                    (0.84000000, 0.16000000, 151.23115189, 28.80593369),
                    (1.04000000, -0.76000000, 187.28751874, -136.86395600),
                    (1.24000000, -1.68000000, 223.47420612, -302.77150507),
                    (1.40000000, 1.40000000, 252.27834478, 252.27834478),
                    (1.60000000, 0.48000000, 288.22644118, 86.46793236),
                    (1.80000000, -0.44000000, 324.31346653, -79.27662515),]

        for cw in self.cameraList:
            camera = cw.camera
            for point in testData:
                fpGivenPos = afwGeom.Point2D(point[2], point[3])
                fpGivenCP = camera.makeCameraPoint(fpGivenPos, FOCAL_PLANE)
                pupilGivenPos = afwGeom.Point2D(afwGeom.degToRad(point[0]), afwGeom.degToRad(point[1]))
                pupilGivenCP = camera.makeCameraPoint(pupilGivenPos, PUPIL)

                fpComputedCP = camera.transform(pupilGivenCP, FOCAL_PLANE)
                self.assertCamPointAlmostEquals(fpComputedCP, fpGivenCP)

                pupilComputedCP = camera.transform(fpGivenCP, PUPIL)
                self.assertCamPointAlmostEquals(pupilComputedCP, pupilGivenCP)