Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-18314: reduce namespace confusion for matchOptimisticB #116

Merged
merged 2 commits into from
Mar 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions python/lsst/meas/astrom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#

from .makeMatchStatistics import *
from .matchOptimisticB import *
from .matchOptimisticBTask import *
from .polynomialTransform import *
from .scaledPolynomialTransformFitter import *
from .sipTransform import *
Expand All @@ -31,7 +31,6 @@
from .ref_match import *
from .astrometry import *
from .approximateWcs import *
from .matchOptimisticB import *
from .matchPessimisticB import *
from .setMatchDistance import *
from .display import *
Expand Down
1 change: 0 additions & 1 deletion python/lsst/meas/astrom/matchOptimisticB/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@

from .matchOptimisticB import *
from .matchOptimisticBContinued import *
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

__all__ = ["matchOptimisticB", "MatchOptimisticBTask", "MatchOptimisticBConfig",
__all__ = ["MatchOptimisticBTask", "MatchOptimisticBConfig",
"MatchTolerance"]

import math
Expand All @@ -8,8 +8,8 @@
import lsst.pipe.base as pipeBase
from lsst.meas.algorithms.sourceSelector import sourceSelectorRegistry

from ..setMatchDistance import setMatchDistance
from . import matchOptimisticB, MatchOptimisticBControl
from .setMatchDistance import setMatchDistance
from .matchOptimisticB import matchOptimisticB, MatchOptimisticBControl


class MatchTolerance:
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/meas/astrom/matchPessimisticB.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import lsst.afw.table as afwTable
from lsst.meas.algorithms.sourceSelector import sourceSelectorRegistry

from .matchOptimisticB import MatchTolerance
from .matchOptimisticBTask import MatchTolerance

from .pessimistic_pattern_matcher_b_3D import PessimisticPatternMatcherB

Expand Down
2 changes: 1 addition & 1 deletion src/sip/CreateWcsWithSip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ CreateWcsWithSip<MatchT>::CreateWcsWithSip(std::vector<MatchT> const& matches,
* If no BBox is provided, guess one from the input points (extrapolated a bit to allow for fact
* that a finite number of points won't reach to the edge of the image)
*/
if (_bbox.isEmpty() && !_matches.empty() > 0) {
if (_bbox.isEmpty() && !_matches.empty()) {
for (typename std::vector<MatchT>::const_iterator ptr = _matches.begin(); ptr != _matches.end();
++ptr) {
afw::table::SourceRecord const& src = *ptr->second;
Expand Down
21 changes: 16 additions & 5 deletions tests/test_matchOptimisticB.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import math
import os
import unittest
import pickle

import lsst.geom
import lsst.afw.geom as afwGeom
Expand All @@ -32,6 +33,7 @@
from lsst.meas.algorithms import LoadReferenceObjectsTask
import lsst.meas.astrom.sip.genDistortedImage as distort
import lsst.meas.astrom as measAstrom
import lsst.meas.astrom.matchOptimisticB as matchOptimisticB


class TestMatchOptimisticB(unittest.TestCase):
Expand Down Expand Up @@ -179,7 +181,7 @@ def loadSourceCatalog(self, filename):
def testArgumentErrors(self):
"""Test argument sanity checking in matchOptimisticB
"""
matchControl = measAstrom.MatchOptimisticBControl()
matchControl = matchOptimisticB.MatchOptimisticBControl()

sourceCat = self.loadSourceCatalog(self.filename)
emptySourceCat = afwTable.SourceCatalog(sourceCat.schema)
Expand All @@ -188,38 +190,47 @@ def testArgumentErrors(self):
emptyRefCat = afwTable.SimpleCatalog(refCat.schema)

with self.assertRaises(pexExcept.InvalidParameterError):
measAstrom.matchOptimisticB(
matchOptimisticB.matchOptimisticB(
emptyRefCat,
sourceCat,
matchControl,
self.wcs,
0,
)
with self.assertRaises(pexExcept.InvalidParameterError):
measAstrom.matchOptimisticB(
matchOptimisticB.matchOptimisticB(
refCat,
emptySourceCat,
matchControl,
self.wcs,
0,
)
with self.assertRaises(pexExcept.InvalidParameterError):
measAstrom.matchOptimisticB(
matchOptimisticB.matchOptimisticB(
refCat,
sourceCat,
matchControl,
self.wcs,
len(refCat),
)
with self.assertRaises(pexExcept.InvalidParameterError):
measAstrom.matchOptimisticB(
matchOptimisticB.matchOptimisticB(
refCat,
sourceCat,
matchControl,
self.wcs,
-1,
)

def testConfigPickle(self):
"""Test that we can pickle the Config

This is required for use in singleFrameDriver.
See DM-18314.
"""
config = pickle.loads(pickle.dumps(self.config))
self.assertEqual(config, self.config)


class MemoryTester(lsst.utils.tests.MemoryTestCase):
pass
Expand Down