Loading .coveragerc +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ source = autocnet [report] omit = fileio/ControlNetFileV0002_pb2.py utils/visualization.py exclude_lines = pragma: no cover def __repr__ Loading autocnet/fileio/io_gdal.py +2 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,8 @@ class GeoDataset(object): """ self.file_name = file_name self.dataset = gdal.Open(file_name) if self.dataset is None: raise IOError('File not found :', file_name) def __repr__(self): return os.path.basename(self.file_name) Loading autocnet/graph/network.py +36 −15 Original line number Diff line number Diff line Loading @@ -57,15 +57,15 @@ class CandidateGraph(nx.Graph): nx.relabel_nodes(self, node_labels, copy=False) @classmethod def from_adjacency_file(cls, inputfile): def from_adjacency(cls, input_adjacency): """ Instantiate the class using an adjacency file. This file must contain relative or Instantiate the class using an adjacency dict or file. The input must contain relative or absolute paths to image files. Parameters ---------- inputfile : str The input file containing the graph representation input_adjacency : dict or str An adjacency dictionary or the name of a file containing an adjacency dictionary. Returns ------- Loading @@ -76,18 +76,19 @@ class CandidateGraph(nx.Graph): -------- >>> from autocnet.examples import get_path >>> inputfile = get_path('adjacency.json') >>> candidate_graph = network.CandidateGraph.from_adjacency_file(inputfile) >>> candidate_graph = network.CandidateGraph.from_adjacency(inputfile) """ adjacency_dict = io_json.read_json(inputfile) return cls(adjacency_dict) if not isinstance(input_adjacency, dict): input_adjacency = io_json.read_json(input_adjacency) return cls(input_adjacency) def get_name(self, nodeIndex): def get_name(self, node_index): """ Get the image name for the given node. Parameters ---------- nodeIndex : int node_index : int The index of the node. Returns Loading @@ -97,16 +98,34 @@ class CandidateGraph(nx.Graph): """ return self.node[nodeIndex]['image_name'] return self.node[node_index]['image_name'] def get_keypoints(self, nodeIndex): def get_node(self, node_name): """ Get the node with the given name. Parameters ---------- node_name : str The name of the node. Returns ------- : object The node with the given image name. """ return self.node[self.node_name_map[node_name]] def get_keypoints(self, nodekey): """ Get the list of keypoints for the given node. Parameters ---------- nodeIndex : int The index of the node. nodeIndex : int or string The key for the node, by index or name. Returns ------- Loading @@ -114,7 +133,9 @@ class CandidateGraph(nx.Graph): The list of keypoints for the given node. """ return self.node[nodeIndex]['keypoints'] if isinstance(nodekey, str): return self.get_node(nodekey)['keypoints'] return self.node[nodekey]['keypoints'] def add_image(self, *args, **kwargs): """ Loading autocnet/graph/tests/test_network.py +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ from .. import network class TestCandidateGraph(unittest.TestCase): def setUp(self): self.graph = network.CandidateGraph.from_adjacency_file(get_path('adjacency.json')) self.graph = network.CandidateGraph.from_adjacency(get_path('adjacency.json')) def test_get_name(self): node_number = self.graph.node_name_map['AS15-M-0297_SML.png'] Loading autocnet/examples/SprintDemoNotebooks/Sprint1Demo.ipynb→autocnet/notebooks/Sprint1Demo.ipynb +0 −0 File moved. View file Loading
.coveragerc +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ source = autocnet [report] omit = fileio/ControlNetFileV0002_pb2.py utils/visualization.py exclude_lines = pragma: no cover def __repr__ Loading
autocnet/fileio/io_gdal.py +2 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,8 @@ class GeoDataset(object): """ self.file_name = file_name self.dataset = gdal.Open(file_name) if self.dataset is None: raise IOError('File not found :', file_name) def __repr__(self): return os.path.basename(self.file_name) Loading
autocnet/graph/network.py +36 −15 Original line number Diff line number Diff line Loading @@ -57,15 +57,15 @@ class CandidateGraph(nx.Graph): nx.relabel_nodes(self, node_labels, copy=False) @classmethod def from_adjacency_file(cls, inputfile): def from_adjacency(cls, input_adjacency): """ Instantiate the class using an adjacency file. This file must contain relative or Instantiate the class using an adjacency dict or file. The input must contain relative or absolute paths to image files. Parameters ---------- inputfile : str The input file containing the graph representation input_adjacency : dict or str An adjacency dictionary or the name of a file containing an adjacency dictionary. Returns ------- Loading @@ -76,18 +76,19 @@ class CandidateGraph(nx.Graph): -------- >>> from autocnet.examples import get_path >>> inputfile = get_path('adjacency.json') >>> candidate_graph = network.CandidateGraph.from_adjacency_file(inputfile) >>> candidate_graph = network.CandidateGraph.from_adjacency(inputfile) """ adjacency_dict = io_json.read_json(inputfile) return cls(adjacency_dict) if not isinstance(input_adjacency, dict): input_adjacency = io_json.read_json(input_adjacency) return cls(input_adjacency) def get_name(self, nodeIndex): def get_name(self, node_index): """ Get the image name for the given node. Parameters ---------- nodeIndex : int node_index : int The index of the node. Returns Loading @@ -97,16 +98,34 @@ class CandidateGraph(nx.Graph): """ return self.node[nodeIndex]['image_name'] return self.node[node_index]['image_name'] def get_keypoints(self, nodeIndex): def get_node(self, node_name): """ Get the node with the given name. Parameters ---------- node_name : str The name of the node. Returns ------- : object The node with the given image name. """ return self.node[self.node_name_map[node_name]] def get_keypoints(self, nodekey): """ Get the list of keypoints for the given node. Parameters ---------- nodeIndex : int The index of the node. nodeIndex : int or string The key for the node, by index or name. Returns ------- Loading @@ -114,7 +133,9 @@ class CandidateGraph(nx.Graph): The list of keypoints for the given node. """ return self.node[nodeIndex]['keypoints'] if isinstance(nodekey, str): return self.get_node(nodekey)['keypoints'] return self.node[nodekey]['keypoints'] def add_image(self, *args, **kwargs): """ Loading
autocnet/graph/tests/test_network.py +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ from .. import network class TestCandidateGraph(unittest.TestCase): def setUp(self): self.graph = network.CandidateGraph.from_adjacency_file(get_path('adjacency.json')) self.graph = network.CandidateGraph.from_adjacency(get_path('adjacency.json')) def test_get_name(self): node_number = self.graph.node_name_map['AS15-M-0297_SML.png'] Loading
autocnet/examples/SprintDemoNotebooks/Sprint1Demo.ipynb→autocnet/notebooks/Sprint1Demo.ipynb +0 −0 File moved. View file