Make a catalog of matches from a sequence of matches.
The catalog contains three fields:
- first: the ID of the first source record in each match
- second: the ID of the second source record in each match
- distance: the distance of each match
@param[in] matches Sequence of matches, typically of type SimpleMatch, ReferenceMatch or SourceMatch.
Each element must support: `.first.getId()`->int, `.second.getId()->int` and `.distance->float`.
@return a catalog of matches.
@note this pure python implementation exists because SWIG could not easily be used to wrap
the overloaded C++ functions, so this was written and tested. It might be practical
to wrap the overloaded C++ functions with pybind11, but there didn't seem much point.
Definition at line 108 of file matchContinued.py.
109 """Make a catalog of matches from a sequence of matches. 111 The catalog contains three fields: 112 - first: the ID of the first source record in each match 113 - second: the ID of the second source record in each match 114 - distance: the distance of each match 116 @param[in] matches Sequence of matches, typically of type SimpleMatch, ReferenceMatch or SourceMatch. 117 Each element must support: `.first.getId()`->int, `.second.getId()->int` and `.distance->float`. 118 @return a catalog of matches. 120 @note this pure python implementation exists because SWIG could not easily be used to wrap 121 the overloaded C++ functions, so this was written and tested. It might be practical 122 to wrap the overloaded C++ functions with pybind11, but there didn't seem much point. 125 outKey1 = schema.addField(
"first", type=np.int64,
126 doc=
"ID for first source record in match.")
127 outKey2 = schema.addField(
"second", type=np.int64,
128 doc=
"ID for second source record in match.")
129 keyD = schema.addField(
"distance", type=np.float64,
130 doc=
"Distance between matches sources.")
132 result.table.preallocate(len(matches))
133 for match
in matches:
134 record = result.addNew()
135 record.set(outKey1, match.first.getId())
136 record.set(outKey2, match.second.getId())
137 record.set(keyD, match.distance)
139 CatalogT< BaseRecord > BaseCatalog