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 3.039283 -8.228077
1 11.423638 1.759643
2 2.425534 -1.046566
3 4.391702 -7.798551
4 9.992550 6.305596
... ... ...
1287 -0.477049 14.162551
1288 4.340079 0.327028
1289 -1.119225 4.523675
1290 14.786319 -1.760247
1291 1.343617 6.523167

1292 rows × 2 columns

Alternatively you can ask the recorder for a histogram matrix:

rfc.recorder.histogram(bins=16)
from                                       to                                        
(-18.71309415854188, -15.989146747684764]  (-19.28784191286835, -16.7303094202465]       0.0
                                           (-16.7303094202465, -14.172776927624646]      0.0
                                           (-14.172776927624646, -11.615244435002795]    0.0
                                           (-11.615244435002795, -9.057711942380944]     0.0
                                           (-9.057711942380944, -6.500179449759093]      0.0
                                                                                        ... 
(22.146117004314885, 24.87006441517201]    (8.845015505972011, 11.402547998593864]       0.0
                                           (11.402547998593864, 13.960080491215717]      0.0
                                           (13.960080491215717, 16.517612983837562]      0.0
                                           (16.517612983837562, 19.075145476459415]      0.0
                                           (19.075145476459415, 21.632677969081268]      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