Commit 925b9903 authored by Jason R Laura's avatar Jason R Laura
Browse files

Merging upstream with changes

parents 3f1094f7 3cc29457
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -101,7 +101,8 @@ def mcl(g, expand_factor=2, inflate_factor=2, max_loop=10, mult_factor=1):
        arr = _expand(arr, expand_factor)

        # Check for convergence
        if _stop(arr, i): break
        if _stop(arr, i):
            break

    clusters = _get_clusters(arr)
    return arr, clusters
+9 −11
Original line number Diff line number Diff line
import itertools
import math
import os
import warnings

@@ -142,7 +141,6 @@ class CandidateGraph(nx.Graph):

        return cls(adjacency_dict)


    @classmethod
    def from_adjacency(cls, input_adjacency, basepath=None):
        """
@@ -530,6 +528,7 @@ class CandidateGraph(nx.Graph):
                matches = edge.matches
            self.cn.add_correspondences(edge, matches)


    def to_json_file(self, outputfile):
        """
        Write the edge structure to a JSON adjacency list
@@ -655,11 +654,10 @@ class CandidateGraph(nx.Graph):
            The number of edges or sum of edge weights in the graph.

        """
        s = sum(self.degree(weight=weight).values()) / 2
        if weight is None:
            return math.ceil(s)
        if weight:
            return sum(e[weight] for s, d, e in self.edges_iter(data=True))
        else:
            return s
            return len(self.edges())

    def create_node_subgraph(self, nodes):
        """
+3 −3
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ class Node(dict, MutableMapping):
        Type: {}
        """.format(self.node_id, self.image_name, self.image_path,
                   self.nkeypoints, self.masks, self.__class__)

    @property
    def geodata(self):
        if not getattr(self, '_geodata', None):
@@ -342,4 +343,3 @@ class Node(dict, MutableMapping):
        mask = panel[clean_keys].all(axis=1)
        matches = self._keypoints[mask]
        return matches, mask
+1 −3
Original line number Diff line number Diff line
@@ -2,11 +2,11 @@ import unittest
from unittest.mock import Mock

import pandas as pd
import numpy as np

from .. import edge
from .. import node


class TestEdge(unittest.TestCase):

    def setUp(self):
@@ -44,5 +44,3 @@ class TestEdge(unittest.TestCase):
    def test_compute_fundamental_matrix(self):
        with self.assertRaises(AttributeError):
            self.edge.compute_fundamental_matrix()

+0 −2
Original line number Diff line number Diff line
@@ -24,5 +24,3 @@ class TestMarkovCluster(unittest.TestCase):
        flow, clusters = markov_cluster.mcl(arr)
        self.assertIsInstance(clusters, dict)
        self.assertEqual(len(clusters), 3)

Loading