Skip to content

Commit

Permalink
NNGraph: clean and doc (PR #21)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeff committed Feb 14, 2019
1 parent 441341f commit bfbbacb
Show file tree
Hide file tree
Showing 11 changed files with 359 additions and 351 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The documentation is available on
`Read the Docs <https://pygsp.readthedocs.io>`_
and development takes place on
`GitHub <https://github.com/epfl-lts2/pygsp>`_.
(A (mostly unmaintained) `Matlab version <https://epfl-lts2.github.io/gspbox-html>`_ exists.)
A (mostly unmaintained) `Matlab version <https://epfl-lts2.github.io/gspbox-html>`_ exists.

The PyGSP facilitates a wide variety of operations on graphs, like computing
their Fourier basis, filtering or interpolating signals, plotting graphs,
Expand Down
4 changes: 2 additions & 2 deletions pygsp/graphs/nngraphs/bunny.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, **kwargs):
'distance': 8,
}

super(Bunny, self).__init__(Xin=data['bunny'],
epsilon=0.02, NNtype='radius',
super(Bunny, self).__init__(data['bunny'],
center=False, rescale=False,
kind='radius', radius=0.02,
plotting=plotting, **kwargs)
2 changes: 1 addition & 1 deletion pygsp/graphs/nngraphs/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self,
'distance': 9,
}

super(Cube, self).__init__(Xin=pts, k=10,
super(Cube, self).__init__(pts, k=10,
center=False, rescale=False,
plotting=plotting, **kwargs)

Expand Down
8 changes: 5 additions & 3 deletions pygsp/graphs/nngraphs/imgpatches.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class ImgPatches(NNGraph):
Extract a feature vector in the form of a patch for every pixel of an
image, then construct a nearest-neighbor graph between these feature
vectors. The feature matrix, i.e. the patches, can be found in :attr:`Xin`.
vectors. The feature matrix, i.e., the patches, can be found in
:attr:`features`.
Parameters
----------
Expand All @@ -35,9 +36,10 @@ class ImgPatches(NNGraph):
>>> from skimage import data, img_as_float
>>> img = img_as_float(data.camera()[::64, ::64])
>>> G = graphs.ImgPatches(img, patch_shape=(3, 3))
>>> print('{} nodes ({} x {} pixels)'.format(G.Xin.shape[0], *img.shape))
>>> N, d = G.features.shape
>>> print('{} nodes ({} x {} pixels)'.format(N, *img.shape))
64 nodes (8 x 8 pixels)
>>> print('{} features per node'.format(G.Xin.shape[1]))
>>> print('{} features per node'.format(d))
9 features per node
>>> G.set_coordinates(kind='spring', seed=42)
>>> fig, axes = plt.subplots(1, 2)
Expand Down
Loading

0 comments on commit bfbbacb

Please sign in to comment.