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.428708 -8.292591
1 -2.640209 -7.117872
2 -9.735511 8.818898
3 -11.252765 2.277884
4 -7.111706 -6.950199
... ... ...
1219 -12.901315 -4.696084
1220 -5.634877 -4.786074
1221 -13.168621 3.272549
1222 -13.423314 5.436486
1223 -16.171247 1.255030

1224 rows × 2 columns

Alternatively you can ask the recorder for a histogram matrix:

rfc.recorder.histogram(bins=16)
from                                       to                                        
(-24.767713485357586, -22.19110498139535]  (-23.92782241056743, -21.35130708767741]      0.0
                                           (-21.35130708767741, -18.774791764787388]     0.0
                                           (-18.774791764787388, -16.198276441897363]    0.0
                                           (-16.198276441897363, -13.621761119007344]    0.0
                                           (-13.621761119007344, -11.045245796117323]    0.0
                                                                                        ... 
(13.881414074075966, 16.458022578038204]   (4.413846141222805, 6.99036146411283]         0.0
                                           (6.99036146411283, 9.566876787002847]         0.0
                                           (9.566876787002847, 12.143392109892872]       0.0
                                           (12.143392109892872, 14.71990743278289]       0.0
                                           (14.71990743278289, 17.296422755672914]       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, flush=False)[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