From 5485d57c5632c54c5c377a17672b88357c6455db Mon Sep 17 00:00:00 2001 From: Bryn Keller Date: Mon, 30 Jan 2017 18:12:18 -0800 Subject: Use default representation for example rather than vector_vector --- python/README.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'python/README.rst') diff --git a/python/README.rst b/python/README.rst index 0c6c391..52bc150 100644 --- a/python/README.rst +++ b/python/README.rst @@ -99,8 +99,10 @@ Now the code:: import phat - # define a boundary matrix with the chosen internal representation - boundary_matrix = phat.boundary_matrix(representation = phat.representations.vector_vector) + boundary_matrix = phat.boundary_matrix() + + # or define a boundary matrix with the chosen internal representation + # boundary_matrix = phat.boundary_matrix(representation = phat.representations.bit_tree_pivot_column) # set the respective columns -- (dimension, boundary) pairs boundary_matrix.columns = [ (0, []), -- cgit v1.2.3 From 843e6870e58decba7d22411e4ba0f6dfc2df78a7 Mon Sep 17 00:00:00 2001 From: Michael Kerber Date: Mon, 24 Aug 2020 13:59:04 +0200 Subject: Removed indentation in example to easier copy-and-paster on command line --- python/README.rst | 57 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) (limited to 'python/README.rst') diff --git a/python/README.rst b/python/README.rst index 52bc150..d59ef00 100644 --- a/python/README.rst +++ b/python/README.rst @@ -97,41 +97,42 @@ We will build an ordered boundary matrix of this simplicial complex consisting o Now the code:: - import phat +import phat - boundary_matrix = phat.boundary_matrix() +boundary_matrix = phat.boundary_matrix() - # or define a boundary matrix with the chosen internal representation - # boundary_matrix = phat.boundary_matrix(representation = phat.representations.bit_tree_pivot_column) +# or define a boundary matrix with the chosen internal representation +# boundary_matrix = phat.boundary_matrix(representation = phat.representations.bit_tree_pivot_column) - # set the respective columns -- (dimension, boundary) pairs - boundary_matrix.columns = [ (0, []), - (0, []), - (1, [0,1]), - (0, []), - (1, [1,3]), - (1, [0,3]), - (2, [2,4,5])] +# set the respective columns -- (dimension, boundary) pairs +boundary_matrix.columns = [ (0, []), + (0, []), + (1, [0,1]), + (0, []), + (1, [1,3]), + (1, [0,3]), + (2, [2,4,5])] - # or equivalently, boundary_matrix = phat.boundary_matrix(representation = ..., columns = ...) - # would combine the creation of the matrix and the assignment of the columns +# or equivalently, boundary_matrix = phat.boundary_matrix(representation = ..., columns = ...) +# would combine the creation of the matrix and the assignment of the columns - # print some information of the boundary matrix: - print("\nThe boundary matrix has %d columns:" % len(boundary_matrix.columns)) - for col in boundary_matrix.columns: - s = "Column %d represents a cell of dimension %d." % (col.index, col.dimension) - if (col.boundary): - s = s + " Its boundary consists of the cells " + " ".join([str(c) for c in col.boundary]) - print(s) - print("Overall, the boundary matrix has %d entries." % len(boundary_matrix)) +# print some information of the boundary matrix: +print("\nThe boundary matrix has %d columns:" % len(boundary_matrix.columns)) +for col in boundary_matrix.columns: + s = "Column %d represents a cell of dimension %d." % (col.index, col.dimension) + if (col.boundary): + s = s + " Its boundary consists of the cells " + " ".join([str(c) for c in col.boundary]) + print(s) - pairs = boundary_matrix.compute_persistence_pairs() +print("Overall, the boundary matrix has %d entries." % len(boundary_matrix)) - pairs.sort() +pairs = boundary_matrix.compute_persistence_pairs() - print("\nThere are %d persistence pairs: " % len(pairs)) - for pair in pairs: - print("Birth: %d, Death: %d" % pair) +pairs.sort() + +print("\nThere are %d persistence pairs: " % len(pairs)) +for pair in pairs: + print("Birth: %d, Death: %d" % pair) References: @@ -140,5 +141,5 @@ References: .. [3] C.Chen, M.Kerber: Persistent Homology Computation With a Twist. 27th European Workshop on Computational Geometry, 2011. .. [4] U.Bauer, M.Kerber, J.Reininghaus: Clear and Compress: Computing Persistent Homology in Chunks. arXiv:1303.0477_ .. _arXiv:1303.0477: http://arxiv.org/pdf/1303.0477.pdf -.. _`Persistent Homology Algorithm Toolkit`: https://bitbucket.org/phat/phat-code +.. _`Persistent Homology Algorithm Toolbox`: https://bitbucket.org/phat/phat-code .. _`python.org`:http://docs.python-guide.org/en/latest/starting/install/osx/ -- cgit v1.2.3 From 04f3abb6598e9336df64a1ef408323d875c2cee3 Mon Sep 17 00:00:00 2001 From: mkerber Date: Tue, 25 Aug 2020 13:39:01 +0000 Subject: Idented code again (md-Syntax) --- python/README.rst | 74 +++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'python/README.rst') diff --git a/python/README.rst b/python/README.rst index d59ef00..03abc60 100644 --- a/python/README.rst +++ b/python/README.rst @@ -70,7 +70,7 @@ Other configurations are untested. Please note that this package DOES NOT work with the Python 2.7.10 that ships with the operating system in Mac OS X. These words of wisdom from `python.org`_ are worth heeding: - The version of Python that ships with OS X is great for learning but it’s not good for development. + The version of Python that ships with OS X is great for learning but it’s not good for development. The version shipped with OS X may be out of date from the official current Python release, which is considered the stable production version. @@ -97,42 +97,42 @@ We will build an ordered boundary matrix of this simplicial complex consisting o Now the code:: -import phat - -boundary_matrix = phat.boundary_matrix() - -# or define a boundary matrix with the chosen internal representation -# boundary_matrix = phat.boundary_matrix(representation = phat.representations.bit_tree_pivot_column) - -# set the respective columns -- (dimension, boundary) pairs -boundary_matrix.columns = [ (0, []), - (0, []), - (1, [0,1]), - (0, []), - (1, [1,3]), - (1, [0,3]), - (2, [2,4,5])] - -# or equivalently, boundary_matrix = phat.boundary_matrix(representation = ..., columns = ...) -# would combine the creation of the matrix and the assignment of the columns - -# print some information of the boundary matrix: -print("\nThe boundary matrix has %d columns:" % len(boundary_matrix.columns)) -for col in boundary_matrix.columns: - s = "Column %d represents a cell of dimension %d." % (col.index, col.dimension) - if (col.boundary): - s = s + " Its boundary consists of the cells " + " ".join([str(c) for c in col.boundary]) - print(s) - -print("Overall, the boundary matrix has %d entries." % len(boundary_matrix)) - -pairs = boundary_matrix.compute_persistence_pairs() - -pairs.sort() - -print("\nThere are %d persistence pairs: " % len(pairs)) -for pair in pairs: - print("Birth: %d, Death: %d" % pair) + import phat + + boundary_matrix = phat.boundary_matrix() + + # or define a boundary matrix with the chosen internal representation + # boundary_matrix = phat.boundary_matrix(representation = phat.representations.bit_tree_pivot_column) + + # set the respective columns -- (dimension, boundary) pairs + boundary_matrix.columns = [ (0, []), + (0, []), + (1, [0,1]), + (0, []), + (1, [1,3]), + (1, [0,3]), + (2, [2,4,5])] + + # or equivalently, boundary_matrix = phat.boundary_matrix(representation = ..., columns = ...) + # would combine the creation of the matrix and the assignment of the columns + + # print some information of the boundary matrix: + print("\nThe boundary matrix has %d columns:" % len(boundary_matrix.columns)) + for col in boundary_matrix.columns: + s = "Column %d represents a cell of dimension %d." % (col.index, col.dimension) + if (col.boundary): + s = s + " Its boundary consists of the cells " + " ".join([str(c) for c in col.boundary]) + print(s) + + print("Overall, the boundary matrix has %d entries." % len(boundary_matrix)) + + pairs = boundary_matrix.compute_persistence_pairs() + + pairs.sort() + + print("\nThere are %d persistence pairs: " % len(pairs)) + for pair in pairs: + print("Birth: %d, Death: %d" % pair) References: -- cgit v1.2.3 From 746517263955660b5a0a0f4defc18f2d2d84f502 Mon Sep 17 00:00:00 2001 From: Michael Kerber Date: Tue, 25 Aug 2020 15:47:41 +0200 Subject: more formatting issues --- python/README.rst | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'python/README.rst') diff --git a/python/README.rst b/python/README.rst index 03abc60..7de641d 100644 --- a/python/README.rst +++ b/python/README.rst @@ -70,7 +70,7 @@ Other configurations are untested. Please note that this package DOES NOT work with the Python 2.7.10 that ships with the operating system in Mac OS X. These words of wisdom from `python.org`_ are worth heeding: - The version of Python that ships with OS X is great for learning but it’s not good for development. + The version of Python that ships with OS X is great for learning but it is not good for development. The version shipped with OS X may be out of date from the official current Python release, which is considered the stable production version. @@ -98,12 +98,12 @@ We will build an ordered boundary matrix of this simplicial complex consisting o Now the code:: import phat - + boundary_matrix = phat.boundary_matrix() - + # or define a boundary matrix with the chosen internal representation # boundary_matrix = phat.boundary_matrix(representation = phat.representations.bit_tree_pivot_column) - + # set the respective columns -- (dimension, boundary) pairs boundary_matrix.columns = [ (0, []), (0, []), @@ -112,10 +112,10 @@ Now the code:: (1, [1,3]), (1, [0,3]), (2, [2,4,5])] - + # or equivalently, boundary_matrix = phat.boundary_matrix(representation = ..., columns = ...) # would combine the creation of the matrix and the assignment of the columns - + # print some information of the boundary matrix: print("\nThe boundary matrix has %d columns:" % len(boundary_matrix.columns)) for col in boundary_matrix.columns: @@ -123,13 +123,12 @@ Now the code:: if (col.boundary): s = s + " Its boundary consists of the cells " + " ".join([str(c) for c in col.boundary]) print(s) - print("Overall, the boundary matrix has %d entries." % len(boundary_matrix)) - + pairs = boundary_matrix.compute_persistence_pairs() - + pairs.sort() - + print("\nThere are %d persistence pairs: " % len(pairs)) for pair in pairs: print("Birth: %d, Death: %d" % pair) -- cgit v1.2.3