netsse.tools.misc_func.wrap#
- netsse.tools.misc_func.wrap(U, axis=1, add=0)#
Wraps an array around one of its dimensions.
- Parameters:
U (array_like of shape (n,m) or (n,)) – Input array to be wrapped around.
axis ({1,0}, optional) – If
Uis a 2d-array, the axis ofUalong which to wrap. The default is1.add (float or array_like, default 0) – Term that is added to the repeated part of
Ubefore concatenation.
- Returns:
U_wrap – Extended array, where the first column (respectively, row) of
Uhas been repeated by concatenation at the end ofU.Note
If
Uis a 2d-array, then the output array has a shape of(n+1*(axis==0),m+1*(axis==1)).If
Uis a 1d-array, then the output array has a shape of(n+1,). The first element ofUhas been repeated at the end.
- Return type:
array_like
See also
padAdds zeros to an array along one of its dimensions.
Example
>>> U_wrap = wrap(U,axis=1,add=0)