unbin_array#
- unbin_array(arr, binfactor)[source]#
Unbin (by repetition) an N-D array by a given factor.
Let
arr.shape = (s1, s2, ...)andbinfactor = (b1, b2, ...)(same length), the new shape will be(s1*b1, s2*b2, ...).- Parameters:
arr (
numpy.ndarray) – Input array.binfactor (
intortupleofint) – Unbin factor. If an integer, it is used for all axes. If its length is lower thanarr.ndim, it is prepended with 1’s.
- Returns:
numpy.ndarray– Array of shape(s1*b1, s2*b2, ...), each input element being repeatedb1 x b2 x ...times.
See also
bin_arrayThe opposite operation.
Examples
>>> unbin_array(np.arange(2*3).reshape(2, 3), 2).shape (4, 6) >>> unbin_array(np.arange(2*3).reshape(2, 3), (2,)).shape (2, 6) >>> unbin_array(np.arange(2*3).reshape(2, 3), (2, 1)).shape (4, 3)