Multiple_GGmax_Curves#

class PySeismoSoil.class_curves.Multiple_GGmax_Curves(filename_or_list_of_curves: str | list[numpy.ndarray], *, sep: str = '\t')[source]#

Bases: Multiple_Curves

Class implementation of multiple G/Gmax curves.

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

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

  • appending: foo.append(bar)

Parameters:
  • filename_or_list_of_curves (str | list[np.ndarray]) – A file name of a validly formatted “curve file”, or a list of 2-column numpy arrays, which are in (strain [%], G/Gmax) format.

  • sep (str) – Delimiter of the file to be imported. If filename_or_list_of_curves is a list, this parameter has no effect.

curves#

A list of GGmax_Curve objects.

Type:

list[GGmax_Curve]

n_layer#

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

Type:

int

Raises:

TypeError – When the type of filename_or_list_of_curves is not recognizable

Methods Summary

append(item)

Append another curve item to the curves.

get_curve_matrix([damping_filler_value, ...])

Produce a full "curve matrix" based on the G/Gmax data defined in objects of this class.

plot([plot_interpolated, fig, ax, title, ...])

Plot multiple curves together on one figure.

Methods Documentation

append(item) None#

Append another curve item to the curves.

get_curve_matrix(damping_filler_value: float = 1.0, save_to_file: bool = False, full_file_name: str | None = None) ndarray[source]#

Produce a full “curve matrix” based on the G/Gmax data defined in objects of this class.

The full “curve matrix” will be in the following format:

strain [%]

G/Gmax

strain [%]

damping [%]

strain [%]

G/Gmax

Since this class only defines G/Gmax curves, not damping curves, damping values will be filled with some dummy values.

Parameters:
  • damping_filler_value (float) – A dummy value to fill all the damping curves.

  • save_to_file (bool) – Whether to save the “curve matrix” as a text file.

  • full_file_name (str | None) – Full file name to save to the hard drive. It can be None if save_to_file is set to False.

Returns:

curve_matrix – A matrix containing G/Gmax curves in the above-mentioned format.

Return type:

np.ndarray

plot(plot_interpolated: bool = True, fig: matplotlib.figure.Figure | None = None, ax: matplotlib.axes._axes.Axes | None = None, title: str | None = None, xlabel: str | None = 'Strain [%]', ylabel: str | None = 'G/Gmax', figsize: tuple[float, float] = (3, 3), dpi: float = 100, **kwargs_to_matplotlib: dict[Any, Any]) tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes][source]#

Plot multiple curves together on one figure.

Parameters:
  • plot_interpolated (bool) – Whether to plot the interpolated curve or the raw data.

  • fig (Figure | None) – Figure object. If None, a new figure will be created.

  • ax (Axes | None) – Axes object. If None, a new axes will be created.

  • title (str | None) – Title of plot.

  • xlabel (str | None) – X label of plot.

  • ylabel (str | None) – Y label of plot.

  • figsize (tuple[float, float]) – Figure size in inches, as a tuple of two numbers. The figure size of fig (if not None) will override this parameter.

  • dpi (float) – Figure resolution. The dpi of fig (if not None) will override this parameter.

  • **kwargs_to_matplotlib (dict[Any, Any]) – Keyword arguments to be passed to matplotlib.pyplot.plot().

Returns:

  • fig (Figure) – The figure object being created or being passed into this function.

  • ax (Axes) – The axes object being created or being passed into this function.