rainflow¶
Overview
Extract turning points, count ASTM or four-point cycles, and recover the residual history.
py_fatigue.cycle_count.rainflow ¶
Rainflow cycle counting algorithms for fatigue analysis.
Implements: - ASTM E1049 three-point rainflow. - Four-point rainflow (Amzallag et al. 1994).
Also includes utilities to find turning points and extrema.
References
[1] ASTM E1049, Standard Practices for Cycle Counting in Fatigue [2] Rychlik (1987), "A new definition of the rainflow cycle counting method" [3] Amzallag et al. (1994), "Standardization of the rainflow counting method"
See also
findtp : Find indices to turning points. findextrema : Find indices to local maxima and minima. findcross : Find indices to level crossings.
Functions:¶
findcross ¶
findcross(x, v=0.0, kind=None)
Return sample indices just before crossings of level v.
A plateau at the crossing level belongs to the preceding side, with
the last level sample marking the crossing. Use "u" or "d" to
select a direction, or None, "all" or "du" for both.
Examples:
>>> findcross(np.array([-2, 0, 0, 3, 0, -1])).tolist()
[2, 4]
>>> findcross(np.array([-2, 0, 0, 3, 0, -1]), kind="d").tolist()
[4]
Source code in py_fatigue/cycle_count/rainflow.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
findcross_indices ¶
findcross_indices(xn)
Return indices immediately before zero crossings in signed data.
Source code in py_fatigue/cycle_count/rainflow.py
110 111 112 | |
findextrema ¶
findextrema(x)
Return indices where consecutive sample differences change sign.
Examples:
>>> findextrema(np.array([1, 3, 3, 0, 4])).tolist()
[2, 3]
Source code in py_fatigue/cycle_count/rainflow.py
98 99 100 101 102 103 104 105 106 107 | |
findrfc_astm ¶
findrfc_astm(tp, t=None)
Count cycles in a sequence of reversals using ASTM E1049.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tp
|
array - like
|
Reversal values in acquisition order. |
required |
t
|
array - like
|
Times at the reversals. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Amplitude, mean and cycle count (0.5 or 1.0) in each row.
If |
Examples:
>>> findrfc_astm(np.array([0, 4, 1, 5])).tolist()
[[1.5, 2.5, 1.0], [2.5, 2.5, 0.5]]
Source code in py_fatigue/cycle_count/rainflow.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
findrfc_fourpoint ¶
findrfc_fourpoint(tp, t=None)
Return rainflow counted cycles using the four-point method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tp
|
array - like
|
vector of turning-points (NB! Only values, not sampled times) |
required |
t
|
array - like
|
vector of sampled times |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
sig_rfc |
array - like
|
array of shape (n,3) or (n, 5) with: sig_rfc[:,0] Cycles amplitude sig_rfc[:,1] Cycles mean value sig_rfc[:,2] Cycle type, half (=0.5) or full (=1.0) sig_rfc[:,3] cycle_begin_time (only if t is given) sig_rfc[:,4] cycle_period_time (only if t is given) |
Source code in py_fatigue/cycle_count/rainflow.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | |
findtp ¶
findtp(x)
Return reversal indices with the first and last samples included.
Fewer than two interior reversals are treated as an empty sequence, following the cycle-counting convention of Py-Fatigue 2.1.1.
Examples:
>>> findtp(np.array([0, 3, 1, 5, 0])).tolist()
[0, 1, 2, 3, 4]
Source code in py_fatigue/cycle_count/rainflow.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
rainflow ¶
rainflow(
data, time=None, method="astm", extended_output=True
)
Returns the cycle-count of the input data calculated through the rainflow method (ASTM or four-point).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Union[ndarray, list]
|
time series or residuals sequence |
required |
time
|
Optional[Union[ndarray, list]]
|
sampled times, by default None |
None
|
method
|
str
|
"astm" or "fourpoint" |
'astm'
|
extended_output
|
bool
|
If True, also return residuals. |
True
|
Returns:
| Type | Description |
|---|---|
Union[ndarray, tuple]
|
|
Source code in py_fatigue/cycle_count/rainflow.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | |