extend_scalar#

PySeismoSoil.helper_generic.extend_scalar(scalar: float | numpy.number, length: int) → ndarray[source]#

“Extend” a scalar (float, int, or numpy.number type) into a 1D array.

The output is a 1D numpy array whose length is length and whose elements are all scalar.

Parameters:
  • scalar (float | np.number) – A single number.

  • length (int) – The length of the desired output.

Returns:

A 1D numpy array with length length and elements of value scalar.

Return type:

np.ndarray

Raises:

TypeError – When scalar is not of a supported type