The FKMDetector class

class pylife.stress.rainflow.FKMDetector(recorder)[source]

Rainflow detector as described in FKM non linear.

The algorithm has been published by Clormann & Seeger 1985 and has been cited heavily since.

from pylife.stress.timesignal import TimeSignalGenerator
import pylife.stress.rainflow as RF

ts = TimeSignalGenerator(10, {
    'number': 50,
    'amplitude_median': 1.0, 'amplitude_std_dev': 0.5,
    'frequency_median': 4, 'frequency_std_dev': 3,
    'offset_median': 0, 'offset_std_dev': 0.4}, None, None).query(10000)

rfc = RF.FKMDetector(recorder=RF.LoopValueRecorder())
rfc.process(ts)

rfc.recorder.collective
from to
0 -4.473940 1.625261
1 3.309997 -7.893971
2 -2.834397 -4.057957
3 -4.291691 8.971228
4 -5.288758 -5.942697
... ... ...
988 -5.289755 -3.130357
989 -10.458992 0.969617
990 -11.548792 5.003818
991 6.574556 -14.731735
992 -11.600907 -0.205800

993 rows × 2 columns

Alternatively you can ask the recorder for a histogram matrix:

rfc.recorder.histogram(bins=16)
from                                        to                                        
(-19.438559056277544, -17.504671783133123]  (-18.540538232690018, -16.548515188250068]    0.0
                                            (-16.548515188250068, -14.556492143810118]    0.0
                                            (-14.556492143810118, -12.564469099370168]    0.0
                                            (-12.564469099370168, -10.572446054930218]    0.0
                                            (-10.572446054930218, -8.580423010490268]     0.0
                                                                                         ... 
(9.569750040888753, 11.503637314033172]     (3.3717152561494323, 5.363738300589382]       0.0
                                            (5.363738300589382, 7.355761345029332]        0.0
                                            (7.355761345029332, 9.347784389469282]        0.0
                                            (9.347784389469282, 11.339807433909233]       0.0
                                            (11.339807433909233, 13.331830478349183]      0.0
Length: 256, dtype: float64

Note

This detector does not report the loop index.

__init__(recorder)[source]

Instantiate a FKMDetector.

Parameters:

recorder (subclass of AbstractRecorder) – The recorder that the detector will report to.

process(samples)[source]

Process a sample chunk.

Parameters:

samples (array_like, shape (N, )) – The samples to be processed

Returns:

self – The self object so that processing can be chained

Return type:

FKMDetector