gustaf.utils.arr#

gustaf/gustaf/utils/arr.py.

Useful functions for array / point operations. Named arr, since array is python library and it sounds funny.

Functions

bounds(arr)

Return bounds.

bounds_diagonal(arr)

Returns diagonal vector of the bounds.

bounds_mean(arr)

Returns mean of the bounds.

bounds_norm(arr)

Returns norm of the bounds.

close_rows(arr[, tolerance, ...])

Similar to unique_rows, but if data type is floats, use this one.

cross3d(a, b)

Cross product for two 3D arrays.

derivatives_to_normals(derivatives[, normalize])

enforce_len(value, n_len)

Given int, float, np.ndarray, tuple, list, returns an array with n_len len().

is_one_of_shapes(arr, shapes[, strict])

Tuple/list of given shapes, iterates and checks with is_shape.

is_shape(arr, shape[, strict])

Checks if arr matches given shape.

make_c_contiguous(array[, dtype])

Make given array like object a c contiguous np.ndarray.

rotate(arr, rotation[, rotation_axis, degree])

Rotates given arrays.

rotation_matrix(rotation[, degree])

Compute rotation matrix.

rotation_matrix_around_axis([axis, ...])

Compute rotation matrix given the axis of rotation.

select_with_ranges(arr, ranges)

Select array with ranges of each column.

unique_rows(in_arr[, return_index, ...])

Find unique rows using np.unique, but apply tricks.