22 from lsst.pipe.base import (Struct, PipelineTask, InitInputDatasetField, InitOutputDatasetField,
23 InputDatasetField, OutputDatasetField, PipelineTaskConfig)
31 __all__ = (
"DeblendCoaddSourcesSingleConfig",
"DeblendCoaddSourcesSingleTask",
32 "DeblendCoaddSourcesMultiConfig",
"DeblendCoaddSourcesMultiTask")
37 doc=
"Input schema to use in the deblend catalog",
38 nameTemplate=
"{inputCoaddName}Coadd_mergeDet_schema",
39 storageClass=
"SourceCatalog" 42 doc=
"Schema of the footprint peak catalogs",
43 nameTemplate=
"{inputCoaddName}Coadd_peak_schema",
44 storageClass=
"PeakCatalog" 47 doc=
"Detection catalog merged across bands",
48 nameTemplate=
"{inputCoaddName}Coadd_mergeDet",
49 storageClass=
"SourceCatalog",
51 dimensions=(
"tract",
"patch",
"skymap")
56 self.quantum.dimensions = (
"tract",
"patch",
"abstract_filter",
"skymap")
57 self.formatTemplateNames({
"inputCoaddName":
"deep",
"outputCoaddName":
"deep"})
62 target=SourceDeblendTask,
63 doc=
"Task to deblend an image in one band" 66 doc=
"Exposure on which to run deblending",
67 nameTemplate=
"{inputCoaddName}Coadd_calexp",
68 storageClass=
"ExposureF",
70 dimensions=(
"tract",
"patch",
"abstract_filter",
"skymap")
73 doc=
"The output measurement catalog of deblended sources",
74 nameTemplate=
"{outputCoaddName}Coadd_deblendedFlux",
76 storageClass=
"SourceCatalog",
77 dimensions=(
"tract",
"patch",
"abstract_filter",
"skymap")
80 doc=
"Output of the schema used in deblending task",
81 nameTemplate=
"{outputCoaddName}Coadd_deblendedFlux_schema",
82 storageClass=
"SourceCatalog" 88 target=MultibandDeblendTask,
89 doc=
"Task to deblend an images in multiple bands" 92 doc=
"Exposure on which to run deblending",
93 nameTemplate=
"{inputCoaddName}Coadd_calexp",
94 storageClass=
"ExposureF",
95 dimensions=(
"tract",
"patch",
"abstract_filter",
"skymap")
98 doc=
"Output of the schema used in deblending task",
99 nameTemplate=
"{outputCoaddName}Coadd_deblendedModel_schema",
100 storageClass=
"SourceCatalog" 103 doc=
"Flux catalogs produced by multiband deblending, not written " 104 "if conserve flux is turned off",
105 nameTemplate=
"{outputCoaddName}Coadd_deblendedFlux",
106 storageClass=
"SourceCatalog",
107 dimensions=(
"tract",
"patch",
"abstract_filter",
"skymap")
110 doc=
"Template catalogs produced by multiband deblending",
111 nameTemplate=
"{outputCoaddName}Coadd_deblendedModel",
112 storageClass=
"SourceCatalog",
113 dimensions=(
"tract",
"patch",
"abstract_filter",
"skymap")
118 self.quantum.dimensions = (
"tract",
"patch",
"skymap")
123 super().
__init__(initInputs=initInputs, **kwargs)
124 schema = initInputs[
"inputSchema"].schema
134 packedId, maxBits = butler.registry.packDataId(
"tract_patch", inputDataIds[
"mergedDetections"],
136 inputData[
"idFactory"] = afwTable.IdFactory.makeSource(packedId, 64 - maxBits)
137 return self.run(**inputData)
139 def _makeSourceCatalog(self, mergedDetections, idFactory):
140 table = afwTable.SourceTable.make(self.
schema, idFactory)
147 ConfigClass = DeblendCoaddSourcesSingleConfig
148 _DefaultName =
"deblendCoaddSourcesSingle" 151 super().
__init__(initInputs=initInputs, **kwargs)
152 self.makeSubtask(
"singleBandDeblend", schema=self.
schema, peakSchema=self.
peakSchema)
154 def run(self, coadd, mergedDetections, idFactory):
156 self.singleBandDeblend.
run(coadd, sources)
157 return Struct(measureCatalog=sources)
161 ConfigClass = DeblendCoaddSourcesMultiConfig
162 _DefaultName =
"deblendCoaddSourcesMulti" 165 super().
__init__(initInputs=initInputs, **kwargs)
166 self.makeSubtask(
"multibandDeblend", schema=self.
schema, peakSchema=self.
peakSchema)
172 if not config.multibandDeblend.conserveFlux:
173 outputTypeDict.pop(
"fluxCatalogs",
None)
174 return outputTypeDict
177 inputData[
"filters"] = [dId[
"abstract_filter"]
for dId
in inputDataIds[
"coadds"]]
178 return super().
adaptArgsAndRun(inputData, inputDataIds, outputDataIds, butler)
180 def run(self, coadds, filters, mergedDetections, idFactory):
182 multiExposure = afwImage.MultibandExposure.fromExposures(filters, coadds)
183 fluxCatalogs, templateCatalogs = self.multibandDeblend.
run(multiExposure, sources)
184 retStruct = Struct(templateCatalogs)
185 if self.config.multibandDeblend.conserveFlux:
186 retStruct.fluxCatalogs = fluxCatalogs
def _makeSourceCatalog(self, mergedDetections, idFactory)
def InitOutputDatasetField
def __init__(self, initInputs, kwargs)
A mapping between the keys of two Schemas, used to copy data between them.
def run(self, coadds, filters, mergedDetections, idFactory)
def __init__(self, initInputs, kwargs)
def run(self, coadd, mergedDetections, idFactory)
def __init__(self, initInputs, kwargs)
def adaptArgsAndRun(self, inputData, inputDataIds, outputDataIds, butler)
def InitInputDatasetField
def adaptArgsAndRun(self, inputData, inputDataIds, outputDataIds, butler)
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
def getInitOutputDatasets(self)
def getOutputDatasetTypes(cls, config)