topology_utils-checkpoint
Functions
|
Converts a persistence diagram to a numpy array. |
|
Computes the p-norm of a diagram given in array form. To be called upon by compute_persistence.run_persistence(). |
|
Computes the upper star filtration given am adjacency structure and values at each vertex. |
Module Contents
- topology_utils-checkpoint.diagram_to_array(diagram, dimension=0) numpy.ndarray
Converts a persistence diagram to a numpy array.
Takes in a dionysus diagram object and returns a m x 2 numpy array with the birth and death times of each persistence feature of a given dimension in the diagram. Of the form
feature_1 feature_2 … feature_n
birth time . . … . death time . . … . To be called upon by compute_persistence.run_persistence().
- Parameters:
diagram (List[d.Diagram]) – List of dionysus diagrams, one for each dimension.
dimension (int, default=0) – Which homology dimension to take the persistent features from.
- Returns:
Array containing birth and death features for each feature in the specified dimension of the diagram. Dimensions 2 x n_features.
- Return type:
np.ndarray
- topology_utils-checkpoint.p_norm(diagram: numpy.ndarray, p: int = 2) float
Computes the p-norm of a diagram given in array form. To be called upon by compute_persistence.run_persistence().
- Parameters:
diagram (np.ndarray) –
- Array containing birth and death times of features from a persistence diagram. Of the form
feature_1 feature_2 … feature_n
birth time . . … . death time . . … .
p (int, default=2:) – Which norm to compute.
- Returns:
p-norm of the given diagram.
- Return type:
float
- topology_utils-checkpoint.function_filtration(values: numpy.ndarray, edges: numpy.ndarray) dionysus.Filtration
Computes the upper star filtration given am adjacency structure and values at each vertex.
Takes in an adjacency structure (which vertices are adjacent to each other) a list of function values at a set of vertices, and computes the upper star filtration for this function on the given network structure. In the resulting filtration,
index of each vertex = value of the function at that vertex
index of an edge = value of the function on the lowest vertex of the edge
Higher dimensional faces not included as they do not affect the 0D PH. To be called upon by compute_persistence.run_persistence().
- Parameters:
values (np.ndarray) – Values of the function at each vertex. Dimensions n_vertices x 1
edges (np.ndarray) – A 2d matrix specfying which vertices are adjacent. Each row [a,b] specfies that a and b are adjacent, and adds the edge [a,b] to the simplex. Dimensions n_edges x 2.
- Returns:
Simplex representing the function filtration.
- Return type:
d.Filtration