|
lsst.meas.base g33b6a96d52+2ba7947ec2
|
ConfigClass = ForcedPhotCoaddConfig
RunnerClass = ForcedPhotCoaddRunner
_DefaultName = "forcedPhotCoadd"
dataPrefix = "deepCoadd_"
def __init__(self, butler=None, refSchema=None, initInputs=None, **kwds):
super().__init__(**kwds)
if initInputs is not None:
refSchema = initInputs['inputSchema'].schema
self.makeSubtask("references", butler=butler, schema=refSchema)
if refSchema is None:
refSchema = self.references.schema
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)
refCatInBand = inputs.pop('refCatInBand')
if self.config.footprintDatasetName == "ScarletModelData":
footprintData = inputs.pop("scarletModels")
elif self.config.footprintDatasetName == "DeblendedFlux":
footprintData = inputs.pop("footprintCatIndBand")
else:
footprintData = None
inputs['measCat'], inputs['exposureId'] = self.generateMeasCat(inputRefs.exposure.dataId,
inputs['exposure'],
inputs['refCat'],
refCatInBand,
inputs['refWcs'],
"tract_patch",
footprintData)
outputs = self.run(**inputs)
# Strip HeavyFootprints to save space on disk
if self.config.footprintDatasetName == "ScarletModelData" and self.config.doStripFootprints:
sources = outputs.measCat
for source in sources[sources["parent"] != 0]:
source.setFootprint(None)
butlerQC.put(outputs, outputRefs)
def generateMeasCat(self, exposureDataId, exposure, refCat, refCatInBand, refWcs, idPackerName,
footprintData):exposureIdInfo = ExposureIdInfo.fromDataId(exposureDataId, idPackerName)
idFactory = exposureIdInfo.makeSourceIdFactory()
measCat = self.measurement.generateMeasCat(exposure, refCat, refWcs,
idFactory=idFactory)
# attach footprints here, as the attachFootprints method is geared for gen2
# and is not worth modifying, as this can naturally live inside this method
if self.config.footprintDatasetName == "ScarletModelData":
# Load the scarlet models
self._attachScarletFootprints(
catalog=measCat,
modelData=footprintData,
exposure=exposure,
band=exposureDataId["band"]
)
else:
if self.config.footprintDatasetName is None:
footprintCat = refCatInBand
else:
footprintCat = footprintData
for srcRecord in measCat:
fpRecord = footprintCat.find(srcRecord.getId())
if fpRecord is None:
raise LookupError("Cannot find Footprint for source {}; please check that {} "
"IDs are compatible with reference source IDs"
.format(srcRecord.getId(), footprintCat))
srcRecord.setFootprint(fpRecord.getFootprint())
return measCat, exposureIdInfo.expId
def runDataRef(self, dataRef, psfCache=None):
Definition at line 332 of file forcedPhotCoadd.py.