_DefaultName = "mergeCoaddMeasurements"
ConfigClass = MergeMeasurementsConfig
inputDataset = "meas"
outputDataset = "ref"
def __init__(self, butler=None, schema=None, initInputs=None, **kwargs):
super().__init__(**kwargs)
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:
schema = initInputs['inputSchema'].schema
if schema is None:
raise ValueError("No input schema or initInputs['inputSchema'] provided.")
inputSchema = schema
self.schemaMapper = afwTable.SchemaMapper(inputSchema, True)
self.schemaMapper.addMinimalSchema(inputSchema, True)
self.instFluxKey = inputSchema.find(self.config.snName + "_instFlux").getKey()
self.instFluxErrKey = inputSchema.find(self.config.snName + "_instFluxErr").getKey()
self.fluxFlagKey = inputSchema.find(self.config.snName + "_flag").getKey()
self.flagKeys = {}
for band in self.config.priorityList:
outputKey = self.schemaMapper.editOutputSchema().addField(
"merge_measurement_%s" % band,
type="Flag",
doc="Flag field set if the measurements here are from the %s filter" % band
)
peakKey = inputSchema.find("merge_peak_%s" % band).key
footprintKey = inputSchema.find("merge_footprint_%s" % band).key
self.flagKeys[band] = pipeBase.Struct(peak=peakKey, footprint=footprintKey, output=outputKey)
self.schema = self.schemaMapper.getOutputSchema()
self.pseudoFilterKeys = []
for filt in self.config.pseudoFilterList:
try:
self.pseudoFilterKeys.append(self.schema.find("merge_peak_%s" % filt).getKey())
except Exception as e:
self.log.warning("merge_peak is not set for pseudo-filter %s: %s", filt, e)
self.badFlags = {}
for flag in self.config.flags:
try:
self.badFlags[flag] = self.schema.find(flag).getKey()
except KeyError as exc:
self.log.warning("Can't find flag %s in schema: %s", flag, exc)
self.outputSchema = afwTable.SourceCatalog(self.schema)
def runQuantum(self, butlerQC, inputRefs, outputRefs):
inputs = butlerQC.get(inputRefs)
dataIds = (ref.dataId for ref in inputRefs.catalogs)
catalogDict = {dataId['band']: cat for dataId, cat in zip(dataIds, inputs['catalogs'])}
inputs['catalogs'] = catalogDict
outputs = self.run(**inputs)
butlerQC.put(outputs, outputRefs)
def run(self, catalogs):
Definition at line 209 of file mergeMeasurements.py.