spyrit.misc.walsh_hadamard.walsh_G
- spyrit.misc.walsh_hadamard.walsh_G(x, G=None)[source]
Return the Walsh G-transform of the signal x
- Args:
x(np.ndarray): signals of shape (*,n), where n+1 must be a power of two.- Returns:
np.ndarray: G-transformed signal of shape (*,n).
- Examples:
Example 1: Walsh-ordered G-transform of a signal of length 7
>>> import spyrit.misc.walsh_hadamard as wh >>> x = np.array([1, 3, 0, -1, 7, 5, 1]) >>> s = wh.walsh_G(x) >>> print(s) [ -8 -2 -2 -16 8 6 -2]
Example 2: Walsh-ordered G-transform of two signals of length 7
>>> import spyrit.misc.walsh_hadamard as wh >>> x = np.array([[1, 3, 0, -1, 7, 5, 1],[2, 1, -1, 0, 4, 5, 3]]) >>> s = wh.walsh_G(x) >>> print(s) [[ -8 -2 -2 -16 8 6 -2] [-10 6 -2 -10 2 2 -2]]