The LoopValueRecorder class#

class pylife.stress.rainflow.LoopValueRecorder[source]#

Record rainflow loop turning loads.

The recorder stores the load value where each closed hysteresis loop starts and the value where it turns back. These values can be exposed as an explicit load collective or binned into a two-dimensional histogram.

__init__()[source]#

Instantiate a loop-value recorder.

property collective#

Return the recorded loops as an explicit load collective.

Returns:

DataFrame with columns from and to containing loop turning loads, typically in MPa.

Return type:

pandas.DataFrame

histogram(bins=10)[source]#

Calculate a pandas histogram of recorded loop loads.

An interval index is used to label the bins.

Parameters:

bins (int, array_like or list, optional) – Bin specification passed to numpy.histogram2d(). Default is 10.

Returns:

Histogram counts with interval index levels from and to.

Return type:

pandas.Series

histogram_numpy(bins=10)[source]#

Calculate a NumPy histogram of recorded loop loads.

Parameters:

bins (int, array_like or list, optional) – Bin specification passed to numpy.histogram2d(). Default is 10.

Returns:

  • H (numpy.ndarray) – Two-dimensional histogram of from and to load values.

  • xedges (numpy.ndarray) – Bin edges along the from load axis.

  • yedges (numpy.ndarray) – Bin edges along the to load axis.

record_values(values_from, values_to)[source]#

Record loop turning loads.

Parameters:
  • values_from (array_like) – Load values where loops start, typically in MPa.

  • values_to (array_like) – Load values where loops turn back, typically in MPa.

property values_from#

Return the loads where recorded loops start.

Returns:

Start load values, typically in MPa.

Return type:

numpy.ndarray

property values_to#

Return the loads where recorded loops turn back.

Returns:

Turn-back load values, typically in MPa.

Return type:

numpy.ndarray