Commit 7e4cb37e authored by Adam Paquette's avatar Adam Paquette
Browse files

Added basic dictionary functionallity for the attributes in node and edge.

parent 2acbb126
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ class Edge(dict, MutableMapping):
        self.matches = None
        self._subpixel_offsets = None

        self.provenance = {}
        self.weight = {}

        self._observers = set()
@@ -63,6 +64,14 @@ class Edge(dict, MutableMapping):
        Available Masks: {}
        """.format(self.source, self.destination, self.masks)

    def __getitem__(self, item):
        attribute_dict = {'source': self.source,
                          'destination': self.destination,
                          'masks': self.masks,
                          'provenance': self.provenance,
                          'weight': self.weight}
        return attribute_dict[item]

    @property
    def masks(self):
        mask_lookup = {'fundamental': 'fundamental_matrix',
@@ -689,18 +698,15 @@ class Edge(dict, MutableMapping):
    def plot_decomposition(self, *args, **kwargs): #pragma: no cover
        return plot_edge_decomposition(self, *args, **kwargs)

    def clean(self, clean_keys, pid=None):
    def clean(self, clean_keys):
        """
        Given a list of clean keys and a provenance id compute the
        mask of valid matches
        Given a list of clean keys compute the mask of valid
        matches

        Parameters
        ----------
        clean_keys : list
                     of columns names (clean keys)
        pid : int
              The provenance id of the parameter set to be cleaned.
              Defaults to the last run.

        Returns
        -------
+11 −0
Original line number Diff line number Diff line
@@ -76,6 +76,17 @@ class Node(dict, MutableMapping):
        """.format(self.node_id, self.image_name, self.image_path,
                   self.nkeypoints, self.masks, self.__class__)

    def __getitem__(self, item):
        attribute_dict = {'image_name': self.image_name,
                          'image_path': self.image_path,
                          'geodata': self.geodata,
                          'keypoints': self._keypoints,
                          'nkeypoints': self.nkeypoints,
                          'descriptors': self.descriptors,
                          'masks': self.masks,
                          'isis_serial': self.isis_serial}
        return attribute_dict[item]

    @property
    def geodata(self):
        if not getattr(self, '_geodata', None):