Split a single array into multiple sub-arrays along the third axis (depth). Only works on arrays of 3 or more dimensions.

apply_along_axis (funcld, axis, arr, *args)

Execute funcld(arr[selJ], *args) where funcld takes 1-d arrays and arr is an N-d array, where sel j is a selection object sufficient to select a 1-d sub-array along the given axis. The function is executed for all 1-d arrays along axis in arr.

apply_over_axes (func, a, axes)

For each axis in the axes sequence, call func as res = func (a, axis) . If res is the same shape as a then set a=res and continue. if res .ndim = a .ndim -1, then insert a dimension before axis and continue.

expand_dims (a, axis)

Expand the shape of array a by including newaxis before the given axis. resize (a, new_shape)

Returns a new array with the specified shape which can be any size. The new array is filled with repeated copies of a. This function is similar in spirit to a.resize(new_shape) except that it fills in the new array with repeated copies and returns a new array.

Return a composite array with blocks from b scaled by elements of a. The number of dimensions of a and b should be the same. If not, then the input with fewer dimensions is pre-pended with ones (broadcast) to the same shape as the input with more dimensions. The return array has this same number of dimensions with shape given by the product of the shape of a and the shape of b. If either a or b is a scalar then this function is equivalent to multiply(a,b).

For example, if a and b are is 1-d the result is a[0] * b a[1] * b ■ ■ ■ a[—1] * b while if a and b are 2-d, the result is a[0, 0] * b a[0, 1] * b a[1, 0] * b a[1, 1] * b a[0, —1] * b a[1, —1] * b a[—1, 0] * b a[—1, 1] * b ••• a[—1, —1] * b

Was this article helpful?

0 0

Post a comment