mrzv / dionysus

Library for computing persistent homology
http://mrzv.org/software/dionysus2
Other
144 stars 31 forks source link

The plot_bars function's question #36

Open JayLoveLei opened 5 years ago

JayLoveLei commented 5 years ago

Hi Dimitriy,

I'm new to Dionysus (and to studying homology persistence),when I try to use Dionysus2 to achieve the learning-demo(from http://outlace.com/TDApart5.html),I got a problem which the plot_bars missing the longest bar in Betti 0,but the plot_bars work in Betti 1 is right.

My achieve GitHub Logo
should be GitHub Logo

this is my code:

import numpy as np
import dionysus as d
from __future__ import print_function

data = np.array([[1,4],[1,1],[6,1],[6,4]],dtype='double')
f = d.fill_rips(data, 2, 8.0)
p = d.homology_persistence(f)
dgms = d.init_diagrams(p, f)

d.plot.plot_bars(dgms[0],order='birth')

when I want to print the p,I got these message:

<0> 0:
<1> 0:
<2> 0:
<3> 0:
<0,1> 3:1 * <0> 0+1 * <1> 0
<2,3> 3:1 * <2> 0+1 * <3> 0
<0,3> 5:1 * <0> 0+1 * <2> 0
<1,2> 5:
<0,2> 5.83095:
<1,3> 5.83095:
<0,1,2> 5.83095:1 * <0,1> 3+1 * <1,2> 5+1 * <0,2> 5.83095
<0,1,3> 5.83095:1 * <0,1> 3+1 * <0,3> 5+1 * <1,3> 5.83095
<0,2,3> 5.83095:1 * <0,1> 3+1 * <2,3> 3+1 * <0,3> 5+1 * <1,2> 5
<1,2,3> 5.83095:

Thank you very much!

Best, Jay