Skip to content

Commit

Permalink
Merge pull request #100 from lsst/tickets/DM-15776
Browse files Browse the repository at this point in the history
DM-15776: Reimplement FitsStorage support for reading headers directly.
  • Loading branch information
TallJimbo committed Sep 17, 2018
2 parents 10498df + b4e3fb1 commit b82715d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/lsst/daf/persistence/posixStorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,13 @@ def readFitsStorage(butlerLocation):
if isinstance(pythonType, basestring):
pythonType = doImport(pythonType)
supportsOptions = hasattr(pythonType, "readFitsWithOptions")
if not supportsOptions:
from lsst.daf.base import PropertySet, PropertyList
if issubclass(pythonType, (PropertySet, PropertyList)):
from lsst.afw.image import readMetadata
reader = readMetadata
else:
reader = pythonType.readFits
results = []
additionalData = butlerLocation.getAdditionalData()
for locationString in butlerLocation.getLocations():
Expand All @@ -597,7 +604,7 @@ def readFitsStorage(butlerLocation):
if supportsOptions:
finalItem = pythonType.readFitsWithOptions(logLoc.locString(), options=additionalData)
else:
finalItem = pythonType.readFits(logLoc.locString())
finalItem = reader(logLoc.locString())
results.append(finalItem)
return results

Expand Down

0 comments on commit b82715d

Please sign in to comment.