Loading autocnet/examples/Apollo15/adjacency.lis 0 → 100644 +6 −0 Original line number Diff line number Diff line AS15-M-0295_SML.png AS15-M-0296_SML.png AS15-M-0297_SML.png AS15-M-0298_SML.png AS15-M-0299_SML.png AS15-M-0300_SML.png autocnet/graph/network.py +11 −7 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ class CandidateGraph(nx.Graph): @classmethod def from_filelist(cls, filelist): def from_filelist(cls, filelist, basepath=None): """ Instantiate the class using a filelist as a python list. An adjacency structure is calculated using the lat/lon information in the Loading @@ -111,7 +111,9 @@ class CandidateGraph(nx.Graph): filelist = map(str.rstrip, filelist) # TODO: Reject unsupported file formats + work with more file formats if basepath: datasets = [GeoDataset(os.path.join(basepath, f)) for f in filelist] else: datasets = [GeoDataset(f) for f in filelist] # This is brute force for now, could swap to an RTree at some point. Loading @@ -126,10 +128,12 @@ class CandidateGraph(nx.Graph): # Grab the footprints and test for intersection i_fp = i.footprint j_fp = j.footprint try: if i_fp.Intersects(j_fp): adjacency_dict[i.file_name].append(j.file_name) adjacency_dict[j.file_name].append(i.file_name) except: # no geospatial information embedded in the images pass return cls(adjacency_dict) Loading autocnet/graph/tests/test_edge.py +0 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,5 @@ class TestEdge(unittest.TestCase): def test_compute_fundamental_matrix(self): with self.assertRaises(AttributeError): self.edge.compute_fundamental_matrix() self.assertTrue(False) autocnet/graph/tests/test_network.py +9 −35 Original line number Diff line number Diff line Loading @@ -78,43 +78,17 @@ class TestCandidateGraph(unittest.TestCase): os.remove('test_save.cg') def tearDown(self): pass def test_fromlist(self): mock_list = ['AS15-M-0295_SML.png', 'AS15-M-0296_SML.png', 'AS15-M-0297_SML.png', 'AS15-M-0298_SML.png', 'AS15-M-0299_SML.png', 'AS15-M-0300_SML.png'] n = network.CandidateGraph.from_filelist(mock_list, get_path('Apollo15')) self.assertEqual(len(n.nodes()), 6) class TestFromList(unittest.TestCase): @classmethod def setUpClass(cls): filelist = [get_path('Mars_MGS_MOLA_ClrShade_MAP2_0.0N0.0_MERC.tif'), get_path('Lunar_LRO_LOLA_Shade_MAP2_90.0N20.0_LAMB.tif'), get_path('Mars_MGS_MOLA_ClrShade_MAP2_90.0N0.0_POLA.tif')] cls.graph = network.CandidateGraph.from_filelist(filelist) n = network.CandidateGraph.from_filelist(get_path('adjacency.lis'), get_path('Apollo15')) self.assertEqual(len(n.nodes()), 6) def test_graph_length(self): self.assertEqual(self.graph.__len__(), 3) self.assertEqual(self.graph.number_of_nodes(), 3) ''' class TestFromListCubes(unittest.TestCase): @classmethod def setUpClass(cls): filelist = [get_path('AS15-M-0297_sub4.cub'), get_path('AS15-M-0298_sub4.cub'), get_path('AS15-M-0299_sub4.cub')] cls.graph = network.CandidateGraph.from_filelist(filelist) def test_graph_length(self): self.assertEqual(self.graph.number_of_nodes(), 3) self.assertEqual(self.graph.number_of_edges(), 3) ''' class TestEdge(unittest.TestCase): @classmethod def setUpClass(cls): cls.graph = network.CandidateGraph.from_adjacency(get_path('adjacency.json')) def tearDown(self): pass class TestGraphMasks(unittest.TestCase): Loading Loading
autocnet/examples/Apollo15/adjacency.lis 0 → 100644 +6 −0 Original line number Diff line number Diff line AS15-M-0295_SML.png AS15-M-0296_SML.png AS15-M-0297_SML.png AS15-M-0298_SML.png AS15-M-0299_SML.png AS15-M-0300_SML.png
autocnet/graph/network.py +11 −7 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ class CandidateGraph(nx.Graph): @classmethod def from_filelist(cls, filelist): def from_filelist(cls, filelist, basepath=None): """ Instantiate the class using a filelist as a python list. An adjacency structure is calculated using the lat/lon information in the Loading @@ -111,7 +111,9 @@ class CandidateGraph(nx.Graph): filelist = map(str.rstrip, filelist) # TODO: Reject unsupported file formats + work with more file formats if basepath: datasets = [GeoDataset(os.path.join(basepath, f)) for f in filelist] else: datasets = [GeoDataset(f) for f in filelist] # This is brute force for now, could swap to an RTree at some point. Loading @@ -126,10 +128,12 @@ class CandidateGraph(nx.Graph): # Grab the footprints and test for intersection i_fp = i.footprint j_fp = j.footprint try: if i_fp.Intersects(j_fp): adjacency_dict[i.file_name].append(j.file_name) adjacency_dict[j.file_name].append(i.file_name) except: # no geospatial information embedded in the images pass return cls(adjacency_dict) Loading
autocnet/graph/tests/test_edge.py +0 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,5 @@ class TestEdge(unittest.TestCase): def test_compute_fundamental_matrix(self): with self.assertRaises(AttributeError): self.edge.compute_fundamental_matrix() self.assertTrue(False)
autocnet/graph/tests/test_network.py +9 −35 Original line number Diff line number Diff line Loading @@ -78,43 +78,17 @@ class TestCandidateGraph(unittest.TestCase): os.remove('test_save.cg') def tearDown(self): pass def test_fromlist(self): mock_list = ['AS15-M-0295_SML.png', 'AS15-M-0296_SML.png', 'AS15-M-0297_SML.png', 'AS15-M-0298_SML.png', 'AS15-M-0299_SML.png', 'AS15-M-0300_SML.png'] n = network.CandidateGraph.from_filelist(mock_list, get_path('Apollo15')) self.assertEqual(len(n.nodes()), 6) class TestFromList(unittest.TestCase): @classmethod def setUpClass(cls): filelist = [get_path('Mars_MGS_MOLA_ClrShade_MAP2_0.0N0.0_MERC.tif'), get_path('Lunar_LRO_LOLA_Shade_MAP2_90.0N20.0_LAMB.tif'), get_path('Mars_MGS_MOLA_ClrShade_MAP2_90.0N0.0_POLA.tif')] cls.graph = network.CandidateGraph.from_filelist(filelist) n = network.CandidateGraph.from_filelist(get_path('adjacency.lis'), get_path('Apollo15')) self.assertEqual(len(n.nodes()), 6) def test_graph_length(self): self.assertEqual(self.graph.__len__(), 3) self.assertEqual(self.graph.number_of_nodes(), 3) ''' class TestFromListCubes(unittest.TestCase): @classmethod def setUpClass(cls): filelist = [get_path('AS15-M-0297_sub4.cub'), get_path('AS15-M-0298_sub4.cub'), get_path('AS15-M-0299_sub4.cub')] cls.graph = network.CandidateGraph.from_filelist(filelist) def test_graph_length(self): self.assertEqual(self.graph.number_of_nodes(), 3) self.assertEqual(self.graph.number_of_edges(), 3) ''' class TestEdge(unittest.TestCase): @classmethod def setUpClass(cls): cls.graph = network.CandidateGraph.from_adjacency(get_path('adjacency.json')) def tearDown(self): pass class TestGraphMasks(unittest.TestCase): Loading