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(-) 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