22 from __future__
import absolute_import, division, print_function
24 __all__ = [
"setMatchDistance"]
26 import lsst.afw.table
as afwTable
30 """Set the distance field of the matches in a match list to the distance in radians on the sky
32 @warning the coord field of the source in each match must be correct
34 @param[in,out] matches a list of matches, an instance of lsst.afw.table.ReferenceMatch
35 reads the coord field of the source and reference object of each match
36 writes the distance field of each match
41 sourceCoordKey = afwTable.CoordKey(matches[0].first.schema[
"coord"])
42 refObjCoordKey = afwTable.CoordKey(matches[0].second.schema[
"coord"])
44 sourceCoord = match.first.get(sourceCoordKey)
45 refObjCoord = match.second.get(refObjCoordKey)
46 match.distance = refObjCoord.angularSeparation(sourceCoord).asRadians()