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 7.680455 4.467043
1 11.075562 0.028139
2 0.890381 4.576081
3 -1.292629 4.230069
4 -2.658054 5.078166
... ... ...
1041 -1.365122 8.708695
1042 -5.096789 2.062115
1043 -5.781789 2.222039
1044 0.595941 -6.534524
1045 5.497802 2.547482

1046 rows × 2 columns

Alternatively you can ask the recorder for a histogram matrix:

rfc.recorder.histogram(bins=16)
from                                        to                                        
(-15.695520469634399, -13.506918693050148]  (-18.057371357561834, -15.865745152064429]    0.0
                                            (-15.865745152064429, -13.674118946567024]    0.0
                                            (-13.674118946567024, -11.482492741069619]    0.0
                                            (-11.482492741069619, -9.290866535572214]     0.0
                                            (-9.290866535572214, -7.099240330074808]      0.0
                                                                                         ... 
(17.133506179129373, 19.322107955713623]    (6.050516902909621, 8.242143108407028]        0.0
                                            (8.242143108407028, 10.433769313904435]       0.0
                                            (10.433769313904435, 12.625395519401838]      0.0
                                            (12.625395519401838, 14.817021724899242]      0.0
                                            (14.817021724899242, 17.00864793039665]       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