Data in cycles
I'm trying to break a set of data into "cycles" for further processing. The data has no additional flags associated, so I can't identify the cycles any other way except numerically. Visually plotting data shows the cycles, but I'm looking for a robust numerically approach.
Given a list of datapoints...
- Calculate a moving average with a length of 4 for all points
- Calculate an approximate second derivative by taking the differences between the MAV values, and then the differences again - values here that are negative have the concavity of a peak
- Note: in this data set, after the peak is reached, the next value should effectively reset the cycle, causing a major cliff
- Keep track of the peak indicies
- Calculate the set of indicies directly after the peak indicies
- Split the list at these locations
Issues so far
This breaks down when an initial cycle is not long enough, and gets kept in the results of the following cycle. As shown in the example graph above, the
cycle 0 could get into
cycle 1 if the MAV doesn't smooth it over.
What's an industry used approach for this kind of problem?