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
U
is a 2d-array, the axis ofU
along which to wrap. The default is1
.add (float or array_like, default 0) – Term that is added to the repeated part of
U
before concatenation.
- Returns:
U_wrap – Extended array, where the first column (respectively, row) of
U
has been repeated by concatenation at the end ofU
.Note
If
U
is a 2d-array, then the output array has a shape of(n+1*(axis==0),m+1*(axis==1))
.If
U
is a 1d-array, then the output array has a shape of(n+1,)
. The first element ofU
has been repeated at the end.
- Return type:
array_like
See also
pad
Adds zeros to an array along one of its dimensions.
Example
>>> U_wrap = wrap(U,axis=1,add=0)