spyrit.misc.walsh_hadamard.walsh_S
- spyrit.misc.walsh_hadamard.walsh_S(x, S=None)[source]
Return the Walsh S-transform of the signal x
- Args:
x(np.ndarray): signals of shape (*,n), where n+1 must be a power of two.H(np.ndarray, optional): S-matrix of order n.- Returns:
np.ndarray: S-transformed signal of shape (*,n).
- Examples:
Example 1: Walsh-ordered S-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_S(x) >>> print(s) [12. 9. 9. 16. 4. 5. 9.]
Example 2: Walsh-ordered S-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_S(x) >>> print(s) [[12. 9. 9. 16. 4. 5. 9.] [12. 4. 8. 12. 6. 6. 8.]]