Param_Multi_Layer#

class PySeismoSoil.class_parameters.Param_Multi_Layer(list_of_param_data: list[dict[str, float]] | list[PySeismoSoil.class_parameters.Parameter], *, element_class: Type[Parameter])[source]#

Bases: object

Class implementation of multiple curves.

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

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:
  • list_of_param_data (list[dict[str, float]] | list[Parameter]) – List of dict or a list of valid parameter class (such as HH_Param), which contain data for parameters of each layer.

  • element_class (Type[Parameter]) – A class name, such as HH_Param. Each element of list_of_param_dict will be used to initialize an object of element_class.

param_list#

A list of param objects whose type is specified by the user.

Type:

list[Parameter]

n_layer#

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

Type:

int

Raises:

TypeError – When an element in list_of_param_data has invalid type

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'][source]#

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[source]#

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[source]#

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