Beispiel #1
0
 def testDcrSubfilterOrder(self):
     """Test that the bluest subfilter always has the largest DCR amplitude.
     """
     pixelScale = 0.2 * arcseconds
     for testIter in range(self.nRandIter):
         rotAngle = 360. * self.rng.rand() * degrees
         azimuth = 360. * self.rng.rand() * degrees
         elevation = (45. + self.rng.rand() * 40.
                      ) * degrees  # Restrict to 45 < elevation < 85 degrees
         visitInfo = self.makeDummyVisitInfo(azimuth, elevation)
         wcs = self.makeDummyWcs(rotAngle,
                                 pixelScale,
                                 crval=visitInfo.getBoresightRaDec())
         dcrShift = calculateDcr(visitInfo, wcs, self.effectiveWavelength,
                                 self.bandwidth, self.dcrNumSubfilters)
         # First check that the blue subfilter amplitude is greater than the red subfilter
         rotation = calculateImageParallacticAngle(visitInfo,
                                                   wcs).asRadians()
         ampShift = [
             dcr[1] * np.sin(rotation) + dcr[0] * np.cos(rotation)
             for dcr in dcrShift
         ]
         self.assertGreater(
             ampShift[0],
             0.)  # The blue subfilter should be shifted towards zenith
         self.assertLess(
             ampShift[2],
             0.)  # The red subfilter should be shifted away from zenith
         # The absolute amplitude of the blue subfilter should also
         # be greater than that of the red subfilter
         self.assertGreater(np.abs(ampShift[0]), np.abs(ampShift[2]))
Beispiel #2
0
    def testRotationAngle(self):
        """Test that the sky rotation angle is consistently computed.

        The rotation is compared to pre-computed values.
        """
        cdRotAngle = 0.*degrees
        azimuth = 130.*degrees
        elevation = 70.*degrees
        pixelScale = 0.2*arcseconds
        visitInfo = self.makeDummyVisitInfo(azimuth, elevation)
        wcs = self.makeDummyWcs(cdRotAngle, pixelScale, crval=visitInfo.getBoresightRaDec())
        rotAngle = calculateImageParallacticAngle(visitInfo, wcs)
        refAngle = -1.0848032636337364*radians
        self.assertAnglesAlmostEqual(refAngle, rotAngle)
    def testRotationAngle(self):
        """Test that the sky rotation angle is consistently computed.

        The rotation is compared to pre-computed values.
        """
        cdRotAngle = 0.*degrees
        azimuth = 130.*degrees
        elevation = 70.*degrees
        pixelScale = 0.2*arcseconds
        visitInfo = self.makeDummyVisitInfo(azimuth, elevation)
        wcs = self.makeDummyWcs(cdRotAngle, pixelScale, crval=visitInfo.getBoresightRaDec())
        rotAngle = calculateImageParallacticAngle(visitInfo, wcs)
        refAngle = -0.9344289857053072*radians
        self.assertAnglesAlmostEqual(refAngle, rotAngle, maxDiff=1e-6*radians)
Beispiel #4
0
    def testRotationSouthZero(self):
        """Test that an observation pointed due South has zero rotation angle.

        An observation pointed South and on the meridian should have zenith
        directly to the North, and a parallactic angle of zero.
        """
        refAngle = 0.*degrees
        azimuth = 180.*degrees  # Telescope is pointed South
        pixelScale = 0.2*arcseconds
        for testIter in range(self.nRandIter):
            # Any additional arbitrary rotation should fall out of the calculation
            cdRotAngle = 360*self.rng.rand()*degrees
            elevation = (45. + self.rng.rand()*40.)*degrees  # Restrict to 45 < elevation < 85 degrees
            visitInfo = self.makeDummyVisitInfo(azimuth, elevation)
            wcs = self.makeDummyWcs(cdRotAngle, pixelScale, crval=visitInfo.getBoresightRaDec(), flipX=True)
            rotAngle = calculateImageParallacticAngle(visitInfo, wcs)
            self.assertAnglesAlmostEqual(refAngle - cdRotAngle, rotAngle, maxDiff=coordinateTolerance)
    def testRotationSouthZero(self):
        """Test that an observation pointed due South has zero rotation angle.

        An observation pointed South and on the meridian should have zenith
        directly to the North, and a parallactic angle of zero.
        """
        refAngle = 0.*degrees
        azimuth = 180.*degrees  # Telescope is pointed South
        pixelScale = 0.2*arcseconds
        for testIter in range(self.nRandIter):
            # Any additional arbitrary rotation should fall out of the calculation
            cdRotAngle = 360*self.rng.rand()*degrees
            elevation = (45. + self.rng.rand()*40.)*degrees  # Restrict to 45 < elevation < 85 degrees
            visitInfo = self.makeDummyVisitInfo(azimuth, elevation)
            wcs = self.makeDummyWcs(cdRotAngle, pixelScale, crval=visitInfo.getBoresightRaDec(), flipX=True)
            rotAngle = calculateImageParallacticAngle(visitInfo, wcs)
            self.assertAnglesAlmostEqual(refAngle - cdRotAngle, rotAngle, maxDiff=1e-6*radians)
