Curve#
- class PySeismoSoil.class_curves.Curve(data: ndarray, *, strain_unit: Literal['1', '%'] = '%', interpolate: bool = False, min_strain: float = 0.0001, max_strain: float = 10.0, n_pts: int = 50, log_scale: bool = True, check_values: bool = True)[source]#
Bases:
object
Class implementation of a strain-dependent curve. It can be a stress-strain curve, a G/Gmax curve as a function of strain, or a damping curve as a function of strain.
- Parameters:
data (np.ndarray) – A 2D numpy array with 2 columns. Its 0th column contains the strain array, and the 1st column contains the accompanying values (such as stress, or G/Gmax).
strain_unit (Literal['1', '%']) – The unit of the strain.
interpolate (bool) – Whether to interpolate the input curve or not. If
False
, the following several parameters (min_strain
,max_strain
,n_pts
,log_scale
) have no effects.min_strain (float) – Minimum strain value of the strain array. If
interpolate
isTrue
, the rawdata
will be internally interpolated at a strain array defined bymin_strain
,max_strain
, andn_pts
.max_strain (float) – Maximum strain value of the strain array. Only effective when
interpolate
is set toTrue
.n_pts (int) – Number of points of the desired strain array to do the interpolation. Only effective when
interpolate
is set toTrue
.log_scale (bool) – Whether the strain array for interpolation is in log scale (or linear scale). Only effective when
interpolate
is set toTrue
.check_values (bool) – Whether to ensure that all values in
data
>= 0 when a class object is being constructed.
- raw_data#
The raw data that the user passed in
- Type:
np.ndarray
- strain#
The strain array at which interpolation happens, a 1D numpy array of shape (
n_pts
, ). The unit is percent (unit conversion happens internally if applicable).- Type:
np.ndarray
- values#
The interpolated values; same shape as
strain
- Type:
np.ndarray
- Raises:
ValueError – When
strain_unit
is not ‘1’ nor ‘%’
Methods Summary
plot
([plot_interpolated, fig, ax, title, ...])Plot the curve (y axis: values, x axis: strain)
Methods Documentation
- 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 the curve (y axis: values, x axis: strain)
- 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 notNone
) will override this parameter.dpi (float) – Figure resolution. The dpi of
fig
(if notNone
) 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.