Skip to content

Commit

Permalink
Update code to use lsst.afw.fits.readMetadata
Browse files Browse the repository at this point in the history
instead of the deprecated lsst.afw.image.readMetadata
  • Loading branch information
r-owen committed Jan 3, 2018
1 parent 18a96ac commit 67b2212
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/lsst/obs/comCam/comCamMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import lsst.afw.image.utils as afwImageUtils
import lsst.afw.geom as afwGeom
import lsst.afw.image as afwImage
from lsst.afw.fits import readMetadata
from lsst.obs.base import CameraMapper, MakeRawVisitInfo
import lsst.daf.persistence as dafPersist

Expand Down Expand Up @@ -231,7 +232,7 @@ def map_raw_visitInfo(self, *args, **kwargs):

def bypass_raw_visitInfo(self, datasetType, pythonType, location, dataId):
if False:
# afwImage.readMetadata() doesn't honour [hdu] suffixes in filenames
# lsst.afw.fits.readMetadata() doesn't honour [hdu] suffixes in filenames
#
# We could workaround this by moving the "else" block into obs_base,
# or by changing afw
Expand All @@ -245,9 +246,9 @@ def bypass_raw_visitInfo(self, datasetType, pythonType, location, dataId):
mat = re.search(r"\[(\d+)\]$", fileName)
if mat:
hdu = int(mat.group(1))
md = afwImage.readMetadata(fileName, hdu=hdu)
md = readMetadata(fileName, hdu=hdu)
else:
md = afwImage.readMetadata(fileName) # or hdu = INT_MIN; -(1 << 31)
md = readMetadata(fileName) # or hdu = INT_MIN; -(1 << 31)

return afwImage.VisitInfo(md)

Expand Down

0 comments on commit 67b2212

Please sign in to comment.