LSST Applications
21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
|
Functions | |
def | makeGaussianNoiseMaskedImage (dimensions, sigma, variance=1.0) |
def | makeRampImage (bbox, start=0, stop=None, imageClass=ImageF) |
Make an image whose values are a linear ramp. More... | |
def | assertImagesAlmostEqual (testCase, image0, image1, skipMask=None, rtol=1.0e-05, atol=1e-08, msg="Images differ") |
Assert that two images are almost equal, including non-finite values. More... | |
def | assertImagesEqual (*args, **kwds) |
Assert that two images are exactly equal, including non-finite values. More... | |
def | assertMasksEqual (testCase, mask0, mask1, skipMask=None, msg="Masks differ") |
Assert that two masks are equal. More... | |
def | assertMaskedImagesAlmostEqual (testCase, maskedImage0, maskedImage1, doImage=True, doMask=True, doVariance=True, skipMask=None, rtol=1.0e-05, atol=1e-08, msg="Masked images differ") |
Assert that two masked images are nearly equal, including non-finite values. More... | |
def | assertMaskedImagesEqual (*args, **kwds) |
Assert that two masked images are exactly equal, including non-finite values. More... | |
def | imagesDiffer (image0, image1, skipMask=None, rtol=1.0e-05, atol=1e-08) |
Compare the pixels of two image or mask arrays; return True if close, False otherwise. More... | |
def lsst.afw.image.testUtils.assertImagesAlmostEqual | ( | testCase, | |
image0, | |||
image1, | |||
skipMask = None , |
|||
rtol = 1.0e-05 , |
|||
atol = 1e-08 , |
|||
msg = "Images differ" |
|||
) |
Assert that two images are almost equal, including non-finite values.
@param[in] testCase unittest.TestCase instance the test is part of; an object supporting one method: fail(self, msgStr) @param[in] image0 image 0, an lsst.afw.image.Image, lsst.afw.image.Mask, or transposed numpy array (see warning) @param[in] image1 image 1, an lsst.afw.image.Image, lsst.afw.image.Mask, or transposed numpy array (see warning) @param[in] skipMask mask of pixels to skip, or None to compare all pixels; an lsst.afw.image.Mask, lsst.afw.image.Image, or transposed numpy array (see warning); all non-zero pixels are skipped @param[in] rtol maximum allowed relative tolerance; more info below @param[in] atol maximum allowed absolute tolerance; more info below @param[in] msg exception message prefix; details of the error are appended after ": " The images are nearly equal if all pixels obey: |val1 - val0| <= rtol*|val1| + atol or, for float types, if nan/inf/-inf pixels match. @warning the comparison equation is not symmetric, so in rare cases the assertion may give different results depending on which image comes first. @warning the axes of numpy arrays are transposed with respect to Image and Mask data. Thus for example if image0 and image1 are both lsst.afw.image.ImageD with dimensions (2, 3) and skipMask is a numpy array, then skipMask must have shape (3, 2). @throw self.failureException (usually AssertionError) if any of the following are true for un-skipped pixels: - non-finite values differ in any way (e.g. one is "nan" and another is not) - finite values differ by too much, as defined by atol and rtol @throw TypeError if the dimensions of image0, image1 and skipMask do not match, or any are not of a numeric data type.
Definition at line 74 of file testUtils.py.
def lsst.afw.image.testUtils.assertImagesEqual | ( | * | args, |
** | kwds | ||
) |
Assert that two images are exactly equal, including non-finite values.
All arguments are forwarded to assertAnglesAlmostEqual aside from atol and rtol, which are set to zero.
Definition at line 117 of file testUtils.py.
def lsst.afw.image.testUtils.assertMaskedImagesAlmostEqual | ( | testCase, | |
maskedImage0, | |||
maskedImage1, | |||
doImage = True , |
|||
doMask = True , |
|||
doVariance = True , |
|||
skipMask = None , |
|||
rtol = 1.0e-05 , |
|||
atol = 1e-08 , |
|||
msg = "Masked images differ" |
|||
) |
Assert that two masked images are nearly equal, including non-finite values.
@param[in] testCase unittest.TestCase instance the test is part of; an object supporting one method: fail(self, msgStr) @param[in] maskedImage0 masked image 0 (an lsst.afw.image.MaskedImage or collection of three transposed numpy arrays: image, mask, variance) @param[in] maskedImage1 masked image 1 (an lsst.afw.image.MaskedImage or collection of three transposed numpy arrays: image, mask, variance) @param[in] doImage compare image planes if True @param[in] doMask compare mask planes if True @param[in] doVariance compare variance planes if True @param[in] skipMask mask of pixels to skip, or None to compare all pixels; an lsst.afw.image.Mask, lsst.afw.image.Image, or transposed numpy array; all non-zero pixels are skipped @param[in] rtol maximum allowed relative tolerance; more info below @param[in] atol maximum allowed absolute tolerance; more info below @param[in] msg exception message prefix; details of the error are appended after ": " The mask planes must match exactly. The image and variance planes are nearly equal if all pixels obey: |val1 - val0| <= rtol*|val1| + atol or, for float types, if nan/inf/-inf pixels match. @warning the comparison equation is not symmetric, so in rare cases the assertion may give different results depending on which masked image comes first. @warning the axes of numpy arrays are transposed with respect to MaskedImage data. Thus for example if maskedImage0 and maskedImage1 are both lsst.afw.image.MaskedImageD with dimensions (2, 3) and skipMask is a numpy array, then skipMask must have shape (3, 2). @throw self.failureException (usually AssertionError) if any of the following are true for un-skipped pixels: - non-finite image or variance values differ in any way (e.g. one is "nan" and another is not) - finite values differ by too much, as defined by atol and rtol - mask pixels differ at all @throw TypeError if the dimensions of maskedImage0, maskedImage1 and skipMask do not match, either image or variance plane is not of a numeric data type, either mask plane is not of an integer type (unsigned or signed), or skipMask is not of a numeric data type.
Definition at line 156 of file testUtils.py.
def lsst.afw.image.testUtils.assertMaskedImagesEqual | ( | * | args, |
** | kwds | ||
) |
Assert that two masked images are exactly equal, including non-finite values.
All arguments are forwarded to assertMaskedImagesAlmostEqual aside from atol and rtol, which are set to zero.
Definition at line 246 of file testUtils.py.
def lsst.afw.image.testUtils.assertMasksEqual | ( | testCase, | |
mask0, | |||
mask1, | |||
skipMask = None , |
|||
msg = "Masks differ" |
|||
) |
Assert that two masks are equal.
@param[in] testCase unittest.TestCase instance the test is part of; an object supporting one method: fail(self, msgStr) @param[in] mask0 mask 0, an lsst.afw.image.Mask, lsst.afw.image.Image, or transposed numpy array (see warning) @param[in] mask1 mask 1, an lsst.afw.image.Mask, lsst.afw.image.Image, or transposed numpy array (see warning) @param[in] skipMask mask of pixels to skip, or None to compare all pixels; an lsst.afw.image.Mask, lsst.afw.image.Image, or transposed numpy array (see warning); all non-zero pixels are skipped @param[in] msg exception message prefix; details of the error are appended after ": " @warning the axes of numpy arrays are transposed with respect to Mask and Image. Thus for example if mask0 and mask1 are both lsst.afw.image.Mask with dimensions (2, 3) and skipMask is a numpy array, then skipMask must have shape (3, 2). @throw self.failureException (usually AssertionError) if any any un-skipped pixels differ @throw TypeError if the dimensions of mask0, mask1 and skipMask do not match, or any are not of a numeric data type.
Definition at line 127 of file testUtils.py.
def lsst.afw.image.testUtils.imagesDiffer | ( | image0, | |
image1, | |||
skipMask = None , |
|||
rtol = 1.0e-05 , |
|||
atol = 1e-08 |
|||
) |
Compare the pixels of two image or mask arrays; return True if close, False otherwise.
@param[in] image0 image 0, an lsst.afw.image.Image, lsst.afw.image.Mask, or transposed numpy array (see warning) @param[in] image1 image 1, an lsst.afw.image.Image, lsst.afw.image.Mask, or transposed numpy array (see warning) @param[in] skipMask mask of pixels to skip, or None to compare all pixels; an lsst.afw.image.Mask, lsst.afw.image.Image, or transposed numpy array (see warning); all non-zero pixels are skipped @param[in] rtol maximum allowed relative tolerance; more info below @param[in] atol maximum allowed absolute tolerance; more info below The images are nearly equal if all pixels obey: |val1 - val0| <= rtol*|val1| + atol or, for float types, if nan/inf/-inf pixels match. @warning the comparison equation is not symmetric, so in rare cases the assertion may give different results depending on which image comes first. @warning the axes of numpy arrays are transposed with respect to Image and Mask data. Thus for example if image0 and image1 are both lsst.afw.image.ImageD with dimensions (2, 3) and skipMask is a numpy array, then skipMask must have shape (3, 2). @return a string which is non-empty if the images differ @throw TypeError if the dimensions of image0, image1 and skipMask do not match, or any are not of a numeric data type.
Definition at line 255 of file testUtils.py.
def lsst.afw.image.testUtils.makeGaussianNoiseMaskedImage | ( | dimensions, | |
sigma, | |||
variance = 1.0 |
|||
) |
Make a gaussian noise MaskedImageF Inputs: - dimensions: dimensions of output array (cols, rows) - sigma; sigma of image plane's noise distribution - variance: constant value for variance plane
Definition at line 34 of file testUtils.py.
def lsst.afw.image.testUtils.makeRampImage | ( | bbox, | |
start = 0 , |
|||
stop = None , |
|||
imageClass = ImageF |
|||
) |
Make an image whose values are a linear ramp.
@param[in] bbox bounding box of image (an lsst.geom.Box2I) @param[in] start starting ramp value, inclusive @param[in] stop ending ramp value, inclusive; if None, increase by integer values @param[in] imageClass type of image (e.g. lsst.afw.image.ImageF)
Definition at line 51 of file testUtils.py.