iamlikeme / rainflow

Implementation of the rainflow-counting algorythm in Python
MIT License
105 stars 34 forks source link

Functionality Rainflow: Neglection of first and last half circle #29

Closed caweramboll closed 4 years ago

caweramboll commented 4 years ago

I discovered a bug which is replicate using following example:

import numpy as np
import rainflow  # https://pypi.org/project/rainflow/
x = np.linspace(0, (4.0)*np.pi, num=19)
y = [np.cos(i) for i in x]
RFC_output = rainflow.count_cycles(y, binsize=0.5)

RFC_output = [(0.5, 0), (1.0, 0), (1.5, 0), (2.0, 1.0)]

As the example is two periods of the cosine function, the output should be the following:

RFC_correct = [(0.5, 0), (1.0, 0), (1.5, 0), (2.0, 2.0)]

I checked with other functions as well and found out that in general the first and last half circle are neglected in the rainflow algorithm.

caweramboll commented 4 years ago

This issue was solved in version v2.1.1 (see issue #9) with the left and right functionality