Coverage for tests/test_ticket2707.py : 97%
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 2008, 2009, 2010 LSST Corporation. # # 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/>. #
"""Test that matching sources by centroid works as expected, even when some of the centroids contain NaN. """
self.schema, "cen", "center", "pixels") # These will provide the exact matches, though the two records we're setting right now won't # match each other (because cat2 counts down in reverse). # Deliberately offset position in cat2 by 2 pixels and a bit so that it will match a # different source. This gives us an extra match when we're not just getting the closest. # The "2 pixels" makes it line up with a different source. # The "a bit" is half a match radius, so that it's still within the matching radius, but it # doesn't match another source exactly. If it matches another source exactly, then it's not # clear which one will be taken as the match (in fact, it # appears to depend on the compiler). else: # Test that we can handle NANs
"""Test using MatchControl to return all matches
Also tests closest==False at the same time """ self.cat1, self.cat2, self.matchRadius, mc)
if False: for m in matches: print(closest, m.first.getId(), m.second.getId(), m.distance)
else: catMatches, self.cat2, self.matchRadius, mc) catMismatches, self.cat2, self.matchRadius, mc)
# If we're not getting only the closest match, then we get an extra match due to the # source we offset by 2 pixels and a bit. Everything else # should match exactly. len(matches), self.nUniqueMatch if closest else self.nUniqueMatch + 1) sum(1 for m in matches if m.distance == 0.0), self.nUniqueMatch) self.nobj, m.second.getId()) else:
"""Test doing a self-matches"""
if False: for m in matches: print(m.first.getId(), m.second.getId(), m.distance)
# There is only one source that matches another source when we do a self-match: the one # offset by 2 pixels and a bit. # If we're getting symmetric matches, that multiplies the expected number by 2 because it # produces s1,s2 and s2,s1.
lsst.utils.tests.init() unittest.main() |