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 -6.784859 -3.264760
1 -6.592733 -0.179737
2 -4.002281 -6.325156
3 0.145120 -9.342287
4 -4.426610 -3.014977
... ... ...
1159 -5.407487 -5.035202
1160 -12.281773 -9.883894
1161 -2.055458 -11.573929
1162 -13.757978 -0.896412
1163 -13.759253 4.441498

1164 rows × 2 columns

Alternatively you can ask the recorder for a histogram matrix:

rfc.recorder.histogram(bins=16)
from                                       to                                        
(-24.80416909465257, -22.292868898790612]  (-23.47532540346742, -21.042501545520004]     0.0
                                           (-21.042501545520004, -18.609677687572585]    0.0
                                           (-18.609677687572585, -16.17685382962517]     0.0
                                           (-16.17685382962517, -13.744029971677755]     0.0
                                           (-13.744029971677755, -11.31120611373034]     0.0
                                                                                        ... 
(12.865333843276776, 15.376634039138732]   (3.2857370339541596, 5.718560891901575]       0.0
                                           (5.718560891901575, 8.15138474984899]         0.0
                                           (8.15138474984899, 10.584208607796409]        0.0
                                           (10.584208607796409, 13.01703246574382]       0.0
                                           (13.01703246574382, 15.449856323691238]       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