Ejemplo n.º 1
0
    def test_illumCorrection(self):
        """Expect larger median value after.
        Expect RuntimeError if sizes are different.
        """
        flatExp = isrMock.FlatMock().run()
        flatMi = flatExp.getMaskedImage()

        mi = self.mi.clone()
        ipIsr.illuminationCorrection(self.mi, flatMi, 1.0)
        self.assertGreater(computeImageMedianAndStd(self.mi.getImage())[0],
                           computeImageMedianAndStd(mi.getImage())[0])

        flatMi = flatMi[1:-1, 1:-1, afwImage.LOCAL]
        with self.assertRaises(RuntimeError):
            ipIsr.illuminationCorrection(self.mi, flatMi, 1.0)
Ejemplo n.º 2
0
    def test_illumCorrection(self):
        """Expect larger median value after.
        Expect RuntimeError if sizes are different.
        """
        flatExp = isrMock.FlatMock().run()
        flatMi = flatExp.getMaskedImage()

        mi = self.mi.clone()
        ipIsr.illuminationCorrection(self.mi, flatMi, 1.0)
        self.assertGreater(
            computeImageMedianAndStd(self.mi.getImage())[0],
            computeImageMedianAndStd(mi.getImage())[0])

        flatMi = flatMi[1:-1, 1:-1, afwImage.LOCAL]
        with self.assertRaises(RuntimeError):
            ipIsr.illuminationCorrection(self.mi, flatMi, 1.0, trimToFit=False)
    def doIllum(self, scaling):
        maskedImage = afwImage.MaskedImageF(afwGeom.Box2I(self.pmin, self.pmax))
        maskedImage.getImage().set(10)

        illum = afwImage.MaskedImageF(afwGeom.Box2I(self.pmin, self.pmax))
        illum.getImage().set(1)
        illumexposure = afwImage.ExposureF(illum, None)
        dmetadata = illumexposure.getMetadata()
        dmetadata.setString(self.filenameKeyword, 'Unittest Illum')

        ipIsr.illuminationCorrection(maskedImage, illumexposure.getMaskedImage(), scaling)

        height = maskedImage.getHeight()
        width = maskedImage.getWidth()
        for j in range(height):
            for i in range(width):
                self.assertAlmostEqual(maskedImage.image[i, j, afwImage.LOCAL], 10 / (1./scaling), 5)
Ejemplo n.º 4
0
    def doIllum(self, scaling):
        maskedImage = afwImage.MaskedImageF(
            lsst.geom.Box2I(self.pmin, self.pmax))
        maskedImage.getImage().set(10)

        illum = afwImage.MaskedImageF(lsst.geom.Box2I(self.pmin, self.pmax))
        illum.getImage().set(1)
        illumexposure = afwImage.ExposureF(illum, None)
        dmetadata = illumexposure.getMetadata()
        dmetadata.setString(self.filenameKeyword, 'Unittest Illum')

        ipIsr.illuminationCorrection(maskedImage,
                                     illumexposure.getMaskedImage(), scaling)

        height = maskedImage.getHeight()
        width = maskedImage.getWidth()
        for j in range(height):
            for i in range(width):
                self.assertAlmostEqual(maskedImage.image[i, j, afwImage.LOCAL],
                                       10 / (1. / scaling), 5)