oineus.wasserstein_distance

oineus.wasserstein_distance(dgm_1, dgm_2, q=1.0, delta=0.01, internal_p=inf, wasserstein_q=None, check_for_zero=True)[source]

Compute the q-Wasserstein distance between two persistence diagrams.

Parameters:
  • dgm_1 – Single-dimension persistence diagram: a NumPy array of shape (n_points, 2) or a list[DiagramPoint]. To pass an Oineus Diagrams object, extract the dimension first via dgm.in_dimension(d).

  • dgm_2 – Same forms as dgm_1.

  • q (float) – Wasserstein exponent.

  • delta (float) – Relative error requested from Hera.

  • internal_p (float) – Ground-metric norm in the plane. Use np.inf for the L_infinity norm.

  • wasserstein_q (float | None) – Alias for q, kept for API compatibility.

  • check_for_zero (bool) – If True, skip Hera when the two inputs are numpy arrays of equal points.

Returns:

The Wasserstein distance as a Python float.