pwtools.arrayio.arr2d_to_3d

pwtools.arrayio.arr2d_to_3d(arr, shape, axis=-1)[source]

Reshape 2d array arr to 3d array of shape, with 2d chunks aligned along axis.

Parameters:
  • arr (2d array)

  • shape (tuple) – Target shape of 3d array

  • axis (int) – Axis of 3d arr along which 2d chunks are placed.

Returns:

arr3d

Return type:

3d array

Examples

>>> axis = 1
>>> shape = (50, 1000, 3)
>>> shape_2d_chunk =  (50, 3)
>>> arr.shape = (1000*50,3)