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 length length.

If something is a single value, extend it to a 1D numpy array whose length is length and elements are all something.

Parameters:
  • something (Any) – Any Python object.

  • length (int) – The desired length of array.

  • name (str, default=’something’) – The name of something for displaying the error message, if necessary.

Returns:

array – The array that something is extended to (if something is a single value). Or something itself.

Return type:

np.ndarray