Coverage for python/lsst/afw/table/match/matchContinued.py : 65%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
# # LSST Data Management System # Copyright 2017 LSST/AURA. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <http://www.lsstcorp.org/LegalNotices/>. #
return "Match(%s,\n %s,\n %g)" % \ (repr(self.first), repr(self.second), self.distance)
return ""
return " x,y=(%g,%g)" % (s.getX(), s.getY())
"""Treat a Match as a tuple of length 3: (first, second, distance)""" raise IndexError(i) i += 3 else: return self.distance
"""Treat a Match as a tuple of length 3: (first, second, distance)""" if i > 2 or i < -3: raise IndexError(i) if i < 0: i += 3 if i == 0: self.first = val elif i == 1: self.second = val else: self.distance = val
return 3
return self.__class__(self.first, self.second, self.distance)
# Pickling support disabled for this type (see testSourceMatch comment for reasoning) # def __getstate__(self): # return self.first, self.second, self.distance # # # def __setstate__(self, state): # self.__init__(*state)
# matchCls.__getstate__ = __getstate__ # matchCls.__setstate__ = __setstate__
"""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. """ doc="ID for first source record in match.") doc="ID for second source record in match.") doc="Distance between matches sources.") |