Does there exist an algorithm which detects the starting and stop points of valleys in a time-series?

91 Views Asked by At

I was able to loosely code something which does this in Python, but I was just wondering if there was a known mathematical formula or proper algorithm which estimates these points. I've marked "starting points" in green and "ending points" in red.

My intuition led me to estimating the second-derivative and doing peak detection on it, but I'm sure that my hunch isn't some novel invention, so I'd just like to make sure.

Example of starting and stop point detection

1

There are 1 best solutions below

0
On BEST ANSWER

I don't think there's a canned routine to do that. However, here's an idea, if you want something besides what you've already coded up.

  1. Do a peak (really valley) detection.
  2. For each "peak" you found in Step 1, form secant lines from the previous peak up to that "peak".
  3. The point corresponding to the steepest slope is the beginning of the valley.

You can do this in reverse to find the ends of valleys. That is, to find the ends of valleys, you "look forward" with your secant lines. To find the beginnings of valleys, you "look backwards" with your secant lines.