[Betti curve representation] grid computation
astamm opened this issue · 3 comments
When the resolution is not None
,
- if both lower and upper bounds are missing (e.g.
sample_range = [nan, nan]
), the computed grid is a list of 1s of length `resolution; - if one of the two bounds is missing, an error is thrown;
- if both bounds are provided, it behaves as expected.
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?
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]
.
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.
By the way, I was working with the same version of {gudhi}. A new version of the R package {rgudhi} will follow accordingly soon.