LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Functions
lsst.meas.astrom.denormalizeMatches Namespace Reference

Functions

def denormalizeMatches (matches, matchMeta=None)
 

Function Documentation

◆ denormalizeMatches()

def lsst.meas.astrom.denormalizeMatches.denormalizeMatches (   matches,
  matchMeta = None 
)
Generate a denormalized Catalog of matches

Parameters
----------
matches : `list` of `lsst.afw.table.ReferenceMatch`
    List of matches between reference catalog and source catalog.
matchMeta : `lsst.daf.base.PropertyList`
    Matching metadata to write in catalog.

Returns
-------
catalog : `lsst.afw.table.BaseCatalog`
    Catalog containing matchlist entries.

Notes
-----
This is intended for writing matches in a convenient way.
Normally we write matches in a 'normalized' form: recording only the join
table (reference ID, source ID) to minimise space (the reference and source
catalogs should both be available separately, so the only extra information
we need is how to join them). However, using that can be a pain, since it
requires reading each catalog and doing the join.

This function generates a Catalog containing all the information in the
matches. The reference catalog entries are in columns with 'ref'
prepended, while the source catalog entries are in columns with 'src'
prepended (including any alias mappings). The distance between the
matches is in a column named "distance".

See Also
--------
lsst.afw.table.packMatches

Definition at line 27 of file denormalizeMatches.py.

27 def denormalizeMatches(matches, matchMeta=None):
28  """Generate a denormalized Catalog of matches
29 
30  Parameters
31  ----------
32  matches : `list` of `lsst.afw.table.ReferenceMatch`
33  List of matches between reference catalog and source catalog.
34  matchMeta : `lsst.daf.base.PropertyList`
35  Matching metadata to write in catalog.
36 
37  Returns
38  -------
39  catalog : `lsst.afw.table.BaseCatalog`
40  Catalog containing matchlist entries.
41 
42  Notes
43  -----
44  This is intended for writing matches in a convenient way.
45  Normally we write matches in a 'normalized' form: recording only the join
46  table (reference ID, source ID) to minimise space (the reference and source
47  catalogs should both be available separately, so the only extra information
48  we need is how to join them). However, using that can be a pain, since it
49  requires reading each catalog and doing the join.
50 
51  This function generates a Catalog containing all the information in the
52  matches. The reference catalog entries are in columns with 'ref'
53  prepended, while the source catalog entries are in columns with 'src'
54  prepended (including any alias mappings). The distance between the
55  matches is in a column named "distance".
56 
57  See Also
58  --------
59  lsst.afw.table.packMatches
60  """
61  # TODO: DM-16863 Current this link is removed due to the conversion of
62  # afw.table not yet being complete and causing an error on build.
63  # """
64  if len(matches) == 0:
65  raise RuntimeError("No matches provided.")
66 
67  refSchema = matches[0].first.getSchema()
68  srcSchema = matches[0].second.getSchema()
69 
70  refMapper, srcMapper = afwTable.SchemaMapper.join([refSchema, srcSchema], ["ref_", "src_"])
71  schema = refMapper.editOutputSchema()
72 
73  schema = afwTable.catalogMatches.copyAliasMapWithPrefix(srcSchema, schema, prefix="src_")
74  schema = afwTable.catalogMatches.copyAliasMapWithPrefix(refSchema, schema, prefix="ref_")
75 
76  distKey = schema.addField("distance", type=float, doc="Distance between ref and src")
77 
78  catalog = afwTable.BaseCatalog(schema)
79  catalog.reserve(len(matches))
80  for mm in matches:
81  row = catalog.addNew()
82  row.assign(mm.first, refMapper)
83  row.assign(mm.second, srcMapper)
84  row.set(distKey, mm.distance)
85 
86  if matchMeta is not None:
87  catalog.getTable().setMetadata(matchMeta)
88 
89  return catalog
def denormalizeMatches(matches, matchMeta=None)