Persistence1D is a class for finding local extrema and their persistence in one-dimensional data. Local minima and local maxima are extracted, paired, and sorted according to their persistence.
The code runs in O(n log n) time, where n is the number of input points.
Persistence1D has been written by Yeara Kozlov and Tino Weinkauf, Max Planck Institute for Informatics, Saarbrücken, Germany. You may use it as you wish, it is in the public domain. If you find it useful, it would be nice to hear from you. Just drop us a line.
Find more info here.