[Numpy-discussion] Functions for finding the relative extrema of numeric data
Benjamin Root
ben.root@ou....
Tue Sep 13 15:44:03 CDT 2011
On Tue, Sep 13, 2011 at 3:34 PM, Ralf Gommers
<ralf.gommers@googlemail.com>wrote:
> Hi Jacob,
>
> On Fri, Sep 9, 2011 at 11:57 PM, Jacob Silterra <jsilter@gmail.com> wrote:
>
>> Hello all,
>>
>> 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.
>>
>
> What is your application?
>
>>
>> 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
>> numpy.where.
>>
>> 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.
>>
>
> I have the feeling this belongs in scipy. Although if it's just these two
> functions I'm not sure where exactly to put them. Looking at the
> functionality, this is quite a simple approach. For any data of the type I'm
> usually working with it will not be able to find the right local extrema.
> The same is true for your alternative definition below.
>
> A more powerful peak detection function would be a very good addition to
> scipy imho (perhaps in scipy.interpolate?). See also
> http://stackoverflow.com/questions/1713335/peak-finding-algorithm-for-python-scipy
>
> Cheers,
> Ralf
>
>
Actually, such an algorithm would be great to partner with the watershed
clustering implementation in ndimage.
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110913/ad472e55/attachment.html
More information about the NumPy-Discussion
mailing list