tdads.diagram_utils
Functions
Checks for persistence diagrams. |
|
|
Verify the format of a persistence diagram and convert to a standard format. |
|
Additional internal preprocessing for permutation tests. |
Module Contents
- tdads.diagram_utils.check_diagram(D)[source]
Checks for persistence diagrams.
Internal method to verify that birth values are non-negative and less than death values.
- Parameters:
D (numpy.ndarray) – The input diagram to be checked.
- Return type:
None
- tdads.diagram_utils.preprocess_diagram(D, inf_replace_val=None, ret=False)[source]
Verify the format of a persistence diagram and convert to a standard format.
This function can verify a persistence diagram from the ripser, gph, flagser, gudhi or cechmate packages and convert any such diagram into a list of numpy arrays if desired (largely an internal functionality but can be used in a standalone fashion).
- Parameters:
D (any) – The persistence diagram to be verified. An exception will be raised if D is not a persistence diagram computed from one of the aforementioned packages.
inf_replace_val (float or int, default None) – The value with which inf values should be replaced, if desired.
ret (bool, default False) – Whether or not to return a processed diagram.
- Returns:
If ret is True and the diagram is verified then a list is returned. The i-th element of the returned list is the array of i-dimensional topological features in the diagram.
- Return type:
None or list of numpy.ndarray
- tdads.diagram_utils.preprocess_diagram_groups_for_inference(diagram_groups)[source]
Additional internal preprocessing for permutation tests.
- Parameters:
diagram_groups (list of lists) – Contains the persistence diagrams for the permutation test.
- Returns:
Each element in the first list contains the diagram (key ‘diagram’) and its index in the total list (key ‘ind’). The second list contains the cumulative sum of group sizes, starting with 0.
- Return type:
List of dicts and list of int