I am writing a source catalog by copy a source (src
) from a mergedDet
SourceCatalog (sources
) into a catalog for each band (template_catalogs[band]
).
For sources with a single detection I use
tsrc = template_catalogs[band].addNew()
tsrc.assign(src)
tsrc.set(self.runtimeKey, 0)
but for deblended sources I use
tsrc = template_catalogs[band].addNew()
tsrc.assign(src)
tsrc.set("id", parentId)
tsrc.set(self.runtimeKey, runtime)
tsrc.setFootprint(afwDet.Footprint())
to add the parents (I update the footprints later) and
child = template_catalogs[band].addNew()
child.assign(heavy.getPeaks()[0], self.peakSchemaMapper)
child.setParent(parentId)
child.setFootprint(heavy)
to add the children.
I checked the schema of the SourceCatalog
against the schema for each record in a template_catalogs
for a given band (and they match), but when I try to write the catalog to a file with catalogs["I"].writeFits(os.path.join(savePath, 'templates_I.fits'))
, I get the error:
---------------------------------------------------------------------------
LogicError Traceback (most recent call last)
<ipython-input-17-74b368735cd4> in <module>()
1 savePath = "/home/fred3m/lsst"
----> 2 catalogs["I"].writeFits(os.path.join(savePath, 'templates_I.fits'))
LogicError:
File "src/table/BaseRecord.cc", line 75, in void lsst::afw::table::BaseRecord::assign(const lsst::afw::table::BaseRecord&)
Unequal schemas in record assignment. {0}
lsst::pex::exceptions::LogicError: 'Unequal schemas in record assignment.'
Does anyone have any ideas about what is happening?