GUDHI / gudhi-devel

The GUDHI library is a generic open source C++ library, with a Python interface, for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.
https://gudhi.inria.fr/
MIT License
254 stars 65 forks source link

[Betti curve representation] grid computation #981

Open astamm opened 1 year ago

astamm commented 1 year ago

When the resolution is not None,

When the resolution is None, regardless of the value of sample_range, it behaves as expected.

The first two cases are in my opinion not the correct behaviour. Why one could not infer the lower and/or upper bound from the persistence diagrams if the resolution is set?

mglisse commented 1 year ago

Please provide a complete example and specify the gudhi version. With 3.8.0 from conda-forge, the following

from gudhi.representations import BettiCurve
import numpy as np
bc=BettiCurve()
bc.fit([np.array([[1,2],[4,5]])])
print(bc.grid_)

prints

[1.03960396 1.07920792 1.11881188 1.15841584 1.1980198 1.23762376 ...

although it has resolution=100 (not None) and sample_range=[nan, nan].

astamm commented 1 year ago

Thanks Marc. After some more digging, it turns out that it was a bad type conversion from R to Python. The usual NA value in R is converted to True in Python. If one wants the conversion to be Python nan, then NA_real_ should be set on R side. I was then able to reproduce your example. I guess this issue can be closed. Sorry about that.

astamm commented 1 year ago

By the way, I was working with the same version of {gudhi}. A new version of the R package {rgudhi} will follow accordingly soon.