Skip to content

Commit b26cb2b

Browse files
committed
line length tweaks
1 parent e3fe655 commit b26cb2b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/aspire/operators/wemd.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
Wavelet-based approximate Earthmover's distance (EMD) for n-dimensional signals.
33
44
This code is based on the following paper:
5-
Sameer Shirdhonkar and David W. Jacobs. "Approximate earth mover’s distance in linear time." 2008 IEEE Conference on Computer Vision and Pattern Recognition (CVPR).
5+
Sameer Shirdhonkar and David W. Jacobs.
6+
"Approximate earth mover’s distance in linear time."
7+
2008 IEEE Conference on Computer Vision and Pattern Recognition (CVPR).
68
7-
More details are available in their technical report: CAR-TR-1025 CS-TR-4908 UMIACS-TR-2008-06.
9+
More details are available in their technical report:
10+
CAR-TR-1025 CS-TR-4908 UMIACS-TR-2008-06.
811
"""
912

1013
import numpy as np
@@ -14,8 +17,9 @@
1417
def wemd_embed(arr, wavelet, level):
1518
"""
1619
This function computes an embedding of Numpy arrays such that
17-
for non-negative arrays that sum to one, the L1 distance between the resulting embeddings
18-
is strongly equivalent to the Earthmover distance of the arrays.
20+
for non-negative arrays that sum to one, the L1 distance between the
21+
resulting embeddings is strongly equivalent to the Earthmover distance
22+
of the arrays.
1923
2024
:param arr: Numpy array
2125
:param level: Decomposition level of the wavelets
@@ -43,7 +47,8 @@ def wemd_embed(arr, wavelet, level):
4347

4448
def wemd_norm(arr, wavelet, level):
4549
"""
46-
Wavelet-based norm used to approximate the Earthmover's distance between mass distributions specified as Numpy arrays (typically images or volumes).
50+
Wavelet-based norm used to approximate the Earthmover's distance between
51+
mass distributions specified as Numpy arrays (typically images or volumes).
4752
4853
:param arr: Numpy array of the difference between the two mass distributions.
4954
:param level: Decomposition level of the wavelets
@@ -53,5 +58,6 @@ def wemd_norm(arr, wavelet, level):
5358
See https://pywavelets.readthedocs.io/en/latest/ref/wavelets.html#built-in-wavelets-wavelist
5459
:return: Approximated Earthmover's Distance
5560
"""
61+
5662
coefs = wemd_embed(arr, wavelet, level)
5763
return np.linalg.norm(coefs, ord=1)

0 commit comments

Comments
 (0)