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.407234 0.976535
1 10.080610 -0.004401
2 -1.420738 -2.699854
3 11.968007 -4.981204
4 4.060706 6.129724
... ... ...
1035 0.635274 8.891456
1036 2.177667 0.872150
1037 -0.037839 6.934588
1038 -3.699688 12.909098
1039 7.699617 -2.089339

1040 rows × 2 columns

Alternatively you can ask the recorder for a histogram matrix:

rfc.recorder.histogram(bins=16)
from                                       to                                       
(-11.352428271506437, -9.342268462399312]  (-11.607585723740108, -9.494498222729746]    0.0
                                           (-9.494498222729746, -7.381410721719384]     0.0
                                           (-7.381410721719384, -5.268323220709021]     0.0
                                           (-5.268323220709021, -3.155235719698659]     0.0
                                           (-3.155235719698659, -1.0421482186882969]    0.0
                                                                                       ... 
(18.79996886510043, 20.81012867420755]     (11.636376787373877, 13.749464288384239]     0.0
                                           (13.749464288384239, 15.862551789394601]     0.0
                                           (15.862551789394601, 17.975639290404963]     0.0
                                           (17.975639290404963, 20.088726791415326]     0.0
                                           (20.088726791415326, 22.20181429242569]      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