summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGard Spreemann <gspreemann@gmail.com>2016-03-29 13:07:27 +0200
committerGard Spreemann <gspreemann@gmail.com>2016-03-29 13:07:27 +0200
commit334cc2279104e7ec8c0b2bf165f8c538e9216789 (patch)
tree0e1479f4bf7fb361ed3dd0db5c52450b374d51f5
parentf1ffc3be31f24b2514b51e51a21c1cd0c9fdb305 (diff)
Document correpsonding DIPHA types.
-rw-r--r--phstuff/diphawrapper.py31
1 files changed, 20 insertions, 11 deletions
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: