Commit 5de651c2 authored by Jay's avatar Jay Committed by jay
Browse files

Working functional test generating an ISIS compliant cnet with measures having x,y coordinates.

parent c3771da2
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -144,18 +144,24 @@ class IsisStore(object):
            # Get the subset of the dataframe
            point = cnet.loc[point_id]

            try:
                point_spec.id = point_id
            except:
                point_spec.id = str(point_id)
            point_spec.type = FREEPOINT  # Hard coded to free

            # A single extend call is cheaper than many add calls to pack points
            measure_iterable = []

            for m in point.iterrows():
            for name, measure in point.iterrows():
                measure_spec = point_spec.Measure()
                serialnumber = m[0][1]
                mtype = m[0][2]
                measure_spec.serialnumber = serialnumber
                serial_number = name[1]
                mtype = name[2]
                measure_spec.serialnumber = serial_number
                measure_spec.type = mtype
                measure_spec.sample = measure.x
                measure_spec.line = measure.y

                measure_iterable.append(measure_spec)
            point_spec.measures.extend(measure_iterable)

+1 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ class CandidateGraph(nx.Graph):

    def to_cnet(self):
        """
        Generate a control network (C) object from a graph

        Returns
        -------
+30 −3
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ from autocnet.graph.network import CandidateGraph
from autocnet.matcher import feature_extractor as fe
from autocnet.matcher.matcher import FlannMatcher


class TestTwoImageMatching(unittest.TestCase):
    """
    Feature: As a user
@@ -27,6 +28,17 @@ class TestTwoImageMatching(unittest.TestCase):
            Then output a control network
    """

    def setUp(self):
        self.serial_numbers = {'AS15-M-0295_SML.png': '1971-07-31T01:24:11.754',
                               'AS15-M-0296_SML.png': '1971-07-31T01:24:36.970',
                               'AS15-M-0297_SML.png': '1971-07-31T01:25:02.243',
                               'AS15-M-0298_SML.png': '1971-07-31T01:25:27.457',
                               'AS15-M-0299_SML.png': '1971-07-31T01:25:52.669',
                               'AS15-M-0300_SML.png': '1971-07-31T01:26:17.923'}

        for k, v in self.serial_numbers.items():
            self.serial_numbers[k] = 'APOLLO15/METRIC/{}'.format(v)

    def test_two_image(self):
        # Step: Create an adjacency graph
        adjacency = get_path('two_image_adjacency.json')
@@ -59,9 +71,24 @@ class TestTwoImageMatching(unittest.TestCase):

        # Step: And create a C object
        cnet = cg.to_cnet()
        print(cnet)

        # Step update the serial numbers
        original_idx = cnet.index.levels
        new_idx = [original_idx[0], original_idx[1], [], original_idx[3]]

        serials = cnet.index.levels[2]
        for value in serials:
            new_idx[2].append(self.serial_numbers[value])

        cnet.index.set_levels(new_idx, inplace=True)

        # Step: Output a control network
        #to_isis('TestTwoImageMatching.net', cnet, mode='wb',
        #        networkid='TestTwoImageMatching', targetname='Moon')
        to_isis('TestTwoImageMatching.net', cnet, mode='wb',
                networkid='TestTwoImageMatching', targetname='Moon')

        self.assertTrue(False)

    def tearDown(self):
        try:
            os.path.remove('TestTwoImageMatching.net')
        except: pass