Added documentation for the python classes Point and PersistenceDiagram. Removed the __sub__ method for PersistenceDiagram. Minor renaming.
Renamed BottleneckDistance to bottleneck_distance.
Renamed intervals iterator for PersistenceDiagram to points. Seems in better conformance with usage.
--- a/bindings/python/dionysus/__init__.py Wed Aug 11 17:07:09 2010 -0700
+++ b/bindings/python/dionysus/__init__.py Tue Aug 17 22:19:19 2010 -0700
@@ -45,7 +45,7 @@
# self.intervals is an iterator object,
# whose next method returns a Point object
- for intv in self.intervals:
+ for intv in self.points:
yield [ x for x in intv ]
PersistenceDiagram.__iter__ = persistence_diagram_iterator
--- a/bindings/python/persistence-diagram.cpp Wed Aug 11 17:07:09 2010 -0700
+++ b/bindings/python/persistence-diagram.cpp Tue Aug 17 22:19:19 2010 -0700
@@ -85,12 +85,11 @@
.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( "intervals", bp::range( &dp::PersistenceDiagramD::begin, &dp::PersistenceDiagramD::end ) )
+ .add_property( "points", bp::range( &dp::PersistenceDiagramD::begin, &dp::PersistenceDiagramD::end ) )
.add_property( "dimension", &get_dimension<dp::PersistenceDiagramD> )
.def( repr(bp::self) )
- .def( "__sub__", &bottleneck_distance<dp::PersistenceDiagramD,dp::PersistenceDiagramD> )
.def( "__len__", &get_length<dp::PersistenceDiagramD> )
;
- bp::def( "BottleneckDistance", bottleneck_distance<dp::PersistenceDiagramD,dp::PersistenceDiagramD> );
+ bp::def( "bottleneck_distance", bottleneck_distance<dp::PersistenceDiagramD,dp::PersistenceDiagramD> );
}
--- a/doc/python/overview.rst Wed Aug 11 17:07:09 2010 -0700
+++ b/doc/python/overview.rst Tue Aug 17 22:19:19 2010 -0700
@@ -21,3 +21,5 @@
alphashapes.rst
rips.rst
zigzag-persistence.rst
+ point.rst
+ persistence-diagram.rst
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/python/persistence-diagram.rst Tue Aug 17 22:19:19 2010 -0700
@@ -0,0 +1,51 @@
+:class:`PersistenceDiagram` class
+==================================
+
+.. class:: PersistenceDiagram
+
+ .. method:: __init__( point_seq )
+
+ Initializes :class:`PersistenceDiagram` from the given sequence `seq` of `Point` objects, e.g.::
+
+ dia = PersistenceDiagram( [Point(1,2)] )
+
+ .. method:: __init__( dimension )
+
+ Initializes : an empty( no points ) :class:`PersistenceDiagram` object and sets
+ the :attr:`~PersistenceDiagram.dimension` attribute( must be integer ) e.g.::
+
+ dia = PersistenceDiagram( 1 )
+
+ .. method:: append( p )
+
+ Adds point `p` to the persistence diagram.
+
+ .. attribute:: dimension
+
+ Dimension of the persistence diagram. Must be an integer. Must be set at initialization.
+
+ .. attribute:: points
+
+ Iterator over the points in the persistence diagram,
+ e.g.::
+
+ for p in dia.points: 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
+--------------------------------------------
+
+
+.. function:: bottleneck_distance(dia1, dia2)
+
+ Calculates the bottleneck distance between the two persistence diagrams.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/python/point.rst Tue Aug 17 22:19:19 2010 -0700
@@ -0,0 +1,34 @@
+:class:`Point` class
+======================
+
+.. class:: Point
+
+ .. method:: __init__( x, y [, data])
+
+ Initializes :class:`Point` with the given real-valued coordinates and
+ optionally real value `data`, e.g.::
+
+ s = Point( 1, 1.1, 1.11 )
+
+ .. attribute:: x
+
+ x coordinate of the point
+
+ .. attribute:: y
+
+ y coordinate of the point
+
+ .. attribute:: data
+
+ Real value stored in the simplex.
+
+ .. method:: __iter__( )
+
+ Point objects are iterable, returning two or three elements depending on presence of data, e.g.::
+
+ p = Point( 1, 1.1, 1.11 )
+ for i in p: print p
+
+ 1
+ 1.1
+ 1.11