2 __all__ = [
"denormalizeMatches"]
8 """Generate a denormalized Catalog of matches 10 This is intended for writing matches in a convenient way. 11 Normally we write matches in a 'normalized' form: recording only the join 12 table (reference ID, source ID) to minimise space (the reference and source 13 catalogs should both be available separately, so the only extra information 14 we need is how to join them). However, using that can be a pain, since it 15 requires reading each catalog and doing the join. 17 This function generates a Catalog containing all the information in the 18 matches. The reference catalog entries are in columns with "ref_" 19 prepended, while the source catalog entries are in columns with "src_" 20 prepended. The distance between the matches is in a column named 25 matches : `list` of `lsst.afw.table.ReferenceMatch` 26 List of matches between reference catalog and source catalog. 27 matchMeta : `lsst.daf.base.PropertyList` 28 Matching metadata to write in catalog. 32 catalog : `lsst.afw.table.BaseCatalog` 33 Catalog containing matchlist entries. 37 `lsst.afw.table.packMatches` 40 raise RuntimeError(
"No matches provided.")
42 refSchema = matches[0].first.getSchema()
43 srcSchema = matches[0].second.getSchema()
46 schema = refMapper.editOutputSchema()
47 distKey = schema.addField(
"distance", type=float, doc=
"Distance between ref and src")
50 catalog.reserve(len(matches))
52 row = catalog.addNew()
53 row.assign(mm.first, refMapper)
54 row.assign(mm.second, srcMapper)
55 row.set(distKey, mm.distance)
57 if matchMeta
is not None:
58 catalog.getTable().setMetadata(matchMeta)
def denormalizeMatches(matches, matchMeta=None)
static std::vector< SchemaMapper > join(std::vector< Schema > const &inputs, std::vector< std::string > const &prefixes=std::vector< std::string >())