message: Add tests for Landscapes
diff: @@ -197,3 +197,29 @@ def test_silhouette_numeric():
  expected_silhouette = np.array([0., 0.5, 0., 0., 0., 0., 0., 0.5, 0.])/np.sqrt(2)
  output_silhouette = slt(dgm)
  assert np.all(np.isclose(output_silhouette, expected_silhouette))
  +
  +
  +def test_landscape_small_persistence_invariance():
  + dgm = np.array([[2., 6.], [2., 5.], [3., 7.]])
  + small_persistence_pts = np.random.rand(10, 2)
  + small_persistence_pts[:, 1] += small_persistence_pts[:, 0]
  + small_persistence_pts += np.min(dgm)
  + dgm_augmented = np.concatenate([dgm, small_persistence_pts], axis=0)
  +
  + lds = Landscape(num_landscapes=2, resolution=5)
  + lds_dgm, lds_dgm_augmented = lds(dgm), lds(dgm_augmented)
  +
  + assert np.all(np.isclose(lds_dgm, lds_dgm_augmented))
  +
  +
  +def test_landscape_numeric():
  + dgm = np.array([[2., 6.], [3., 5.]])
  + lds_ref = np.array([
  + 0., 0.5, 1., 1.5, 2., 1.5, 1., 0.5, 0., # tent of [2, 6]
  + 0., 0., 0., 0.5, 1., 0.5, 0., 0., 0.
  + ])
  + lds_ref *= np.sqrt(2)
  + lds = Landscape(num_landscapes=2, resolution=9, sample_range=[2., 6.])
  + lds_dgm = lds(dgm)
  + print(lds.sample_range, lds.new_resolution, lds_dgm.shape)
  + assert np.all(np.isclose(lds_dgm, lds_ref))
  