MKZ_Param_Multi_Layer#

class PySeismoSoil.class_parameters.MKZ_Param_Multi_Layer(filename_or_data: str | numpy.ndarray | list[dict[str, float]] | list[PySeismoSoil.class_parameters.HH_Param], *, sep: str = '\t')[source]#

Bases: Param_Multi_Layer

Class implementation of multiple sets of MKZ parameters for multiple layers.

Its behavior is similar to a list, but with a more stringent requirement: all elements are of the same data type, i.e., MKZ_Param.

The list-like behaviors available are:
  • indexing: foo[3]

  • slicing: foo[:4]

  • setting values: foo[2] = …

  • length: len(foo)

  • deleting item: del foo[2]

  • checking existance: bar in foo

Parameters:
  • filename_or_data (str | np.ndarray | list[dict[str, float]] | list[HH_Param]) –

    A file name of a validly formatted “parameter file”, i.e., having the following format:

    param_layer_1

    param_layer_2

    param_layer_3

    1.1

    2.2

    3.3

    1.2

    2.3

    3.4

    or a 2D numpy array containing the data of the format above, or a list containing MKZ parameter data.

  • sep (str) – Delimiter of the file to be imported. If filename_or_data is not a file name, sep has no effect.

param_list#

A list of MKZ model parameters.

Type:

list<MKZ_Param>

n_layer#

The number of soil layers (i.e., the length of the list).

Type:

int

Raises:

TypeError – When then type of filename_or_data is not valid

Methods Summary

construct_curves([strain_in_pct, curve_type])

Construct G/Gmax and damping curves from parameter values.

save_txt(filename[, precision, sep])

Save data as text file.

serialize_to_2D_array()

Serialize the parameter data to a 2D numpy array.

Methods Documentation

construct_curves(strain_in_pct: np.ndarray = array([0.01, 0.01151395, 0.01325711, 0.01526418, 0.01757511, 0.0202359, 0.02329952, 0.02682696, 0.03088844, 0.0355648, 0.04094915, 0.04714866, 0.05428675, 0.06250552, 0.07196857, 0.08286428, 0.09540955, 0.10985411, 0.12648552, 0.14563485, 0.16768329, 0.19306977, 0.22229965, 0.25595479, 0.29470517, 0.33932218, 0.39069399, 0.44984327, 0.51794747, 0.59636233, 0.68664885, 0.79060432, 0.91029818, 1.04811313, 1.20679264, 1.38949549, 1.59985872, 1.84206997, 2.12095089, 2.44205309, 2.8117687, 3.23745754, 3.72759372, 4.29193426, 4.94171336, 5.68986603, 6.55128557, 7.54312006, 8.68511374, 10.]), curve_type: str | None = None) tuple['Multiple_GGmax_Curves', 'Multiple_Damping_Curves']#

Construct G/Gmax and damping curves from parameter values.

Parameters:
  • strain_in_pct (np.ndarray) – Strain array. Must be a 1D numpy array. Unit: %

  • curve_type (str) – Either “ggmax” or “xi” for option to calculate only one of them. “None” will be returned for the other curve object in this case.

Returns:

  • mgc (Multiple_GGmax_Curves) – G/Gmax curves for each soil layer.

  • mdc (Multiple_Damping_Curves) – Damping curves for each soil layer.

save_txt(filename: str, precision: str = '%.5g', sep: str = '\t', **kw_to_savetxt: dict[Any, Any]) None#

Save data as text file.

Parameters:
  • filename (str) – File name (including path) of the output file.

  • precision (str) – Precision of the numbers to be saved.

  • sep (str) – Delimiter identifier.

  • **kw_to_savetxt (dict[Any, Any]) – Additional keyword arguments to pass to numpy.savetxt().

serialize_to_2D_array() ndarray#

Serialize the parameter data to a 2D numpy array.

Returns:

param_2D_array – A 2D numpy array whose columns are parameters of each layer.

Return type:

np.ndarray