Skip to content

Commit

Permalink
Merge pull request #43 from lsst/tickets/DM-10541
Browse files Browse the repository at this point in the history
DM-10541: Use ABCs to distinguish image types.
  • Loading branch information
TallJimbo committed May 18, 2017
2 parents b397675 + 16dff0e commit 3e9cd0d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions python/lsst/obs/base/cameraMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,17 +1037,15 @@ def exposureFromImage(image):
@param[in] image Image-like object (lsst.afw.image.DecoratedImage, Image, MaskedImage or Exposure)
@return (lsst.afw.image.Exposure) Exposure containing input image
"""
if hasattr(image, "getVariance"):
# MaskedImage
if isinstance(image, afwImage.MaskedImage):
exposure = afwImage.makeExposure(image)
elif hasattr(image, "getImage"):
# DecoratedImage
elif isinstance(image, afwImage.DecoratedImage):
exposure = afwImage.makeExposure(afwImage.makeMaskedImage(image.getImage()))
metadata = image.getMetadata()
wcs = afwImage.makeWcs(metadata, True)
exposure.setWcs(wcs)
exposure.setMetadata(metadata)
elif hasattr(image, "getMaskedImage"):
elif isinstance(image, afwImage.Exposure):
# Exposure
exposure = image
else:
Expand Down

0 comments on commit 3e9cd0d

Please sign in to comment.