Beispiel #6
0
 def testRotationFlipped(self):
     """Check the interpretation of rotations in the WCS.
     """
     doFlip = [False, True]
     for testIter in range(self.nRandIter):
         # Any additional arbitrary rotation should fall out of the calculation
         cdRotAngle = 360*self.rng.rand()*degrees
         # Make the telescope be pointed South, so that the parallactic angle is zero.
         azimuth = 180.*degrees
         elevation = (45. + self.rng.rand()*40.)*degrees  # Restrict to 45 < elevation < 85 degrees
         pixelScale = 0.2*arcseconds
         visitInfo = self.makeDummyVisitInfo(azimuth, elevation)
         for flip in doFlip:
             wcs = self.makeDummyWcs(cdRotAngle, pixelScale,
                                     crval=visitInfo.getBoresightRaDec(),
                                     flipX=flip)
             rotAngle = calculateImageParallacticAngle(visitInfo, wcs)
             if flip:
                 rotAngle *= -1
             self.assertAnglesAlmostEqual(cdRotAngle, rotAngle, maxDiff=coordinateTolerance)
 def testRotationFlipped(self):
     """Check the interpretation of rotations in the WCS.
     """
     doFlip = [False, True]
     for testIter in range(self.nRandIter):
         # Any additional arbitrary rotation should fall out of the calculation
         cdRotAngle = 360*self.rng.rand()*degrees
         # Make the telescope be pointed South, so that the parallactic angle is zero.
         azimuth = 180.*degrees
         elevation = (45. + self.rng.rand()*40.)*degrees  # Restrict to 45 < elevation < 85 degrees
         pixelScale = 0.2*arcseconds
         visitInfo = self.makeDummyVisitInfo(azimuth, elevation)
         for flip in doFlip:
             wcs = self.makeDummyWcs(cdRotAngle, pixelScale,
                                     crval=visitInfo.getBoresightRaDec(),
                                     flipX=flip)
             rotAngle = calculateImageParallacticAngle(visitInfo, wcs)
             if flip:
                 rotAngle *= -1
             self.assertAnglesAlmostEqual(cdRotAngle, rotAngle, maxDiff=1e-6*radians)
 def testDcrSubfilterOrder(self):
     """Test that the bluest subfilter always has the largest DCR amplitude.
     """
     dcrNumSubfilters = 3
     afwImageUtils.defineFilter("gTest", self.lambdaEff,
                                lambdaMin=self.lambdaMin, lambdaMax=self.lambdaMax)
     filterInfo = afwImage.Filter("gTest")
     pixelScale = 0.2*arcseconds
     for testIter in range(self.nRandIter):
         rotAngle = 360.*self.rng.rand()*degrees
         azimuth = 360.*self.rng.rand()*degrees
         elevation = (45. + self.rng.rand()*40.)*degrees  # Restrict to 45 < elevation < 85 degrees
         visitInfo = self.makeDummyVisitInfo(azimuth, elevation)
         wcs = self.makeDummyWcs(rotAngle, pixelScale, crval=visitInfo.getBoresightRaDec())
         dcrShift = calculateDcr(visitInfo, wcs, filterInfo, dcrNumSubfilters)
         # First check that the blue subfilter amplitude is greater than the red subfilter
         rotation = calculateImageParallacticAngle(visitInfo, wcs).asRadians()
         ampShift = [dcr[1]*np.sin(rotation) + dcr[0]*np.cos(rotation) for dcr in dcrShift]
         self.assertGreater(ampShift[0], 0.)  # The blue subfilter should be shifted towards zenith
         self.assertLess(ampShift[2], 0.)  # The red subfilter should be shifted away from zenith
         # The absolute amplitude of the blue subfilter should also
         # be greater than that of the red subfilter
         self.assertGreater(np.abs(ampShift[0]), np.abs(ampShift[2]))