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 -1.270596 0.868935
1 -0.550214 -0.922711
2 1.045485 4.640091
3 -1.136673 0.413488
4 5.781955 4.610192
... ... ...
968 11.051561 -8.267899
969 1.654721 8.182970
970 13.741464 -5.371465
971 0.495615 6.558084
972 -6.006420 8.699240

973 rows × 2 columns

Alternatively you can ask the recorder for a histogram matrix:

rfc.recorder.histogram(bins=16)
from                                        to                                        
(-17.571209064541147, -15.263981697871834]  (-17.661019807243704, -15.358475832924075]    0.0
                                            (-15.358475832924075, -13.055931858604447]    0.0
                                            (-13.055931858604447, -10.75338788428482]     0.0
                                            (-10.75338788428482, -8.45084390996519]       0.0
                                            (-8.45084390996519, -6.148299935645561]       0.0
                                                                                         ... 
(17.03720143549854, 19.34442880216785]      (7.666963910272209, 9.969507884591838]        0.0
                                            (9.969507884591838, 12.272051858911468]       0.0
                                            (12.272051858911468, 14.574595833231093]      0.0
                                            (14.574595833231093, 16.877139807550726]      0.0
                                            (16.877139807550726, 19.179683781870352]      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