raman.get_closest_maximum

raman.get_closest_maximum(x, y, x0)

Returns the position and value of the (local) maximum closest to x0.

First, the function gets the local maximum in y closest to x0 by following the gradient. Once the function value does not increase any more, it stops. Second, a parabolic approximation is used on this value and its two neighbours to get a more exact estimate.

Note

This function is not noise resistant. In order to get good results, use a x0-value as close as possible to the peak maximum.

Parameters:
  • x (array) – x-values.
  • y (array) – y-values / data (same shape as x).
  • x0 (float) – x-position of a point close to the maximum.
Returns:

(x’, y’) Position and value of (local) maximum closest to x0.