Loading autocnet/graph/node.py +1 −2 Original line number Diff line number Diff line Loading @@ -7,10 +7,9 @@ import numpy as np import pandas as pd from plio.io.io_gdal import GeoDataset from plio.io.isis_serial_number import generate_serial_number from scipy.misc import bytescale from scipy.misc import bytescale, imresize from shapely.geometry import Polygon from autocnet.cg import cg from autocnet.control.control import Correspondence, Point Loading autocnet/graph/tests/test_edge.py +2 −126 Original line number Diff line number Diff line Loading @@ -61,11 +61,8 @@ class TestEdge(unittest.TestCase): [0, 3, 1, 3], [0, 4, 1, 4]] <<<<<<< HEAD matches_df = pd.DataFrame(data=keypoint_matches, columns=['source_image', 'source_idx', 'destination_image', 'destination_idx']) ======= matches_df = pd.DataFrame(keypoint_matches, columns = ['source_image', 'source_idx', 'destination_image', 'destination_idx']) >>>>>>> 1788194d709d73bf22d843752991d8c6dad9f87a e = edge.Edge() source_node = MagicMock(spec=node.Node()) destination_node = MagicMock(spec=node.Node()) Loading Loading @@ -108,7 +105,6 @@ class TestEdge(unittest.TestCase): #self.assertRaises(AttributeError, cg.edge[0][1].coverage) self.assertEqual(e.coverage(), 0.3) <<<<<<< HEAD def test_get_keypoints(self): src_keypoint_df = pd.DataFrame({'x': (0, 1, 2, 3, 4), 'y': (5, 6, 7, 8, 9), 'response': (10, 11, 12, 13, 14), 'size': (15, 16, 17, 18, 19), Loading @@ -135,33 +131,11 @@ class TestEdge(unittest.TestCase): source_node.get_keypoints = MagicMock(return_value=src_keypoint_df) destination_node.get_keypoints = MagicMock(return_value=dst_keypoint_df) ======= def test_voronoi_transform(self): keypoint_df = pd.DataFrame({'x': (15, 18, 18, 12, 12), 'y': (5, 10, 15, 15, 10)}) keypoint_matches = [[0, 0, 1, 0], [0, 1, 1, 1], [0, 2, 1, 2], [0, 3, 1, 3], [0, 4, 1, 4]] matches_df = pd.DataFrame(data=keypoint_matches, columns=['source_image', 'source_idx', 'destination_image', 'destination_idx']) e = edge.Edge() e.clean = MagicMock(return_value=(matches_df, None)) e.matches = matches_df source_node = MagicMock(spec=node.Node()) destination_node = MagicMock(spec=node.Node()) source_node.get_keypoint_coordinates = MagicMock(return_value=keypoint_df) destination_node.get_keypoint_coordinates = MagicMock(return_value=keypoint_df) >>>>>>> 1788194d709d73bf22d843752991d8c6dad9f87a e.source = source_node e.destination = destination_node <<<<<<< HEAD e.clean = MagicMock(return_value=(matches_df, None)) e.matches = matches_df Loading Loading @@ -203,104 +177,6 @@ class TestEdge(unittest.TestCase): # Check key error thrown when string arg != "source" or "destination" with self.assertRaises(KeyError): e.get_keypoints("string", clean_keys) ======= source_geodata = Mock(spec=io_gdal.GeoDataset) destination_geodata = Mock(spec=io_gdal.GeoDataset) e.source.geodata = source_geodata e.destination.geodata = destination_geodata source_corners = [(0, 0), (20, 0), (20, 20), (0, 20)] destination_corners = [(10, 5), (30, 5), (30, 25), (10, 25)] source_poly = array_to_poly(source_corners) destination_poly = array_to_poly(destination_corners) def latlon_to_pixel(i, j): return vals[(i, j)] e.source.geodata.latlon_to_pixel = MagicMock(side_effect=latlon_to_pixel) e.destination.geodata.latlon_to_pixel = MagicMock(side_effect=latlon_to_pixel) e.source.geodata.footprint = source_poly e.source.geodata.xy_corners = source_corners e.destination.geodata.footprint = destination_poly e.destination.geodata.xy_corners = destination_corners vals = {(10, 5): (10, 5), (20, 5): (20, 5), (20, 20): (20, 20), (10, 20): (10, 20)} weights = pd.DataFrame({"vor_weights": (19, 28, 37.5, 37.5, 28)}) e.compute_weights(clean_keys=[]) k = 0 for i in e.matches['vor_weights']: self.assertAlmostEquals(i, weights['vor_weights'][k]) k += 1 def test_voronoi_homography(self): source_keypoint_df = pd.DataFrame({'x': (15, 18, 18, 12, 12), 'y': (5, 10, 15, 15, 10)}) destination_keypoint_df = pd.DataFrame({'x': (5, 8, 8, 2, 2), 'y': (0, 5, 10, 10, 5)}) keypoint_matches = [[0, 0, 1, 0], [0, 1, 1, 1], [0, 2, 1, 2], [0, 3, 1, 3], [0, 4, 1, 4]] matches_df = pd.DataFrame(data = keypoint_matches, columns=['source_image', 'source_idx', 'destination_image', 'destination_idx']) e = edge.Edge() e.clean = MagicMock(return_value=(matches_df, None)) e.matches = matches_df source_node = MagicMock(spec=node.Node()) destination_node = MagicMock(spec=node.Node()) source_node.get_keypoint_coordinates = MagicMock(return_value=source_keypoint_df) destination_node.get_keypoint_coordinates = MagicMock(return_value=destination_keypoint_df) e.source = source_node e.destination = destination_node source_geodata = Mock(spec=io_gdal.GeoDataset) destination_geodata = Mock(spec=io_gdal.GeoDataset) e.source.geodata = source_geodata e.destination.geodata = destination_geodata source_corners = [(0, 0), (20, 0), (20, 20), (0, 20)] destination_corners = [(0, 0), (20, 0), (20, 20), (0, 20)] e.source.geodata.coordinate_transformation.this = None e.destination.geodata.coordinate_transformation.this = None e.source.geodata.xy_corners = source_corners e.destination.geodata.xy_corners = destination_corners weights = pd.DataFrame({"vor_weights": (19, 28, 37.5, 37.5, 28)}) e.compute_weights(clean_keys=[]) k = 0 for i in e.matches['vor_weights']: self.assertAlmostEquals(i, weights['vor_weights'][k]) k += 1 >>>>>>> 1788194d709d73bf22d843752991d8c6dad9f87a def test_eq(self): edge1 = edge.Edge() Loading autocnet/graph/tests/test_network.py +3 −21 Original line number Diff line number Diff line Loading @@ -71,25 +71,7 @@ def test_connected_subgraphs(graph, disconnected_graph): subgraph_list = graph.connected_subgraphs() assert len(subgraph_list) == 1 <<<<<<< HEAD def test_save_load_features(tmpdir, graph): # Create the graph and save the features graph = graph.copy() graph.extract_features(extractor_parameters={'nfeatures': 10}) allout = tmpdir.join("all_out.hdf") oneout = tmpdir.join("one_out.hdf") graph.save_features(allout.strpath, format='hdf') graph.save_features(oneout.strpath, nodes=[1], format='hdf') graph_no_features = graph.copy() graph_no_features.load_features(allout.strpath, nodes=[1], format='hdf') assert graph.node[1].get_keypoints().all().all() == graph_no_features.node[1].get_keypoints().all().all() ======= >>>>>>> 1788194d709d73bf22d843752991d8c6dad9f87a def test_filter(graph): graph = graph.copy() test_sub_graph = graph.create_node_subgraph([0, 1]) Loading Loading @@ -184,7 +166,6 @@ def test_apply_func_to_edges(graph): assert not graph[0][2].masks['symmetry'].all() assert not graph[0][1].masks['symmetry'].all() <<<<<<< HEAD def test_intersection(): # Generate the footprints for the mock nodes Loading Loading @@ -248,7 +229,8 @@ def test_intersection(): assert intersect_gdf.geometry[4].area == 21.25 # Check if the correct poly was determined to overlap all other images assert intersect_gdf.overlaps_all[4] == True ======= def test_set_maxsize(graph): maxsizes = network.MAXSIZE assert(graph.maxsize == maxsizes[0]) Loading @@ -264,4 +246,4 @@ def test_update_data(graph): graph._update_date() ntime = graph.graph['modifieddate'] assert ctime != ntime >>>>>>> 1788194d709d73bf22d843752991d8c6dad9f87a autocnet/graph/tests/test_node.py +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ import numpy as np import pandas as pd import pytest from autocnet.examples import get_path from plio.io.io_gdal import GeoDataset Loading Loading
autocnet/graph/node.py +1 −2 Original line number Diff line number Diff line Loading @@ -7,10 +7,9 @@ import numpy as np import pandas as pd from plio.io.io_gdal import GeoDataset from plio.io.isis_serial_number import generate_serial_number from scipy.misc import bytescale from scipy.misc import bytescale, imresize from shapely.geometry import Polygon from autocnet.cg import cg from autocnet.control.control import Correspondence, Point Loading
autocnet/graph/tests/test_edge.py +2 −126 Original line number Diff line number Diff line Loading @@ -61,11 +61,8 @@ class TestEdge(unittest.TestCase): [0, 3, 1, 3], [0, 4, 1, 4]] <<<<<<< HEAD matches_df = pd.DataFrame(data=keypoint_matches, columns=['source_image', 'source_idx', 'destination_image', 'destination_idx']) ======= matches_df = pd.DataFrame(keypoint_matches, columns = ['source_image', 'source_idx', 'destination_image', 'destination_idx']) >>>>>>> 1788194d709d73bf22d843752991d8c6dad9f87a e = edge.Edge() source_node = MagicMock(spec=node.Node()) destination_node = MagicMock(spec=node.Node()) Loading Loading @@ -108,7 +105,6 @@ class TestEdge(unittest.TestCase): #self.assertRaises(AttributeError, cg.edge[0][1].coverage) self.assertEqual(e.coverage(), 0.3) <<<<<<< HEAD def test_get_keypoints(self): src_keypoint_df = pd.DataFrame({'x': (0, 1, 2, 3, 4), 'y': (5, 6, 7, 8, 9), 'response': (10, 11, 12, 13, 14), 'size': (15, 16, 17, 18, 19), Loading @@ -135,33 +131,11 @@ class TestEdge(unittest.TestCase): source_node.get_keypoints = MagicMock(return_value=src_keypoint_df) destination_node.get_keypoints = MagicMock(return_value=dst_keypoint_df) ======= def test_voronoi_transform(self): keypoint_df = pd.DataFrame({'x': (15, 18, 18, 12, 12), 'y': (5, 10, 15, 15, 10)}) keypoint_matches = [[0, 0, 1, 0], [0, 1, 1, 1], [0, 2, 1, 2], [0, 3, 1, 3], [0, 4, 1, 4]] matches_df = pd.DataFrame(data=keypoint_matches, columns=['source_image', 'source_idx', 'destination_image', 'destination_idx']) e = edge.Edge() e.clean = MagicMock(return_value=(matches_df, None)) e.matches = matches_df source_node = MagicMock(spec=node.Node()) destination_node = MagicMock(spec=node.Node()) source_node.get_keypoint_coordinates = MagicMock(return_value=keypoint_df) destination_node.get_keypoint_coordinates = MagicMock(return_value=keypoint_df) >>>>>>> 1788194d709d73bf22d843752991d8c6dad9f87a e.source = source_node e.destination = destination_node <<<<<<< HEAD e.clean = MagicMock(return_value=(matches_df, None)) e.matches = matches_df Loading Loading @@ -203,104 +177,6 @@ class TestEdge(unittest.TestCase): # Check key error thrown when string arg != "source" or "destination" with self.assertRaises(KeyError): e.get_keypoints("string", clean_keys) ======= source_geodata = Mock(spec=io_gdal.GeoDataset) destination_geodata = Mock(spec=io_gdal.GeoDataset) e.source.geodata = source_geodata e.destination.geodata = destination_geodata source_corners = [(0, 0), (20, 0), (20, 20), (0, 20)] destination_corners = [(10, 5), (30, 5), (30, 25), (10, 25)] source_poly = array_to_poly(source_corners) destination_poly = array_to_poly(destination_corners) def latlon_to_pixel(i, j): return vals[(i, j)] e.source.geodata.latlon_to_pixel = MagicMock(side_effect=latlon_to_pixel) e.destination.geodata.latlon_to_pixel = MagicMock(side_effect=latlon_to_pixel) e.source.geodata.footprint = source_poly e.source.geodata.xy_corners = source_corners e.destination.geodata.footprint = destination_poly e.destination.geodata.xy_corners = destination_corners vals = {(10, 5): (10, 5), (20, 5): (20, 5), (20, 20): (20, 20), (10, 20): (10, 20)} weights = pd.DataFrame({"vor_weights": (19, 28, 37.5, 37.5, 28)}) e.compute_weights(clean_keys=[]) k = 0 for i in e.matches['vor_weights']: self.assertAlmostEquals(i, weights['vor_weights'][k]) k += 1 def test_voronoi_homography(self): source_keypoint_df = pd.DataFrame({'x': (15, 18, 18, 12, 12), 'y': (5, 10, 15, 15, 10)}) destination_keypoint_df = pd.DataFrame({'x': (5, 8, 8, 2, 2), 'y': (0, 5, 10, 10, 5)}) keypoint_matches = [[0, 0, 1, 0], [0, 1, 1, 1], [0, 2, 1, 2], [0, 3, 1, 3], [0, 4, 1, 4]] matches_df = pd.DataFrame(data = keypoint_matches, columns=['source_image', 'source_idx', 'destination_image', 'destination_idx']) e = edge.Edge() e.clean = MagicMock(return_value=(matches_df, None)) e.matches = matches_df source_node = MagicMock(spec=node.Node()) destination_node = MagicMock(spec=node.Node()) source_node.get_keypoint_coordinates = MagicMock(return_value=source_keypoint_df) destination_node.get_keypoint_coordinates = MagicMock(return_value=destination_keypoint_df) e.source = source_node e.destination = destination_node source_geodata = Mock(spec=io_gdal.GeoDataset) destination_geodata = Mock(spec=io_gdal.GeoDataset) e.source.geodata = source_geodata e.destination.geodata = destination_geodata source_corners = [(0, 0), (20, 0), (20, 20), (0, 20)] destination_corners = [(0, 0), (20, 0), (20, 20), (0, 20)] e.source.geodata.coordinate_transformation.this = None e.destination.geodata.coordinate_transformation.this = None e.source.geodata.xy_corners = source_corners e.destination.geodata.xy_corners = destination_corners weights = pd.DataFrame({"vor_weights": (19, 28, 37.5, 37.5, 28)}) e.compute_weights(clean_keys=[]) k = 0 for i in e.matches['vor_weights']: self.assertAlmostEquals(i, weights['vor_weights'][k]) k += 1 >>>>>>> 1788194d709d73bf22d843752991d8c6dad9f87a def test_eq(self): edge1 = edge.Edge() Loading
autocnet/graph/tests/test_network.py +3 −21 Original line number Diff line number Diff line Loading @@ -71,25 +71,7 @@ def test_connected_subgraphs(graph, disconnected_graph): subgraph_list = graph.connected_subgraphs() assert len(subgraph_list) == 1 <<<<<<< HEAD def test_save_load_features(tmpdir, graph): # Create the graph and save the features graph = graph.copy() graph.extract_features(extractor_parameters={'nfeatures': 10}) allout = tmpdir.join("all_out.hdf") oneout = tmpdir.join("one_out.hdf") graph.save_features(allout.strpath, format='hdf') graph.save_features(oneout.strpath, nodes=[1], format='hdf') graph_no_features = graph.copy() graph_no_features.load_features(allout.strpath, nodes=[1], format='hdf') assert graph.node[1].get_keypoints().all().all() == graph_no_features.node[1].get_keypoints().all().all() ======= >>>>>>> 1788194d709d73bf22d843752991d8c6dad9f87a def test_filter(graph): graph = graph.copy() test_sub_graph = graph.create_node_subgraph([0, 1]) Loading Loading @@ -184,7 +166,6 @@ def test_apply_func_to_edges(graph): assert not graph[0][2].masks['symmetry'].all() assert not graph[0][1].masks['symmetry'].all() <<<<<<< HEAD def test_intersection(): # Generate the footprints for the mock nodes Loading Loading @@ -248,7 +229,8 @@ def test_intersection(): assert intersect_gdf.geometry[4].area == 21.25 # Check if the correct poly was determined to overlap all other images assert intersect_gdf.overlaps_all[4] == True ======= def test_set_maxsize(graph): maxsizes = network.MAXSIZE assert(graph.maxsize == maxsizes[0]) Loading @@ -264,4 +246,4 @@ def test_update_data(graph): graph._update_date() ntime = graph.graph['modifieddate'] assert ctime != ntime >>>>>>> 1788194d709d73bf22d843752991d8c6dad9f87a
autocnet/graph/tests/test_node.py +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ import numpy as np import pandas as pd import pytest from autocnet.examples import get_path from plio.io.io_gdal import GeoDataset Loading