ConfigClass = ForcedPhotCcdConfig
_DefaultName = "forcedPhotCcd"
dataPrefix = ""
def __init__(self, butler=None, refSchema=None, initInputs=None, **kwds):
super().__init__(**kwds)
if butler is not None:
warnings.warn("The 'butler' parameter is no longer used and can be safely removed.",
category=FutureWarning, stacklevel=2)
butler = None
if initInputs is not None:
refSchema = initInputs['inputSchema'].schema
if refSchema is None:
raise ValueError("No reference schema provided.")
self.makeSubtask("measurement", refSchema=refSchema)
# It is necessary to get the schema internal to the forced measurement
# task until such a time that the schema is not owned by the
# measurement task, but is passed in by an external caller.
if self.config.doApCorr:
self.makeSubtask("applyApCorr", schema=self.measurement.schema)
self.makeSubtask('catalogCalculation', schema=self.measurement.schema)
self.outputSchema = lsst.afw.table.SourceCatalog(self.measurement.schema)
def runQuantum(self, butlerQC, inputRefs, outputRefs):
inputs = butlerQC.get(inputRefs)
tract = butlerQC.quantum.dataId['tract']
skyMap = inputs.pop('skyMap')
inputs['refWcs'] = skyMap[tract].getWcs()
# Connections only exist if they are configured to be used.
skyCorr = inputs.pop('skyCorr', None)
if self.config.useGlobalExternalSkyWcs:
externalSkyWcsCatalog = inputs.pop('externalSkyWcsGlobalCatalog', None)
else:
externalSkyWcsCatalog = inputs.pop('externalSkyWcsTractCatalog', None)
if self.config.useGlobalExternalPhotoCalib:
externalPhotoCalibCatalog = inputs.pop('externalPhotoCalibGlobalCatalog', None)
else:
externalPhotoCalibCatalog = inputs.pop('externalPhotoCalibTractCatalog', None)
finalizedPsfApCorrCatalog = inputs.pop('finalizedPsfApCorrCatalog', None)
inputs['exposure'] = self.prepareCalibratedExposure(
inputs['exposure'],
skyCorr=skyCorr,
externalSkyWcsCatalog=externalSkyWcsCatalog,
externalPhotoCalibCatalog=externalPhotoCalibCatalog,
finalizedPsfApCorrCatalog=finalizedPsfApCorrCatalog
)
inputs['refCat'] = self.mergeAndFilterReferences(inputs['exposure'], inputs['refCat'],
inputs['refWcs'])
if inputs['refCat'] is None:
self.log.info("No WCS for exposure %s. No %s catalog will be written.",
butlerQC.quantum.dataId, outputRefs.measCat.datasetType.name)
else:
inputs['measCat'], inputs['exposureId'] = self.generateMeasCat(inputRefs.exposure.dataId,
inputs['exposure'],
inputs['refCat'], inputs['refWcs'],
"visit_detector")
self.attachFootprints(inputs['measCat'], inputs['refCat'], inputs['exposure'], inputs['refWcs'])
outputs = self.run(**inputs)
butlerQC.put(outputs, outputRefs)
def prepareCalibratedExposure(self, exposure, skyCorr=None, externalSkyWcsCatalog=None,
externalPhotoCalibCatalog=None, finalizedPsfApCorrCatalog=None):
Definition at line 358 of file forcedPhotCcd.py.