![]() |
Persistence 1D inc. Reconstruct1D
1.1
Finding extrema in one dimensional data, filtering them by persistence and reconstructing smooth functions
|
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.
The code can be used in a C++ project by just including a header file, or from within Matlab via mex.
Check out the C++ examples and Matlab examples. There is also a little command line program persistence1d_driver.cpp to quickly process text files with data.
All relevant code (apart from examples and such) is found in a single header file (persistence1d.hpp) for simple inclusion in other projects. The only dependency is the C++ standard library. Everything is encapsulated into the namespace p1d. The main class is p1d::Persistence1D.
A detailed documentation of the Matlab interface is available.
For the sake of simplicity, only float data is supported, but supporting other data types should be straight-forward.
If desired, the output can be filtered by a persistence threshold and adjusted to use the 1-indexing convention (e.g., for Matlab).
The work flow with the class is as follows:
The work flow is similar to C++, with the only difference that the user gets a copy of all possible results and filtering is done Matlab-side. Index values are, of course, returned in Matlab 1-indexing convention.
See the documentation of the Matlab interface for more details.
Data values are ordered first according to their value, and then according to their indices (if the data value is the same). This has the following consequences:
Note that due to our interpretation of the data, local maxima cannot appear at the domain edges.
Reconstruct1D is an extension of Persistence1D, for reconstructing smooth functions based on persistent features in noisy data.
Reconstruct1D is written in Matlab and relies on Matlab's optimizers to reconstruct smooth functions which approximate the original data.
It is recommended to use MOSEK optimizers.
Check Reconstruct1D documentation for detailed documentation and examples.