check_length_or_extend_to_array#
- PySeismoSoil.helper_generic.check_length_or_extend_to_array(something: Any, length: int, name: str = '`something`') ndarray [source]#
Check that
something
is a 1D numpy array with lengthlength
, or ifsomething
is a single value, extend it to a 1D numpy array whose length islength
and elements are allsomething
.- Parameters:
something (Any) – Any Python object.
length (int) – The desired length of array.
name (str) – The name of
something
for displaying the error message, if necessary.
- Returns:
array – The array that
something
is extended to (ifsomething
is a single value). Orsomething
itself.- Return type:
np.ndarray