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
Parameters
----------
matches :
Sequence of matches, typically of type SimpleMatch,
ReferenceMatch or SourceMatch. Each element must support:
`.first.getId()`->int, `.second.getId()->int` and
`.distance->float`.
Returns
-------
result :
The catalog of matches.
Notes
-----
This pure python implementation exists as a historical artifact
related to SWIG limitations. It might be practical to wrap the
overloaded C++ functions with pybind11, but there didn't seem much
point.
Definition at line 111 of file _match.py.
112 """Make a catalog of matches from a sequence of matches.
114 The catalog contains three fields:
115 - first: the ID of the first source record in each match
116 - second: the ID of the second source record in each match
117 - distance: the distance of each match
122 Sequence of matches, typically of type SimpleMatch,
123 ReferenceMatch or SourceMatch. Each element must support:
124 `.first.getId()`->int, `.second.getId()->int` and
130 The catalog of matches.
134 This pure python implementation exists as a historical artifact
135 related to SWIG limitations. It might be practical to wrap the
136 overloaded C++ functions with pybind11, but there didn't seem much
140 outKey1 = schema.addField(
"first", type=np.int64,
141 doc=
"ID for first source record in match.")
142 outKey2 = schema.addField(
"second", type=np.int64,
143 doc=
"ID for second source record in match.")
144 keyD = schema.addField(
"distance", type=np.float64,
145 doc=
"Distance between matches sources.")
147 result.table.preallocate(len(matches))
148 for match
in matches:
149 record = result.addNew()
150 record.set(outKey1, match.first.getId())
151 record.set(outKey2, match.second.getId())
152 record.set(keyD, match.distance)