Skip to content

Commit

Permalink
Simplify the HSC mapper by removing standardizeCalib
Browse files Browse the repository at this point in the history
standardizeCalib is no onger required because lsst.daf.base.exposureFromImage can now do the job.
  • Loading branch information
r-owen committed Sep 28, 2016
1 parent eca2324 commit d1d1d11
Showing 1 changed file with 4 additions and 40 deletions.
44 changes: 4 additions & 40 deletions python/lsst/obs/hsc/hscMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,47 +194,11 @@ def std_raw(self, item, dataId):

return self._flipChipsLR(exp, exp.getWcs(), dataId)

def standardizeCalib(self, dataset, item, dataId):
"""Standardize a calibration image read in by the butler
Some calibrations are stored on disk as Images instead of MaskedImages
or Exposures. Here, we convert it to an Exposure.
@param dataset Dataset type (e.g., "bias", "dark" or "flat")
@param item The item read by the butler
@param dataId The data identifier (unused, included for future flexibility)
@return standardized Exposure
"""
mapping = self.calibrations[dataset]
if "MaskedImage" in mapping.python:
exp = afwImage.makeExposure(item)
elif "Image" in mapping.python:
if hasattr(item, "getImage"): # For DecoratedImageX
item = item.getImage()
exp = afwImage.makeExposure(afwImage.makeMaskedImage(item))
elif "Exposure" in mapping.python:
exp = item
else:
raise RuntimeError("Unrecognised python type: %s" % mapping.python)

parent = super(HscMapper, self)
if hasattr(parent, "std_" + dataset):
return getattr(parent, "std_" + dataset)(exp, dataId)
return self._standardizeExposure(mapping, exp, dataId)

def std_bias(self, item, dataId):
return self.standardizeCalib("bias", item, dataId)

def std_dark(self, item, dataId):
exp = self.standardizeCalib("dark", item, dataId)
if exp.getInfo().getVisitInfo() is None:
# probably always true, but if not, leave the existing VisitInfo
visitInfo = afwImage.makeVisitInfo(exposureTime=1.0)
exp.getInfo().setVisitInfo(visitInfo)
return exp

def std_flat(self, item, dataId):
return self.standardizeCalib("flat", item, dataId)
exposure = self._standardizeExposure(self.calibrations['dark'], item, dataId, trimmed=False)
visitInfo = afwImage.makeVisitInfo(exposureTime=1.0)
exposure.getInfo().setVisitInfo(visitInfo)
return exposure

def _extractAmpId(self, dataId):
return (self._extractDetectorName(dataId), 0, 0)
Expand Down

0 comments on commit d1d1d11

Please sign in to comment.