Registry / analytics / rainflow

rainflow

JSON →
library3.2.0pypypi✓ verified 86d ago

Implementation of the ASTM E1049-85 rainflow cycle counting algorithm for fatigue analysis. Current version: 3.2.0, requires Python >=3.7. Releases are infrequent, no major changes recently.

pip install rainflow
INSTALL
IMPORT
SIG · RAINFLOW
R
rainflow
analyticspythonv3.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

count_cycles
from rainflow import count_cycles
from rainflow import Rainflow
The main function is not a class.

Count rainflow cycles from a 1D array of turning points.

import numpy as np from rainflow import count_cycles # Example signal signal = np.array([0, 1, -1, 2, -2, 3, -3, 2, -2, 1, -1, 0]) cycles = count_cycles(signal) print(cycles)
Debug
Known issues
gotchaInput should be a sequence of turning points (peaks and valleys), not a raw time series. The algorithm expects extrema only.
fix
Use `extract_turning_points()` to preprocess data if needed.
affects: all
gotchaThe `count_cycles` function returns cycles as a list of tuples (range, mean, count). The range is half the actual stress range (amplitude) if you're used to other conventions.
fix
Check your fatigue analysis literature: ASTM E1049 defines the range as the difference between peak and valley (full range). rainflow returns half the range (amplitude).
affects: all
deprecated`rainflow.cycle_count` function was deprecated in v3.0 and removed in v3.1. Use `count_cycles` instead.
fix
Replace `from rainflow import cycle_count` with `from rainflow import count_cycles`.
affects: >=3.0,<3.1
Errors
Common errors & fixes
AttributeError: module 'rainflow' has no attribute 'Rainflow'
The library does not export a class named Rainflow; only functions are available.
fix
Use `from rainflow import count_cycles` or `from rainflow import extract_turning_points`.
ImportError: cannot import name 'cycle_count' from 'rainflow'
`cycle_count` was removed in v3.1.
fix
Use `count_cycles` instead.
Upgrade
Version history
3.2.0latest on PyPI · released Apr 17, 2023
Audit
Dependencies
numpyrequiredNumerical dependency for array operations
Agent activity
25 hits · last 30 days
node
24
OpenAI (training)
1
Resources
rainflow — pip install rainflow · libregistry