Removed the points iterator in PersistenceDaigram; replaced it with a __iter__ method.
Got rid of some python code in __init__.py, since it was not needed with the above change.
Changed the docs to reflect this.
--- a/bindings/python/dionysus/__init__.py Tue Aug 17 22:19:19 2010 -0700
+++ b/bindings/python/dionysus/__init__.py Wed Aug 18 12:05:18 2010 -0700
@@ -36,16 +36,3 @@
yield point.data
Point.__iter__ = point_iterator
-
-def persistence_diagram_iterator( self ):
- """
- This returns a list of lists.
- Whereas the intervals iterator returns a list of dionysus.Point objects
- """
-
- # self.intervals is an iterator object,
- # whose next method returns a Point object
- for intv in self.points:
- yield [ x for x in intv ]
-
-PersistenceDiagram.__iter__ = persistence_diagram_iterator
--- a/bindings/python/persistence-diagram.cpp Tue Aug 17 22:19:19 2010 -0700
+++ b/bindings/python/persistence-diagram.cpp Wed Aug 18 12:05:18 2010 -0700
@@ -85,9 +85,9 @@
.def( "__init__", bp::make_constructor( &init_from_points_sequence< dp::PersistenceDiagramD, dp::PointD > ) )
.def( bp::init< Dimension >( ) )
.def( "append", &dp::PersistenceDiagramD::push_back )
- .add_property( "points", bp::range( &dp::PersistenceDiagramD::begin, &dp::PersistenceDiagramD::end ) )
.add_property( "dimension", &get_dimension<dp::PersistenceDiagramD> )
.def( repr(bp::self) )
+ .def( "__iter__", bp::range( &dp::PersistenceDiagramD::begin, &dp::PersistenceDiagramD::end ) )
.def( "__len__", &get_length<dp::PersistenceDiagramD> )
;
--- a/doc/python/persistence-diagram.rst Tue Aug 17 22:19:19 2010 -0700
+++ b/doc/python/persistence-diagram.rst Wed Aug 18 12:05:18 2010 -0700
@@ -24,22 +24,17 @@
Dimension of the persistence diagram. Must be an integer. Must be set at initialization.
- .. attribute:: points
+ .. method:: __iter__( )
Iterator over the points in the persistence diagram,
e.g.::
- for p in dia.points: print p
+ for p in dia: print p
.. method:: __len__( )
:returns: The number of points in the diagram.
- .. method:: __iter__( )
-
- Provides another way to access the :attr:`~PersistenceDiagram.points` iterator, e.g.::
-
- for p in dia: print p
Utility functions for persistence diagrams