TDA-tutorial icon indicating copy to clipboard operation
TDA-tutorial copied to clipboard

How to get extended_persistent_barcode?

Open tanjia123456 opened this issue 3 years ago • 5 comments

Hello, sorry to bother you again. Q1: I have use brain cortical curv of each vertex as filteration value, but when i use the following code: for i in range(len(data_vertices)): st.assign_filtration([i], filtration = filteration_value[i]) #st.assign_filtration([0], filtration = filteration_value[0])#success! #st.assign_filtration([0], filtration = filteration_value[i])#success! error:Process finished with exit code -1073741819 (0xC0000005) I have tried some solution, but it's doesn't work! I'm curious why filter values can only be fed one node at a time.

Q2: I add filter value manually st.assign_filtration([0], filtration = filteration_value[0]) st.assign_filtration([1], filtration = filteration_value[1]) st.assign_filtration([2], filtration = filteration_value[2]) st.assign_filtration([3], filtration = filteration_value[3])

But you said use extended_persistence, I have use it, but : st2 = gd.SimplexTree() st2.extend_filtration() dgms2 = st2.extended_persistence(min_persistence=1e-5) gd.plot_persistence_barcode(dgms2)#IndexError: list index out of range plt.show() the error message: IndexError: list index out of range but when I use gd.plot_persistence_barcode(dgm),use ordinary persistent barcode, there's no problem. What code should I use to get the extended continuous bar code directly?

Q3: I've added filter values to each node. What pair of distances do I need to use to weight the edges?

Q4: Afetr I get the extended_persistent_barcode, How to get betti???

My datasets and codes are in:https://github.com/tanjia123456/Brain_area_PH/blob/main/compute_betti_gudhi3.py

tanjia123456 avatar Mar 15 '21 09:03 tanjia123456

Q1: This is a bug and thank you for the report. I think this is the same I was facing while developing https://github.com/GUDHI/gudhi-devel/pull/389 I will investigate and create an issue

VincentRouvreau avatar Mar 15 '21 09:03 VincentRouvreau

Let's come back to your failing code:

st = gd.SimplexTree()#创建一个空的简单复合体。
for i in range(len(data_triangles)):
    st.insert([v for v in data_triangles[i,:]], -10)
    ####can't feed the filtration value(the curv of every node)
    ####error message:Process finished with exit code -1073741819 (0xC0000005)
for i in range(len(data_vertices)):
    st.assign_filtration([i], filtration = filteration_value[i])

You insert the vertices, then you re-assign the filtration value. You could do it in one step:

for tri in data_triangles:
    for v in tri:
        st.insert([v], filteration_value[v])

VincentRouvreau avatar Mar 15 '21 10:03 VincentRouvreau

Q2: You only added the vertices, you need to insert edges (maybe linked with your Q3: What pair of distances do I need to use to weight the edges? ). This implies dgms2 = st2.extended_persistence(min_persistence=1e-5) always returns [[], [], [], []]. And finally, plot_persistence_barcode and plot_persistence_diagram will fail. Thank you again for this bug report, our code should be more robust and display nothing (or throw an explicit exception) when an empty diagram is given as an input (cf. https://github.com/GUDHI/gudhi-devel/issues/461 )

VincentRouvreau avatar Mar 15 '21 10:03 VincentRouvreau

OK , thank you for you reply. If you get a solution, please htell me.

tanjia123456 avatar Mar 15 '21 11:03 tanjia123456

Hello, I saw someone use Euclidean distance between two vertice in a edge. Can I use Hausdorff distance as pair distance? becuase I apply it into parcellation. Just I guess

------------------ 原始邮件 ------------------ 发件人: "GUDHI/TDA-tutorial" @.>; 发送时间: 2021年3月15日(星期一) 晚上6:27 @.>; @.@.>; 主题: Re: [GUDHI/TDA-tutorial] How to get extended_persistent_barcode? (#45)

Q2: You only added the vertices, you need to insert edges (maybe linked with your Q3: What pair of distances do I need to use to weight the edges? ). This implies dgms2 = st2.extended_persistence(min_persistence=1e-5) always returns [[], [], [], []]. And finally, plot_persistence_barcode and plot_persistence_diagram will fail. Thank you again for this bug report, our code should be more robust and display nothing (or throw an explicit exception) when an empty diagram is given as an input (cf. GUDHI/gudhi-devel#461 )

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

tanjia123456 avatar Mar 15 '21 11:03 tanjia123456