I have SOC (state of charge of a battery) when SOC 1st half cycle (0 to 100%) and 2nd half cycle (100% to 0) considering as full cycle see this figure in my data there is no full cycles present there is half cycles and quarter cycles are there how to count the battery full cycles with data here is my SOC data attached google spread sheet https://docs.google.com/spreadsheets/d/126sV3E5EuqCEdrtWIWEPhUJ8-2zPHPTyJhY0WWIIoNQ/edit?usp=sharing My script: import rainflow list_x=list(df["SOC"]) len(list_x) from scipy.interpolate import splrep, splev fig= plt.figure(figsize=(19,6)) bspl = splrep(t,list_x,s=130000) bspl_y = splev(t,bspl) plt.plot(t,list_x) plt.plot(t,bspl_y) rainflow.count_cycles(bspl_y) is not able to count the cycles from above algorithm. Is there any to solve the problem like this? Thanks in regards Continue reading...