The array_split.split Module

Defines array splitting functions and classes.

Classes and Functions

shape_factors(n[, dim])

Returns a numpy.ndarray of factors f such that (len(f) == dim) and (numpy.prod(f) == n). The returned factors are as square (cubic, etc) as possible. For example::.

calculate_num_slices_per_axis(...[, ...])

Returns a numpy.ndarray (return_array say) where non-positive elements of the num_slices_per_axis sequence have been replaced with positive integer values such that numpy.prod(return_array) == num_slices and.

calculate_tile_shape_for_max_bytes(...[, ...])

Returns a tile shape tile_shape such that numpy.prod(tile_shape)*numpy.sum(array_itemsize) <= max_tile_bytes.

convert_halo_to_array_form(halo, ndim)

Converts the halo argument to a (ndim, 2) shaped array.

ShapeSplitter(array_shape[, ...])

Implements array shape splitting.

shape_split(array_shape, *args, **kwargs)

Splits specified array_shape in tiles, returns array of slice tuples.

array_split(ary[, indices_or_sections, ...])

Splits the specified array ary into sub-arrays, returns list of numpy.ndarray.

Attributes

array_split.split.ARRAY_BOUNDS = <property object>

Indicates that tiles are always within the array bounds, resulting in tiles which have truncated halos. See The halo parameter examples.

array_split.split.NO_BOUNDS = <property object>

Indicates that tiles may have halos which extend beyond the array bounds. See The halo parameter examples.

Utilities

is_scalar(obj)

Returns True if argument obj is a numeric type.

is_sequence(obj)

Returns True if argument obj is a sequence (e.g. a list or tuple, etc).

is_indices(indices_or_sections)

Test for the indices_or_sections argument of ShapeSplitter.__init__() to determine whether it is specifying total number of tiles or sequence of cut indices.

pad_with_object(sequence, new_length[, obj])

Returns sequence list end-padded with obj elements so that the length of the returned list equals new_length.

pad_with_none(sequence, new_length)

Returns sequence list end-padded with None elements so that the length of the returned list equals new_length.