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 8.302703 0.823507
1 5.556203 0.347172
2 10.853039 -3.012042
3 -1.010219 -0.913478
4 -3.070994 0.813518
... ... ...
1163 1.352617 6.638422
1164 -2.070664 0.909544
1165 2.974789 2.156080
1166 -2.119738 5.021844
1167 8.606710 -10.526878

1168 rows × 2 columns

Alternatively you can ask the recorder for a histogram matrix:

rfc.recorder.histogram(bins=16)
from                                       to                                        
(-19.58725650441137, -17.227870497903172]  (-18.54424437690089, -16.148693925997755]     0.0
                                           (-16.148693925997755, -13.753143475094621]    0.0
                                           (-13.753143475094621, -11.357593024191488]    0.0
                                           (-11.357593024191488, -8.962042573288354]     0.0
                                           (-8.962042573288354, -6.56649212238522]       0.0
                                                                                        ... 
(15.803533593211611, 18.16291959971981]    (7.806810583033581, 10.202361033936715]       0.0
                                           (10.202361033936715, 12.597911484839848]      0.0
                                           (12.597911484839848, 14.993461935742982]      0.0
                                           (14.993461935742982, 17.38901238664612]       0.0
                                           (17.38901238664612, 19.78456283754925]        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