parabolic

maelzel.snd.freqestimate.parabolic(f, x)[source]

Estimates inter-sample maximum

Quadratic interpolation for estimating the true position of an inter-sample maximum when nearby samples are known.

Parameters:
  • f (ndarray) – a vector (an array of sampled values over a regular grid)

  • x (int) – index for that vector

Return type:

tuple[float, float]

Returns:

(vx, vy), the coordinates of the vertex of a parabola that goes through point x and its two neighbors.

Example

Defining a vector f with a local maximum at index 3 (= 6), find local maximum if points 2, 3, and 4 actually defined a parabola.

>>> f = [2, 3, 1, 6, 4, 2, 3, 1]
>>> parabolic(f, 3)
Out[4]: (3.2142857142857144, 6.1607142857142856)