Commit 82e1fdd0 authored by Kristin Berry's avatar Kristin Berry
Browse files

Merge pull request #51 from jlaura/master

Fixes serialization for save/load
parents 50abda75 056e7b64
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ install:
  - conda info -a

  # Create a virtual env and install dependencies
  - conda create -y -q -n test-env python=$TRAVIS_PYTHON_VERSION nose numpy pillow scipy pandas networkx scikit-image sqlalchemy numexpr
  - conda create -y -q -n test-env python=$TRAVIS_PYTHON_VERSION nose numpy pillow scipy pandas networkx scikit-image sqlalchemy numexpr dill
  # Activate the env
  - source activate test-env

+3 −0
Original line number Diff line number Diff line
@@ -190,6 +190,9 @@ class Edge(dict, MutableMapping):
                                     d_keypoints[ransac_mask][['x', 'y']],
                                     index=mask[mask == True].index)

        # Finalize the array to get custom attrs to propagate
        self.homography.__array_finalize__(self.homography)

    def subpixel_register(self, clean_keys=[], threshold=0.8, upsampling=16,
                          template_size=19, search_size=53, max_x_shift=1.0,
                          max_y_shift=1.0):
+2 −2
Original line number Diff line number Diff line
import os
import pickle
import dill as pickle

import networkx as nx
import numpy as np
@@ -491,7 +491,7 @@ class CandidateGraph(nx.Graph):
            node._handle = None

        with open(filename, 'wb') as f:
            pickle.dump(self, f)
            pickle.dump(self, f, protocol=pickle.HIGHEST_PROTOCOL)

    # TODO: The Edge object requires a get method in order to be plottable, probably Node as well.
    # This is a function of being a dict in NetworkX
+10 −1
Original line number Diff line number Diff line
@@ -32,8 +32,17 @@ class Homography(np.ndarray):
        obj.x2 = make_homogeneous(x2)
        obj.pd_index = index

        cls.__array_finalize__(cls, obj)

        return obj

    def __array_finalize__(self, obj):
        if obj is None:
            return
        self.x1 = getattr(obj, 'x1', None)
        self.x2 = getattr(obj, 'x2', None)
        self.pd_index = getattr(obj, 'pd_index', None)

    @property
    def determinant(self):
        if not hasattr(self, '_determinant'):
+2 −1
Original line number Diff line number Diff line
@@ -9,3 +9,4 @@ networkx
pandas
scikit-image
sqlalchemy
dill
 No newline at end of file