spyrit.misc.walsh_hadamard.ifwalsh2_S

spyrit.misc.walsh_hadamard.ifwalsh2_S(Y, ind=True)[source]

Inverse Fast Walsh S-transform of Y in ā€œ2Dā€

Args:

Y (np.ndarray): n-by-n signal. n**2 should be a power of two.

ind (bool, optional): True for sequency (default)

ind (list, optional): permutation indices.

Returns:

np.ndarray: n-by-1 S-transformed signal

Examples:
>>> import spyrit.misc.walsh_hadamard as wh
>>> X = np.array([[1, 3, 0, 8],[7, 5, 1, 2],[2, 3, 6, 1],[4, 6, 8, 0]])
>>> print(f"image:\n {X}")
image:
 [[1 3 0 8]
 [7 5 1 2]
 [2 3 6 1]
 [4 6 8 0]]
>>> Y = wh.fwalsh2_S(X)
>>> print(f"s-transform:\n {Y}")
s-transform:
 [[ 0. 30. 27. 33.]
 [37. 33. 26. 26.]
 [32. 16. 29. 25.]
 [35. 33. 38. 28.]]
>>> Z = wh.ifwalsh2_S(Y)
>>> print(f"inverse s-transform:\n {Z}")
inverse s-transform:
 [[ 0.  3. -0.  8.]
 [ 7.  5.  1.  2.]
 [ 2.  3.  6.  1.]
 [ 4.  6.  8. -0.]]

Note that the first pixel is not meaningful and arbitrily set to 0.