The AbstractRecorder class

class pylife.stress.rainflow.AbstractRecorder[source]

A common base class for rainflow recorders.

Subclasses implementing a rainflow recorder are supposed to implement the following methods:

  • record_values()

  • record_index()

__init__()[source]

Instantiate an AbstractRecorder.

chunk_local_index(global_index)[source]

Transform the global index to an index valid in a certain chunk.

Parameters:

global_index (array-like int) – The global index to be transformed.

Returns:

  • chunk_number (array of ints) – The number of the chunk the indexed sample is in.

  • chunk_local_index (array of ints) – The index of the sample in its chunk.

property chunks

The limits index of the chunks processed so far.

Note

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]

Record hysteresis loop index to the recorder.

Parameters:
  • indeces_from (list of ints) – The sample indeces where the hysteresis loop starts from.

  • indeces_to (list of ints) – The sample indeces where the hysteresis loop goes to and turns back from.

Note

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

record_values(values_from, values_to)[source]

Report hysteresis loop values to the recorder.

Parameters:
  • values_from (list of floats) – The sample values where the hysteresis loop starts from.

  • values_to (list of floats) – The sample values where the hysteresis loop goes to and turns back from.

Note

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

report_chunk(chunk_size)[source]

Report a chunk.

Parameters:

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

Note

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