[Numpy-discussion] Functions for finding the relative extrema of numeric data
jsilter at gmail.com
Fri Sep 9 17:57:19 EDT 2011
I'd like to see functions for calculating the relative extrema in a set of
data included in numpy. I use that functionality frequently, and always seem
to be writing my own version. It seems like this functionality would be
useful to the community at large, as it's a fairly common operation.
For numeric data (which is presumably noisy), the definition of a relative
extrema isn't completely obvious. The implementation I am proposing finds a
point in an ndarray along an axis which is larger (or smaller) than it's
`order` nearest neighbors (`order` being an optional parameter, default 1).
This is likely to find more points than may be desired, which I believe is
preferable to the alternative. The output is formatted the same as
Code available here: https://github.com/numpy/numpy/pull/154
I'm not sure whether this belongs in numpy or scipy, that question is
somewhat debatable. More sophisticated peak-finding functions (in N
dimensions, as opposed to 1) may also be useful to the community, and those
would definitely belong in scipy.
An alternative implementation would be to require that function be
continuously descending (or ascending) for `order` points, which would
enforce a minimum width on a peak.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion