Coverage for tests/test_imagePickle.py : 35%
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
|
# # LSST Data Management System # Copyright 2008-2013 LSST Corporation. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <http://www.lsstcorp.org/LegalNotices/>. #
"""A test case for Image pickling"""
self.xSize = 4 self.ySize = 7 self.x0 = 567 self.y0 = 98765
image = factory(self.xSize, self.ySize) image.setXY0(lsst.geom.Point2I(self.x0, self.y0)) image.array[:] = self.createPattern() return image
image = factory(self.xSize, self.ySize) image.setXY0(lsst.geom.Point2I(self.x0, self.y0)) image.image.array[:] = self.createPattern() image.mask.array[:] = self.createPattern() image.variance.array[:] = self.createPattern() return image
# NB: numpy operates 'backwards' yy, xx = np.ogrid[0:self.ySize, 0:self.xSize] return self.xSize*yy + xx
image = pickle.loads(pickle.dumps(original)) self.assertImagesEqual(image, original)
image = pickle.loads(pickle.dumps(original)) self.assertMaskedImagesEqual(image, original)
image = pickle.loads(pickle.dumps(original)) self.assertMaskedImagesEqual(image.getMaskedImage(), original.getMaskedImage()) self.assertEqual(image.getWcs(), original.getWcs())
for Image in (afwImage.ImageU, afwImage.ImageI, afwImage.ImageF, afwImage.ImageD, afwImage.Mask, ): image = self.createImage(Image) self.checkImages(image)
scale = 1.0*lsst.geom.arcseconds wcs = afwGeom.makeSkyWcs(crval=lsst.geom.SpherePoint(0.0*lsst.geom.degrees, 0.0*lsst.geom.degrees), crpix=lsst.geom.Point2D(0.0, 0.0), cdMatrix=afwGeom.makeCdMatrix(scale=scale)) for MaskedImage in (afwImage.MaskedImageF, afwImage.MaskedImageD, ): image = self.createMaskedImage(MaskedImage) self.checkMaskedImages(image) exposure = afwImage.makeExposure(image, wcs) self.checkExposures(exposure)
lsst.utils.tests.init()
lsst.utils.tests.init() unittest.main() |