mrzv / dionysus

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

python bindings for ZigzagPersistence aren't letting me add to the persistence class #65

Closed marco-campos closed 2 months ago

marco-campos commented 2 months ago

Greetings,

I wanted to run the sample triangle code and after a bit of troubleshooting, I realized that the ZigzagPersistence class does not have any of its internal functions visible, crucially the add() function. See the code below:

` from dionysus import Simplex, ZigzagPersistence, Zp complex = {Simplex((0,), 0): None, # A Simplex((1,), 1): None, # B Simplex((2,), 2): None, # C Simplex((0,1), 2.5): None, # AB Simplex((1,2), 2.9): None, # BC Simplex((0,2), 3.5): None, # CA Simplex((0,1,2), 5): None} # ABC

print ("Complex:") for s in sorted(complex.keys()): print(s) prime_field = Zp(2) zz = ZigzagPersistence(prime_field) b = 1 for s in sorted(complex.keys()): print("%d: Adding %s" % (b, s)) i,d = zz.add([complex[ss] for ss in s.boundary], b) complex[s] = i if d:
print("Interval (%d, %d)" % (d, b-1)) b += 1 `

Here I get the error:

` AttributeError Traceback (most recent call last) Cell In[5], line 9 7 for s in sorted(complex.keys()): 8 print("%d: Adding %s" % (b, s)) ----> 9 i,d = zz.add([complex[ss] for ss in s.boundary], b) 10 complex[s] = i 11 if d:

AttributeError: 'dionysus._dionysus.ZigzagPersistence' object has no attribute 'add' `

Additionally, when I call help() on the class, I see no visible functions other than the hidden ones: image

Any help would be much appreciated.

-Marco

mrzv commented 2 months ago

You are looking at the example in Dionysus 1, but you have Dionysus 2 installed. See the zigzag persistence example in Dionysus 2.