deserialize_array_to_params#

PySeismoSoil.helper_mkz_model.deserialize_array_to_params(array: ndarray, *, from_files: bool = False) → dict[str, float][source]#

Reconstruct a MKZ model parameter dictionary from an array of values.

The users need to ensure the order of values in array are in this order:

  • gamma_ref, s, beta, Gmax (if from_files is False)

  • gamma_ref, b, s, beta (if from_files is True)

(b is always 0, for historical reasons)

Parameters:
  • array (np.ndarray) – A 1D numpy array of MKZ parameter values in this order: gamma_ref, s, beta, Gmax

  • from_files (bool, default=False) – Whether the array was directly imported from a “H4_x_SITE_NAME.txt” file. If so, the 1st (0-based indexing) element, “b”, which must be 0, is neglected, and a dummy Gmax value (1.0) is padded at the end. The presence of “b” is due to historical reasons.

Returns:

param – The dictionary with parameter name as keys and values as values.

Return type:

dict[str, float]

Raises:

ValueError – When array does not have 4 values. Or, if from_files is True, when a value is NaN or infinite, or when “b” is not 0 (as in H4 files written by PySeismoSoil 0.7.1 or earlier, whose rows are gamma_ref, s, beta, Gmax).