The AbstractRecorder class#

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

Define the common base class for rainflow recorders.

Recorders receive loop data from an AbstractDetector. Subclasses choose which data to keep, for example only loop loads or also sample indices.

Notes

Override record_values() to store loop turning loads and record_index() to store the corresponding sample indices.

__init__()[source]#

Instantiate a recorder base.

chunk_local_index(global_index)[source]#

Transform global sample indices into chunk-local indices.

Parameters:

global_index (array_like) – Global sample indices to transform.

Returns:

  • chunk_number (numpy.ndarray) – Number of the chunk containing each indexed sample.

  • chunk_local_index (numpy.ndarray) – Index of each sample within its chunk.

property chunks#

Return chunk boundary indices reported so far.

Returns:

Sizes of the processed chunks in processing order.

Return type:

numpy.ndarray

Notes

The first chunk limit is the length of the first chunk, so identical to the index to the first sample of the second chunk, if a second chunk exists.

record_index(indeces_from, indeces_to)[source]#

Report hysteresis loop sample indices to the recorder.

Parameters:
  • indeces_from (array_like) – Sample indices where each hysteresis loop starts.

  • indeces_to (array_like) – Sample indices where each hysteresis loop turns back.

Notes

Default implementation does nothing. Can be implemented by recorders interested in the hysteresis loop indices.

record_values(values_from, values_to)[source]#

Report hysteresis loop values to the recorder.

Parameters:
  • values_from (array_like) – Load values where each hysteresis loop starts, typically in MPa.

  • values_to (array_like) – Load values where each hysteresis loop turns back, typically in MPa.

Notes

Default implementation does nothing. Can be implemented by recorders interested in the hysteresis loop values.

report_chunk(chunk_size)[source]#

Record the size of a processed sample chunk.

Parameters:

chunk_size (int) – Length of the chunk previously processed by the detector.

Notes

Should be called by the detector after the end of process().