SimPEG.utils.validate_ndarray_with_shape#

SimPEG.utils.validate_ndarray_with_shape(property_name, var, shape=None, dtype=<class 'float'>)[source]#

Validate numerical array property

Parameters:
property_namestr

The name of the property being set

vararray_like

The input array

shapetuple of int, or list of tuple of int, default: None

The shape of the array; e.g. (3, ), (3, 3), (‘*’, 2). The ‘*’ indicates that an arbitrary number of elements is allowed along a particular dimension. If list then multiple shapes are accepted. By default, shape is a tuple of length ndim of ‘*’.

dtypeclass, or tuple of class, optional

The data type for the array. I.e. float, int, complex, bool, etc. Validated from left to right if a tuple.

Returns:
numpy.ndarray of dtype

Returns the array in the specified data type once validated