lsst.pipe.tasks g8b9e2231ea+fa07cb600e
|
Classes | |
class | MakeCoaddTempExpConfig |
class | MakeCoaddTempExpTask |
Warp and optionally PSF-Match calexps onto an a common projection. More... | |
class | MakeWarpConnections |
class | MissingExposureError |
Variables | |
logging | log = logging.getLogger(__name__) |
bgSubtracted | |
list | indices : `list` of integers |
dict | inputs : `dict` of `list` of input connections to be passed to run |
list | calExpList : `list` of `lsst.afw.image.Exposure` |
list | backgroundList : `list` of `lsst.afw.math.backgroundList`, optional |
list | skyCorrList : `list` of `lsst.afw.math.backgroundList`, optional |
doApplySkyCorr | |
lsst | externalSkyWcsCatalog : `lsst.afw.table.ExposureCatalog`, optional |
doApplyExternalSkyWcs | |
lsst | externalPhotoCalibCatalog : `lsst.afw.table.ExposureCatalog`, optional |
doApplyExternalPhotoCalib | |
lsst | finalizedPsfApCorrCatalog : `lsst.afw.table.ExposureCatalog`, optional |
doApplyFinalizedPsf | |
lsst | inputRefs : `lsst.pipe.base.connections.QuantizedConnection` |
iterable | outputSortKeyOrder |
list lsst.pipe.tasks.makeCoaddTempExp.backgroundList : `list` of `lsst.afw.math.backgroundList`, optional |
Definition at line 868 of file makeCoaddTempExp.py.
lsst.pipe.tasks.makeCoaddTempExp.bgSubtracted |
Definition at line 612 of file makeCoaddTempExp.py.
list lsst.pipe.tasks.makeCoaddTempExp.calExpList : `list` of `lsst.afw.image.Exposure` |
for key in inputs.keys(): # Only down-select on list inputs if isinstance(inputs[key], list): inputs[key] = [inputs[key][ind] for ind in indices] return inputs def prepareCalibratedExposures(self, calExpList, backgroundList=None, skyCorrList=None, externalSkyWcsCatalog=None, externalPhotoCalibCatalog=None, finalizedPsfApCorrCatalog=None, **kwargs):
Definition at line 866 of file makeCoaddTempExp.py.
lsst.pipe.tasks.makeCoaddTempExp.doApplyExternalPhotoCalib |
Definition at line 878 of file makeCoaddTempExp.py.
lsst.pipe.tasks.makeCoaddTempExp.doApplyExternalSkyWcs |
Definition at line 874 of file makeCoaddTempExp.py.
lsst.pipe.tasks.makeCoaddTempExp.doApplyFinalizedPsf |
Definition at line 882 of file makeCoaddTempExp.py.
lsst.pipe.tasks.makeCoaddTempExp.doApplySkyCorr |
Definition at line 871 of file makeCoaddTempExp.py.
lsst lsst.pipe.tasks.makeCoaddTempExp.externalPhotoCalibCatalog : `lsst.afw.table.ExposureCatalog`, optional |
Definition at line 876 of file makeCoaddTempExp.py.
lsst lsst.pipe.tasks.makeCoaddTempExp.externalSkyWcsCatalog : `lsst.afw.table.ExposureCatalog`, optional |
Definition at line 872 of file makeCoaddTempExp.py.
lsst lsst.pipe.tasks.makeCoaddTempExp.finalizedPsfApCorrCatalog : `lsst.afw.table.ExposureCatalog`, optional |
Definition at line 880 of file makeCoaddTempExp.py.
ConfigClass = MakeWarpConfig _DefaultName = "makeWarp" @utils.inheritDoc(pipeBase.PipelineTask) def runQuantum(self, butlerQC, inputRefs, outputRefs):
# Obtain the list of input detectors from calExpList. Sort them by # detector order (to ensure reproducibility). Then ensure all input # lists are in the same sorted detector order. detectorOrder = [ref.datasetRef.dataId['detector'] for ref in inputRefs.calExpList] detectorOrder.sort() inputRefs = reorderRefs(inputRefs, detectorOrder, dataIdKey='detector') # Read in all inputs. inputs = butlerQC.get(inputRefs) # Construct skyInfo expected by `run`. We remove the SkyMap itself # from the dictionary so we can pass it as kwargs later. skyMap = inputs.pop("skyMap") quantumDataId = butlerQC.quantum.dataId skyInfo = makeSkyInfo(skyMap, tractId=quantumDataId['tract'], patchId=quantumDataId['patch']) # Construct list of input DataIds expected by `run` dataIdList = [ref.datasetRef.dataId for ref in inputRefs.calExpList] # Construct list of packed integer IDs expected by `run` ccdIdList = [dataId.pack("visit_detector") for dataId in dataIdList] # Run the selector and filter out calexps that were not selected # primarily because they do not overlap the patch cornerPosList = lsst.geom.Box2D(skyInfo.bbox).getCorners() coordList = [skyInfo.wcs.pixelToSky(pos) for pos in cornerPosList] goodIndices = self.select.run(**inputs, coordList=coordList, dataIds=dataIdList) inputs = self.filterInputs(indices=goodIndices, inputs=inputs) # Read from disk only the selected calexps inputs['calExpList'] = [ref.get() for ref in inputs['calExpList']] # Extract integer visitId requested by `run` visits = [dataId['visit'] for dataId in dataIdList] visitId = visits[0] if self.config.doApplyExternalSkyWcs: if self.config.useGlobalExternalSkyWcs: externalSkyWcsCatalog = inputs.pop("externalSkyWcsGlobalCatalog") else: externalSkyWcsCatalog = inputs.pop("externalSkyWcsTractCatalog") else: externalSkyWcsCatalog = None if self.config.doApplyExternalPhotoCalib: if self.config.useGlobalExternalPhotoCalib: externalPhotoCalibCatalog = inputs.pop("externalPhotoCalibGlobalCatalog") else: externalPhotoCalibCatalog = inputs.pop("externalPhotoCalibTractCatalog") else: externalPhotoCalibCatalog = None if self.config.doApplyFinalizedPsf: finalizedPsfApCorrCatalog = inputs.pop("finalizedPsfApCorrCatalog") else: finalizedPsfApCorrCatalog = None completeIndices = self.prepareCalibratedExposures(**inputs, externalSkyWcsCatalog=externalSkyWcsCatalog, externalPhotoCalibCatalog=externalPhotoCalibCatalog, finalizedPsfApCorrCatalog=finalizedPsfApCorrCatalog) # Redo the input selection with inputs with complete wcs/photocalib info. inputs = self.filterInputs(indices=completeIndices, inputs=inputs) results = self.run(**inputs, visitId=visitId, ccdIdList=[ccdIdList[i] for i in goodIndices], dataIdList=[dataIdList[i] for i in goodIndices], skyInfo=skyInfo) if self.config.makeDirect and results.exposures["direct"] is not None: butlerQC.put(results.exposures["direct"], outputRefs.direct) if self.config.makePsfMatched and results.exposures["psfMatched"] is not None: butlerQC.put(results.exposures["psfMatched"], outputRefs.psfMatched) def filterInputs(self, indices, inputs):
Definition at line 849 of file makeCoaddTempExp.py.
lsst lsst.pipe.tasks.makeCoaddTempExp.inputRefs : `lsst.pipe.base.connections.QuantizedConnection` |
backgroundList = len(calExpList)*[None] if backgroundList is None else backgroundList skyCorrList = len(calExpList)*[None] if skyCorrList is None else skyCorrList includeCalibVar = self.config.includeCalibVar indices = [] for index, (calexp, background, skyCorr) in enumerate(zip(calExpList, backgroundList, skyCorrList)): if not self.config.bgSubtracted: calexp.maskedImage += background.getImage() detectorId = calexp.getInfo().getDetector().getId() # Find the external photoCalib if externalPhotoCalibCatalog is not None: row = externalPhotoCalibCatalog.find(detectorId) if row is None: self.log.warning("Detector id %s not found in externalPhotoCalibCatalog " "and will not be used in the warp.", detectorId) continue photoCalib = row.getPhotoCalib() if photoCalib is None: self.log.warning("Detector id %s has None for photoCalib in externalPhotoCalibCatalog " "and will not be used in the warp.", detectorId) continue calexp.setPhotoCalib(photoCalib) else: photoCalib = calexp.getPhotoCalib() if photoCalib is None: self.log.warning("Detector id %s has None for photoCalib in the calexp " "and will not be used in the warp.", detectorId) continue # Find and apply external skyWcs if externalSkyWcsCatalog is not None: row = externalSkyWcsCatalog.find(detectorId) if row is None: self.log.warning("Detector id %s not found in externalSkyWcsCatalog " "and will not be used in the warp.", detectorId) continue skyWcs = row.getWcs() if skyWcs is None: self.log.warning("Detector id %s has None for skyWcs in externalSkyWcsCatalog " "and will not be used in the warp.", detectorId) continue calexp.setWcs(skyWcs) else: skyWcs = calexp.getWcs() if skyWcs is None: self.log.warning("Detector id %s has None for skyWcs in the calexp " "and will not be used in the warp.", detectorId) continue # Find and apply finalized psf and aperture correction if finalizedPsfApCorrCatalog is not None: row = finalizedPsfApCorrCatalog.find(detectorId) if row is None: self.log.warning("Detector id %s not found in finalizedPsfApCorrCatalog " "and will not be used in the warp.", detectorId) continue psf = row.getPsf() if psf is None: self.log.warning("Detector id %s has None for psf in finalizedPsfApCorrCatalog " "and will not be used in the warp.", detectorId) continue calexp.setPsf(psf) apCorrMap = row.getApCorrMap() if apCorrMap is None: self.log.warning("Detector id %s has None for ApCorrMap in finalizedPsfApCorrCatalog " "and will not be used in the warp.", detectorId) continue calexp.info.setApCorrMap(apCorrMap) # Calibrate the image calexp.maskedImage = photoCalib.calibrateImage(calexp.maskedImage, includeScaleUncertainty=includeCalibVar) calexp.maskedImage /= photoCalib.getCalibrationMean() # TODO: The images will have a calibration of 1.0 everywhere once RFC-545 is implemented. # exposure.setCalib(afwImage.Calib(1.0)) # Apply skycorr if self.config.doApplySkyCorr: calexp.maskedImage -= skyCorr.getImage() indices.append(index) return indices def reorderRefs(inputRefs, outputSortKeyOrder, dataIdKey):
Definition at line 994 of file makeCoaddTempExp.py.
dict lsst.pipe.tasks.makeCoaddTempExp.inputs : `dict` of `list` of input connections to be passed to run |
Definition at line 850 of file makeCoaddTempExp.py.
logging lsst.pipe.tasks.makeCoaddTempExp.log = logging.getLogger(__name__) |
Definition at line 44 of file makeCoaddTempExp.py.
iterable lsst.pipe.tasks.makeCoaddTempExp.outputSortKeyOrder |
Definition at line 996 of file makeCoaddTempExp.py.
list lsst.pipe.tasks.makeCoaddTempExp.skyCorrList : `list` of `lsst.afw.math.backgroundList`, optional |
Definition at line 870 of file makeCoaddTempExp.py.