diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2022-11-04 14:05:42 +0100 |
---|---|---|
committer | Marc Glisse <marc.glisse@inria.fr> | 2022-11-04 14:05:42 +0100 |
commit | 2ebdeb905d3ca90e2ba2d24e6d3aac52240f6c86 (patch) | |
tree | 5096de5f1eb6b52bef10cab78cb5332bd13ced9a /src/python/test/test_representations.py | |
parent | 7595644442365412cf7afce56eafea85342da07f (diff) |
More consistent choice of a grid for diagram representations
Diffstat (limited to 'src/python/test/test_representations.py')
-rwxr-xr-x | src/python/test/test_representations.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/python/test/test_representations.py b/src/python/test/test_representations.py index 58caab21..9e94feeb 100755 --- a/src/python/test/test_representations.py +++ b/src/python/test/test_representations.py @@ -251,3 +251,15 @@ def test_landscape_nan_range(): lds_dgm = lds(dgm) assert (lds.sample_range[0] == 2) & (lds.sample_range[1] == 6) assert lds.new_resolution == 10 + +def test_endpoints(): + diags = [ np.array([[2., 3.]]) ] + for vec in [ Landscape(), Silhouette(), BettiCurve() ]: + vec.fit(diags) + assert vec.grid_[0] > 2 and vec.grid_[-1] < 3 + for vec in [ Landscape(keep_endpoints=True), Silhouette(keep_endpoints=True), BettiCurve(keep_endpoints=True) ]: + vec.fit(diags) + assert vec.grid_[0] == 2 and vec.grid_[-1] == 3 + vec = BettiCurve(resolution=None) + vec.fit(diags) + assert np.equal(vec.grid_, [-np.inf, 2., 3.]).all() |