Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get extended_persistent_barcode? #45

Open
tanjia123456 opened this issue Mar 15, 2021 · 5 comments
Open

How to get extended_persistent_barcode? #45

tanjia123456 opened this issue Mar 15, 2021 · 5 comments

Comments

@tanjia123456
Copy link

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

@VincentRouvreau
Copy link
Contributor

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

@VincentRouvreau
Copy link
Contributor

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
Copy link
Contributor

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 )

@tanjia123456
Copy link
Author

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

@tanjia123456
Copy link
Author

tanjia123456 commented Mar 15, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants