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.724721 1.624558
1 6.414000 -0.362462
2 9.298840 -2.713757
3 11.761001 -9.883448
4 14.488070 -2.034015
... ... ...
1261 14.056376 -0.812414
1262 20.059544 -2.073362
1263 7.759735 1.727555
1264 14.016753 9.351696
1265 -2.971700 18.835175

1266 rows × 2 columns

Alternatively you can ask the recorder for a histogram matrix:

rfc.recorder.histogram(bins=16)
from                                        to                                        
(-14.768568722289675, -12.345321568681968]  (-13.376198624681479, -10.919002712295143]    0.0
                                            (-10.919002712295143, -8.461806799908807]     0.0
                                            (-8.461806799908807, -6.004610887522471]      0.0
                                            (-6.004610887522471, -3.5474149751361352]     0.0
                                            (-3.5474149751361352, -1.0902190627497994]    0.0
                                                                                         ... 
(21.58013858182593, 24.00338573543364]      (13.652956411568216, 16.11015232395455]       0.0
                                            (16.11015232395455, 18.567348236340887]       0.0
                                            (18.567348236340887, 21.024544148727223]      0.0
                                            (21.024544148727223, 23.481740061113555]      0.0
                                            (23.481740061113555, 25.9389359734999]        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