discretize.utils.as_array_n_by_dim#

discretize.utils.as_array_n_by_dim(pts, dim)[source]#

Coerce the given array to have dim columns.

The function as_array_n_by_dim will examine the pts array, and coerce it to be at least if the number of columns is equal to dim.

This is similar to the numpy.atleast_2d(), except that it ensures that then input has dim columns, and it appends a numpy.newaxis to 1D arrays instead of prepending.

Parameters:
ptsarray_like

array to check.

dimint

The number of columns which pts should have

Returns:
(n_pts, dim) numpy.ndarray

verified array