Commit 3bb06594 authored by Jay's avatar Jay
Browse files

Network and markov tests passing nx2.

parent c2c0b843
Loading
Loading
Loading
Loading
+2 −2
Changes for autocnet/graph/edge.py: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ from autocnet.transformation import homography as hm
from autocnet.vis.graph_view import plot_edge, plot_node, plot_edge_decomposition
from autocnet.cg import cg

from plio.io.io_gdal import GeoDataset


class Edge(dict, MutableMapping):
@@ -193,7 +194,6 @@ class Edge(dict, MutableMapping):
            else:
                mbr = self['destin_mbr']
            # Can't use overlap if we haven't computed MBRs
            print(mbr)
            if mbr is None:
                return keypts
            return keypts.query('x >= {} and x <= {} and y >= {} and y <= {}'.format(*mbr))
@@ -515,7 +515,7 @@ class Edge(dict, MutableMapping):
        Estimate a source and destination minimum bounding rectangle, in
        pixel space.
        """
        if isinstance(self.source.geodata, (int, float)):
        if not isinstance(self.source.geodata, GeoDataset):
            smbr = None
            dmbr = None
        else:
+112 −154

File changed.

Preview size limit exceeded, changes collapsed.

+12 −3
Changes for autocnet/graph/node.py: 12 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ class Node(dict, MutableMapping):
                   self.nkeypoints, self.masks, self.__class__)

    def __hash__(self): #pragma: no cover
        return hash(repr(self))
        return hash(self['node_id'])

    def __gt__(self, other):
        myid = self['node_id']
@@ -107,9 +107,18 @@ class Node(dict, MutableMapping):
        return str(self['node_id'])

    def __eq__(self, other):
        return utils.compare_dicts(self.__dict__, other.__dict__) *\
               utils.compare_dicts(self, other)
        return self['node_id'] == other

    @classmethod
    def create(cls, image_name, node_id, basepath=None):
        try:
            image_name = os.path.basename(image_name)
        except: pass  # Use the input name even if not a valid PATH
        if basepath is not None:
            image_path = os.path.join(basepath, image_name)
        else:
            image_path = image_name
        return cls(image_name, image_path, node_id)

    @property
    def geodata(self):
+62 −50

File changed.

Preview size limit exceeded, changes collapsed.

+3 −3
Changes for autocnet/io/network.py: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -115,8 +115,8 @@ def load(projectname):
                n.masks = pd.DataFrame(nzf['masks'], index=nzf['masks_idx'], columns=nzf['masks_columns'])
            except:
                pass  # The node does not have features to load.
            cg.add_node(d['node_id'])
            cg.node[d['node_id']] = n
            cg.add_node(d['node_id'], data=n)


        for e in data['links']:
            cg.add_edge(e['source'], e['target'])
@@ -136,7 +136,7 @@ def load(projectname):
            except:
                pass
            # Add a mock edge
            cg.edge[e['source']][e['target']] = edge
            cg.add_edge(e['source'], e['target'] ,data=edge)

        cg._order_adjacency
    return cg