A set of self-contained C++ routines to sample and resolve functions properly for plotting, and more. In all cases, the documentation is contained entirely in the header files, and usage examples are provided in the tests/ directory. All code can be obtained from the SVN repository.
Problem: Given a univariate function y = f(x), sample it in the interval [a, b], choose sample points x such that sharp features are fully resolved, using a parsimonious number of points.
Use: FunctionSampler1D.h or FunctionSampler1D_par.h (somewhat parallel friendly).
An example sampling of a highly oscillatory function:
As can be seen, the places where the function has high curvature are sampled
very finely.
Problem: Find the set of peaks (local maxima or minima) of a univariate function.
Use: PeakFinder1D.h. Processes the output of the sampling functions above, returning a list of all found features and some information on the properties of each peak/valley.
Problem: Fit a Lorentzian to a curve.
Use: SpectralFit.h/SpectralFit.cpp. Attempts to fit spectral lineshapes robustly. Can optionally use constrained least squares fitting to optimize the fitting parameters.