Exemplo n.º 1
0
    def testLambdaEff(self):
        f = afwImage.Filter("g")
        g_r = 1.2
        c = afwImage.Color(g_r)

        self.assertEqual(c.getLambdaEff(f),
                         1000 * g_r)  # XXX Not a real implementation!
Exemplo n.º 2
0
    def testComputeImage2(self):
        """Test the computation of the PSF's image at a point"""

        color = afwImage.Color(1.0)
        ccdXY = afwGeom.Point2D(0, 0)
        kIm = self.psf.computeImage(ccdXY)
        self.assertTrue(kIm.getWidth() == self.ksize)
        self.assertAlmostEqual(afwMath.makeStatistics(kIm, afwMath.SUM).getValue(), 1.0)
    def determinePsf(self,
                     exposure,
                     psfCandidateList,
                     metadata=None,
                     flagKey=None):
        assert flagKey is not None
        flag0 = [c.getSource().get(flagKey) for c in psfCandidateList]

        xsrc = np.array([c.getSource().getX() for c in psfCandidateList])
        ysrc = np.array([c.getSource().getY() for c in psfCandidateList])

        # These are (x,y) values where the psfs will be compared
        xvec = np.linspace(np.min(xsrc) + 16.32, np.max(xsrc) - 19.77, 5)
        yvec = np.linspace(np.min(ysrc) + 20.45, np.max(ysrc) - 23.89, 5)

        print '\nComp2PsfDeterminer: starting first psf run (%s)\n' % self.config.psfName1

        determiner1 = self.determiner_class1(self.determiner_config1)
        (psf1, psfCellSet1) = determiner1.determinePsf(exposure,
                                                       psfCandidateList,
                                                       metadata, flagKey)
        flag1 = [c.getSource().get(flagKey) for c in psfCandidateList]

        print '\nComp2PsfDeterminer: starting second psf run (%s)\n' % self.config.psfName2

        for c in psfCandidateList:
            c.getSource().set(flagKey, False)

        determiner2 = self.determiner_class2(self.determiner_config2)
        (psf2, psfCellSet2) = determiner2.determinePsf(exposure,
                                                       psfCandidateList,
                                                       metadata, flagKey)
        flag2 = [c.getSource().get(flagKey) for c in psfCandidateList]

        print '\nComp2PsfDeterminer: table of comparison values follows'

        for x in xvec:
            for y in yvec:
                print '(x,y) =', (x, y)

                self.compare_images(
                    'doComputeImage',
                    psf1.doComputeImage(afwGeom.Point2D(x, y),
                                        afwImage.Color()),
                    psf2.doComputeImage(afwGeom.Point2D(x, y),
                                        afwImage.Color()))

                self.compare_images(
                    'doComputeKernelImage',
                    psf1.doComputeKernelImage(afwGeom.Point2D(x, y),
                                              afwImage.Color()),
                    psf2.doComputeKernelImage(afwGeom.Point2D(x, y),
                                              afwImage.Color()))

        bad1 = [i for (i, x) in enumerate(flag1) if not x]
        bad2 = [i for (i, x) in enumerate(flag2) if not x]
        print '\nComp2PsfDeterminer: the following candidates were marked bad by %s: %s' % (
            self.config.psfName1, bad1)
        print 'Comp2PsfDeterminer: the following candidates were marked bad by %s: %s\n' % (
            self.config.psfName2, bad2)

        if bad1 != bad2:
            print '   !!! WARNING the two sets of bad candidates differ !!!\n'

        return (psf2, psfCellSet2)
Exemplo n.º 4
0
 def testIsIndeterminate(self):
     """Test that a default-constructed Color tests True, but ones with a g-r value test False"""
     self.assertTrue(afwImage.Color().isIndeterminate())
     self.assertFalse(afwImage.Color(1.2).isIndeterminate())
Exemplo n.º 5
0
 def testCtor(self):
     afwImage.Color()
     afwImage.Color(1.2)
Exemplo n.º 6
0
 def testCtor(self):
     c = afwImage.Color()
     c = afwImage.Color(1.2)