Distances#
To compare two mass distributions – two CO2 plumes, an experiment against a simulation – a pixel-wise difference is misleading: shifting a plume by one pixel should be a small change, not a large one. Transport-based distances measure how far mass has to move.
import darsia
d = darsia.wasserstein_distance(mass_a, mass_b, method="cv2.emd")
# DarSIA's own Beckmann solver also returns the optimal transport fields
d, info = darsia.wasserstein_distance(
mass_a, mass_b, method="newton",
options={"num_iter": 100, "return_info": True},
)
unified entry point; |
|
discrete Earth Mover’s Distance (OpenCV) |
|
the dynamic optimal-transport formulation |
|
iterative solvers for the Beckmann problem |
|
The distributions must have equal (integrated) mass. Turning a raw signal into a
mass needs a Geometry (depth and porosity) – see
PorousGeometry and darsia.wasserstein_distance_to_vtk() for
exporting the solution.