lsst.meas.base gc76e4e2a6e+28356f993d
Loading...
Searching...
No Matches
Classes | Variables
lsst.meas.base.forcedPhotCoadd Namespace Reference

Classes

class  ForcedPhotCoaddConnections
 

Variables

None butler : `None`
 
lsst refSchema : `lsst.afw.table.Schema`, optional
 
dict initInputs : `dict`
 
DataId exposureDataId : `DataId`
 
lsst exposure : `lsst.afw.image.exposure.Exposure`
 
lsst refCat : `lsst.afw.table.SourceCatalog`
 
lsst refCatInBand : `lsst.afw.table.SourceCatalog`
 
lsst refWcs : `lsst.afw.image.SkyWcs`
 
str idPackerName : `str`
 
ScarletDataModel footprintData : `ScarletDataModel` or `lsst.afw.table.SourceCatalog`
 
lsst measCat : `lsst.afw.table.SourceCatalog`
 
int expId : `int`
 
int exposureId : `int`
 
lsst result : ~`lsst.pipe.base.Struct`
 

Variable Documentation

◆ butler

None lsst.meas.base.forcedPhotCoadd.butler : `None`

Definition at line 173 of file forcedPhotCoadd.py.

◆ expId

int lsst.meas.base.forcedPhotCoadd.expId : `int`

Definition at line 265 of file forcedPhotCoadd.py.

◆ exposure

lsst lsst.meas.base.forcedPhotCoadd.exposure : `lsst.afw.image.exposure.Exposure`

Definition at line 244 of file forcedPhotCoadd.py.

◆ exposureDataId

DataId lsst.meas.base.forcedPhotCoadd.exposureDataId : `DataId`
ConfigClass = ForcedPhotCoaddConfig
_DefaultName = "forcedPhotCoadd"
dataPrefix = "deepCoadd_"

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)

    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):

Definition at line 242 of file forcedPhotCoadd.py.

◆ exposureId

int lsst.meas.base.forcedPhotCoadd.exposureId : `int`

Definition at line 317 of file forcedPhotCoadd.py.

◆ footprintData

ScarletDataModel lsst.meas.base.forcedPhotCoadd.footprintData : `ScarletDataModel` or `lsst.afw.table.SourceCatalog`

Definition at line 255 of file forcedPhotCoadd.py.

◆ idPackerName

str lsst.meas.base.forcedPhotCoadd.idPackerName : `str`

Definition at line 253 of file forcedPhotCoadd.py.

◆ initInputs

dict lsst.meas.base.forcedPhotCoadd.initInputs : `dict`

Definition at line 179 of file forcedPhotCoadd.py.

◆ measCat

lsst lsst.meas.base.forcedPhotCoadd.measCat : `lsst.afw.table.SourceCatalog`
exposureIdInfo = ExposureIdInfo.fromDataId(exposureDataId, idPackerName)
idFactory = exposureIdInfo.makeSourceIdFactory()

measCat = self.measurement.generateMeasCat(exposure, refCat, refWcs,
                                           idFactory=idFactory)
# attach footprints here 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 run(self, measCat, exposure, refCat, refWcs, exposureId=None):

Definition at line 263 of file forcedPhotCoadd.py.

◆ refCat

lsst lsst.meas.base.forcedPhotCoadd.refCat : `lsst.afw.table.SourceCatalog`

Definition at line 246 of file forcedPhotCoadd.py.

◆ refCatInBand

lsst lsst.meas.base.forcedPhotCoadd.refCatInBand : `lsst.afw.table.SourceCatalog`

Definition at line 248 of file forcedPhotCoadd.py.

◆ refSchema

lsst lsst.meas.base.forcedPhotCoadd.refSchema : `lsst.afw.table.Schema`, optional

Definition at line 175 of file forcedPhotCoadd.py.

◆ refWcs

lsst lsst.meas.base.forcedPhotCoadd.refWcs : `lsst.afw.image.SkyWcs`

Definition at line 251 of file forcedPhotCoadd.py.

◆ result

lsst lsst.meas.base.forcedPhotCoadd.result : ~`lsst.pipe.base.Struct`

Definition at line 323 of file forcedPhotCoadd.py.