예제 #1
0
 def testGetNQuarter(self):
     """Test the getNQuarter method
     """
     refPos = afwGeom.Point2D(0., 0.)
     fpPos = afwGeom.Point2D(0., 0.)
     angles = ((0., 0), (90., 1), (180., 2), (270., 3), (360., 4),
               (0.1, 0), (44.9, 0), (45.1, 1), (89.9, 1), (90.1, 1),
               (134.9, 1), (135.1, 2), (179.9, 2), (180.1, 2), (224.9, 2),
               (225.1, 3), (269.9, 3), (270.1, 3), (314.9, 3), (315.1, 4),
               (359.9, 4))
     for angle in angles:
         orient = Orientation(fpPos, refPos, afwGeom.Angle(angle[0], afwGeom.degrees))
         self.assertEquals(orient.getNQuarter(), angle[1])
예제 #2
0
 def __init__(self,
     fpPosition = afwGeom.Point2D(0, 0),
     refPoint = afwGeom.Point2D(-0.5, -0.5),
     yaw = afwGeom.Angle(0),
     pitch = afwGeom.Angle(0),
     roll = afwGeom.Angle(0),
 ):
     self.fpPosition = fpPosition
     self.refPoint = refPoint
     self.yaw = yaw
     self.pitch = pitch
     self.roll = roll
     self.orient = Orientation(fpPosition, refPoint, yaw, pitch, roll)
예제 #3
0
    def testDefaultConstructor(self):
        """Test default constructor
        """
        orient = Orientation()
        for i in range(2):
            self.assertAlmostEquals(0, orient.getFpPosition()[i])
            self.assertAlmostEquals(-0.5, orient.getReferencePoint()[i])
        zeroAngle = afwGeom.Angle(0)
        self.assertAlmostEquals(zeroAngle, orient.getYaw())
        self.assertAlmostEquals(zeroAngle, orient.getRoll())
        self.assertAlmostEquals(zeroAngle, orient.getPitch())

        fwdTransform = orient.makeFpPixelTransform(afwGeom.Extent2D(1.0))
        for x in (-100.1, 0.0, 230.0):
            for y in (-45.0, 0.0, 25.1):
                xy = afwGeom.Point2D(x, y)
                fwdXY = fwdTransform.forwardTransform(xy)
                for i in range(2):
                    self.assertAlmostEquals(xy[i] - 0.5, fwdXY[i])
        self.compareTransforms(orient)