diff options
author | tlacombe <lacombe1993@gmail.com> | 2020-03-03 16:44:58 +0100 |
---|---|---|
committer | tlacombe <lacombe1993@gmail.com> | 2020-03-03 16:44:58 +0100 |
commit | efae8ff48c6b6e4d29afea753b7a1ddee0925ad4 (patch) | |
tree | f8afe7fd179f95a3273b0bbee7322433d1e34738 /src/python/gudhi | |
parent | 3ecf0caf4efbea0fabf4af0df490900374abda8b (diff) |
handle numpy array, should now adapt the doc
Diffstat (limited to 'src/python/gudhi')
-rw-r--r-- | src/python/gudhi/persistence_graphical_tools.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/python/gudhi/persistence_graphical_tools.py b/src/python/gudhi/persistence_graphical_tools.py index 8ddfdba8..43776fc6 100644 --- a/src/python/gudhi/persistence_graphical_tools.py +++ b/src/python/gudhi/persistence_graphical_tools.py @@ -45,6 +45,13 @@ def __min_birth_max_death(persistence, band=0.0): return (min_birth, max_death) +def _array_handler(a): + if isinstance(a, np.ndarray): + return [[0, x] for x in a] + else: + return a + + def plot_persistence_barcode( persistence=[], persistence_file="", @@ -95,6 +102,9 @@ def plot_persistence_barcode( plt.rc('text', usetex=True) plt.rc('font', family='serif') + + persistence = _array_handler(persistence) + if persistence_file != "": if path.isfile(persistence_file): # Reset persistence @@ -237,6 +247,7 @@ def plot_persistence_diagram( plt.rc('text', usetex=True) plt.rc('font', family='serif') + persistence = _array_handler(persistence) if persistence_file != "": if path.isfile(persistence_file): @@ -399,6 +410,7 @@ def plot_persistence_density( plt.rc('text', usetex=True) plt.rc('font', family='serif') + persistence = _array_handler(persistence) if persistence_file != "": if dimension is None: |