Coverage for tests/test_imageTestUtils.py : 23%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
"""!Unit tests for makeRampImage"""
"""!Test small ramp images with unit interval for known values """ for imageClass in (afwImage.ImageU, afwImage.ImageF, afwImage.ImageD): dim = lsst.geom.Extent2I(7, 9) box = lsst.geom.Box2I(lsst.geom.Point2I(-1, 3), dim) numPix = dim[0]*dim[1] for start in (-5, 0, 4): if imageClass == afwImage.ImageU and start < 0: continue predStop = start + numPix - 1 # for integer steps for stop in (None, predStop): rampImage = makeRampImage( bbox=box, start=start, stop=predStop, imageClass=imageClass) predArr = np.arange(start, predStop+1) self.assertEqual(len(predArr), numPix) predArr.shape = (dim[1], dim[0]) self.assertImagesAlmostEqual(rampImage, predArr)
"""!Test a small ramp image with non-integer increments """ for imageClass in (afwImage.ImageU, afwImage.ImageF, afwImage.ImageD): dim = lsst.geom.Extent2I(7, 9) box = lsst.geom.Box2I(lsst.geom.Point2I(-1, 3), dim) numPix = dim[0]*dim[1] for start in (-5.1, 0, 4.3): if imageClass == afwImage.ImageU and start < 0: continue for stop in (7, 1001.5, 5.4): rampImage = makeRampImage( bbox=box, start=start, stop=stop, imageClass=imageClass) dtype = rampImage.getArray().dtype predArr = np.linspace( start, stop, num=numPix, endpoint=True, dtype=dtype) predArr.shape = (dim[1], dim[0]) self.assertImagesAlmostEqual(rampImage, predArr)
lsst.utils.tests.init()
lsst.utils.tests.init() unittest.main() |