1 from __future__
import absolute_import, division, print_function
3 __all__ = [
"denormalizeMatches"]
9 """Generate a denormalized Catalog of matches 11 This is intended for writing matches in a convenient way. 12 Normally we write matches in a 'normalized' form: recording only the join 13 table (reference ID, source ID) to minimise space (the reference and source 14 catalogs should both be available separately, so the only extra information 15 we need is how to join them). However, using that can be a pain, since it 16 requires reading each catalog and doing the join. 18 This function generates a Catalog containing all the information in the 19 matches. The reference catalog entries are in columns with "ref_" 20 prepended, while the source catalog entries are in columns with "src_" 21 prepended. The distance between the matches is in a column named 26 matches : `list` of `lsst.afw.table.ReferenceMatch` 27 List of matches between reference catalog and source catalog. 28 matchMeta : `lsst.daf.base.PropertyList` 29 Matching metadata to write in catalog. 33 catalog : `lsst.afw.table.BaseCatalog` 34 Catalog containing matchlist entries. 38 `lsst.afw.table.packMatches` 41 raise RuntimeError(
"No matches provided.")
43 refSchema = matches[0].first.getSchema()
44 srcSchema = matches[0].second.getSchema()
47 schema = refMapper.editOutputSchema()
48 distKey = schema.addField(
"distance", type=float, doc=
"Distance between ref and src")
51 catalog.reserve(len(matches))
53 row = catalog.addNew()
54 row.assign(mm.first, refMapper)
55 row.assign(mm.second, srcMapper)
56 row.set(distKey, mm.distance)
58 if matchMeta
is not None:
59 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 >())