From 334cc2279104e7ec8c0b2bf165f8c538e9216789 Mon Sep 17 00:00:00 2001 From: Gard Spreemann Date: Tue, 29 Mar 2016 13:07:27 +0200 Subject: Document correpsonding DIPHA types. --- phstuff/diphawrapper.py | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'phstuff') diff --git a/phstuff/diphawrapper.py b/phstuff/diphawrapper.py index 45444c8..136104e 100644 --- a/phstuff/diphawrapper.py +++ b/phstuff/diphawrapper.py @@ -26,7 +26,9 @@ DIPHA_SPARSE_DISTANCE_MATRIX = 8 def save_weight_matrix(fname, weights): """Write a NumPy weight matrix to a DIPHA full distance matrix - file. Attention: DIPHA uses a convention wherein an edge's + file. Corresponds to DIPHA's "distance matrix data". + + Attention: DIPHA uses a convention wherein an edge's filtration value is *half* its weight. This function compensates by multiplying every weight by 2. Pay attention in case DIPHA's behavior changes in the future! @@ -67,11 +69,13 @@ def save_weight_matrix(fname, weights): def save_masked_weight_matrix(fname, weights): """Write a masked NumPy weight matrix to a DIPHA sparse distance - matrix file, keeping edges only for unmasked entries. Attention: - DIPHA uses a convention wherein an edge's filtration value is - *half* its weight. This function compensates by multiplying every - weight by 2. Pay attention in case DIPHA's behavior changes in the - future! + matrix file, keeping edges only for unmasked entries. Corresponds + to DIPHA's "sparse distance matrix data". + + Attention: DIPHA uses a convention wherein an edge's filtration + value is *half* its weight. This function compensates by + multiplying every weight by 2. Pay attention in case DIPHA's + behavior changes in the future! Parameters: ----------- @@ -106,10 +110,13 @@ def save_masked_weight_matrix(fname, weights): def save_edge_list(fname, edge_list): """Write a possibly non-complete weighted graph represented as an edge - list to a DIPHA sparse distance file. Attention: DIPHA uses a - convention wherein an edge's filtration value is *half* its - weight. This function compensates by multiplying every weight by - 2. Pay attention in case DIPHA's behavior changes in the future! + list to a DIPHA sparse distance file. Corresponds + to DIPHA's "sparse distance matrix data". + + Attention: DIPHA uses a convention wherein an edge's filtration + value is *half* its weight. This function compensates by + multiplying every weight by 2. Pay attention in case DIPHA's + behavior changes in the future! Parameters: ----------- @@ -154,6 +161,8 @@ def save_cubical(fname, complex): cubical complex with top-dimensional cells entering the filtration at the scale given by the array values. + Corresponds to DIPHA's "image data". + Parameters: ----------- @@ -161,7 +170,7 @@ def save_cubical(fname, complex): complex: Any-dimensional array with floating-point values giving the filtration values of the top-dimensional cells. - + """ with open(fname, "wb") as f: -- cgit v1.2.3