Closed abhijeet-pandey closed 2 years ago
Hello! Whenever you need both ranges and means you can use the function extract_cycles
instead of count_cycles
. Constructing a matrix (2-dimensional histogram) is, in my opinion, outside the scope of the rainflow
library. There are other, excellent tools for doing that. You could for example use numpy
:
ranges = []
means = []
counts = []
for range, mean, count, *_ in rainflow.extract_cycles():
ranges.append(range)
means.append(mean)
counts.append(count)
import numpy as np
matrix = np.histogram2d(x=ranges, y=means, weights=counts)
Thanks.
Not really an issue but a request for feature addition to get the rainflow matrix with cycles, mean and range into defined number of bins. This will make it convenient for fatigue calculation. The function count_cycle partially fulfills this need except that it does not produce corresponding means. For calculating bins for the mean one has to take care of weighing the means with number of cycles as explained here:http://www.vibrationdata.com/tutorials2/rainflow_counting_revB.pdf