Multiple_Curves#

class PySeismoSoil.class_curves.Multiple_Curves(list_of_curves: list[numpy.ndarray] | list[PySeismoSoil.class_curves.Curve], *, element_class: ~typing.Type[~PySeismoSoil.class_curves.Curve] = <class 'PySeismoSoil.class_curves.Curve'>)[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

  • appending: foo.append(bar)

Parameters:
  • list_of_curves (list[np.ndarray] | list[Curve]) – List of 2-column numpy arrays, which are in (strain [%], curve_value) format. Or list of a valid Curve-like type (such as GGmax_Curve).

  • element_class (Type[Curve]) – A class name. Each element of list_of_curve will be used to initialize an object of element_class.

element_class#

Same as the input parameter.

Type:

Type[Curve]

curves#

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

Type:

list[Type[Curve]]

n_layer#

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

Type:

int

Raises:

TypeError – When any element in list_of_curves has invalid type

Methods Summary

append(item)

Append another curve item to the curves.

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

Plot multiple curves together on one figure.

Methods Documentation

append(item) None[source]#

Append another curve item to the curves.

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 = None, 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, one new figure will be created.

  • ax (Axes | None) – Axes object. If None, one new Axes object will be created. If the user provides an Axes object but no Figure object, the user provided Axes object will be overwritten by a new Axes object.

  • 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.