def getCalExp(self, dataRef, bgSubtracted): """!Return one "calexp" calibrated exposure @param[in] dataRef a sensor-level data reference @param[in] bgSubtracted return calexp with background subtracted? If False get the calexp's background background model and add it to the calexp. @return calibrated exposure If config.doApplyUberCal, meas_mosaic calibrations will be applied to the returned exposure using applyMosaicResults. """ exposure = dataRef.get("calexp", immediate=True) if not bgSubtracted: background = dataRef.get("calexpBackground", immediate=True) mi = exposure.getMaskedImage() mi += background.getImage() del mi if not self.config.doApplyUberCal: return exposure if applyMosaicResults is None: raise RuntimeError( "Cannot use improved calibrations for %s because meas_mosaic could not be imported." % dataRef.dataId) else: applyMosaicResults(dataRef, calexp=exposure) return exposure
def getCalExp(self, dataRef, bgSubtracted): """!Return one "calexp" calibrated exposure @param[in] dataRef a sensor-level data reference @param[in] bgSubtracted return calexp with background subtracted? If False get the calexp's background background model and add it to the calexp. @return calibrated exposure If config.doApplyUberCal, meas_mosaic calibrations will be applied to the returned exposure using applyMosaicResults. """ exposure = dataRef.get("calexp", immediate=True) if not bgSubtracted: background = dataRef.get("calexpBackground", immediate=True) mi = exposure.getMaskedImage() mi += background.getImage() del mi if not self.config.doApplyUberCal: return exposure if applyMosaicResults is None: raise RuntimeError( "Cannot use improved calibrations for %s because meas_mosaic could not be imported." % dataRef.dataId ) else: applyMosaicResults(dataRef, calexp=exposure) return exposure
def readInputs(self, dataRef): inputs = MeasureImageTask.readInputs(self, dataRef) if self.config.doApplyUberCal: if not applyMosaicResults: raise RuntimeError( "Cannot use improved calibrations for %s because meas_mosaic could not be imported." % dataRef.dataId ) applyMosaicResults(dataRef, calexp=inputs.exposure) return inputs
def getExposure(self, dataRef): """Read input exposure to measure @param dataRef Data reference from butler. Only the 'calexp' dataset is used, unless config.doApplyUberCal is true, in which case the corresponding meas_mosaic outputs are used as well. """ exposure = ForcedPhotImageTask.getExposure(self, dataRef) if not self.config.doApplyUberCal: return exposure if applyMosaicResults is None: raise RuntimeError( "Cannot use improved calibrations for %s because meas_mosaic could not be imported." % (dataRef.dataId, )) else: applyMosaicResults(dataRef, calexp=exposure) return exposure
def readInputExposure(record, bbox): """Given an ExposureRecord and bounding box, load the appropriate subimage.""" dataId = butler.mapper.getDataId(visit=record.get(visitKey), ccdId=record.get(ccdKey)) dataRef = butler.dataRef("calexp", **dataId) exposure = dataRef.get( "calexp_sub", bbox=bbox, immediate=True, ) if self.config.doApplyUberCal: if not applyMosaicResults: raise RuntimeError( "Cannot use improved calibrations for %s because meas_mosaic could not be imported." % dataRef.dataId ) applyMosaicResults(dataRef, calexp=exposure, bbox=bbox) return exposure
def readInputExposure(record, bbox): """Given an ExposureRecord and bounding box, load the appropriate subimage.""" dataId = butler.mapper.getDataId(visit=record.get(visitKey), ccdId=record.get(ccdKey)) dataRef = butler.dataRef("calexp", **dataId) exposure = dataRef.get( "calexp_sub", bbox=bbox, immediate=True, ) if self.config.doApplyUberCal: if not applyMosaicResults: raise RuntimeError( "Cannot use improved calibrations for %s because meas_mosaic could not be imported." % dataRef.dataId) applyMosaicResults(dataRef, calexp=exposure, bbox=bbox) return exposure
def getExposure(self, dataRef): """Read input exposure to measure @param dataRef Data reference from butler. Only the 'calexp' dataset is used, unless config.doApplyUberCal is true, in which case the corresponding meas_mosaic outputs are used as well. """ exposure = ProcessImageForcedTask.getExposure(self, dataRef) if not self.config.doApplyUberCal: return exposure if applyMosaicResults is None: raise RuntimeError( "Cannot use improved calibrations for %s because meas_mosaic could not be imported." % dataRef.dataId ) else: applyMosaicResults(dataRef, calexp=exposure) return exposure
def getExposure(self, dataRef): """Read input exposure for measurement. Parameters ---------- dataRef : `lsst.daf.persistence.ButlerDataRef` Butler data reference. Only the ``calexp`` dataset is used, unless ``config.doApplyUberCal`` is `True`, in which case the corresponding meas_mosaic outputs are used as well. """ exposure = ForcedPhotImageTask.getExposure(self, dataRef) if not self.config.doApplyUberCal: return exposure if applyMosaicResults is None: raise RuntimeError( "Cannot use improved calibrations for %s because meas_mosaic could not be imported." % (dataRef.dataId, )) else: applyMosaicResults(dataRef, calexp=exposure) return exposure
def getExposure(self, dataRef): """Read input exposure for measurement. Parameters ---------- dataRef : `lsst.daf.persistence.ButlerDataRef` Butler data reference. Only the ``calexp`` dataset is used, unless ``config.doApplyUberCal`` is `True`, in which case the corresponding meas_mosaic outputs are used as well. """ exposure = ForcedPhotImageTask.getExposure(self, dataRef) if not self.config.doApplyUberCal: return exposure if applyMosaicResults is None: raise RuntimeError( "Cannot use improved calibrations for %s because meas_mosaic could not be imported." % (dataRef.dataId,)) else: applyMosaicResults(dataRef, calexp=exposure) return exposure
def getExposure(self, dataRef): """Read input exposure to measure @param dataRef Data reference from butler """ if not dataRef.datasetExists(self.dataPrefix + "calexp"): return None exposure = dataRef.get("calexp", immediate=True) if not self.config.doApplyUberCal: return exposure if applyMosaicResults is None: raise RuntimeError( "Cannot use improved calibrations for %s because meas_mosaic could not be imported." % dataRef.dataId ) else: try: applyMosaicResults(dataRef, calexp=exposure) except Exception as err: return None return exposure