pad_to_match¶
- pad_to_match(sig1: Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], sig2: Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], axis: int | tuple[int, ...] = ()) Any | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str][source][source]¶
Pad the second signal to match the first signal along all axes not specified.
Takes the two arrays and checks if the shape of sig2 is smaller than the shape of sig1. For each axis not specified, it will pad the second signal to match the first signal along that axis.
- Parameters:
sig1 (
ArrayLike) – The data to match.sig2 (
ArrayLike) – The data to pad.axis (
int | tuple) – The axes along which to pad the data.
- Returns:
sig2 – The padded data.
- Return type:
ArrayLike
Examples
>>> sig1 = np.arange(48).reshape(2, 3, 8) >>> sig2 = np.arange(24).reshape(2, 3, 4) >>> pad_to_match(sig1, sig2) array([[[ 0, 1, 2, 3, 2, 1, 0, 1], [ 4, 5, 6, 7, 6, 5, 4, 5], [ 8, 9, 10, 11, 10, 9, 8, 9]], [[12, 13, 14, 15, 14, 13, 12, 13], [16, 17, 18, 19, 18, 17, 16, 17], [20, 21, 22, 23, 22, 21, 20, 21]]])