[SciPy-Dev] ENH: Extend peak finding capabilities in scipy.signal (#8264)
Lars G.
lagru at mailbox.org
Tue Jan 30 08:19:16 EST 2018
On 26.01.2018 20:59, Eric Larson wrote:
>> - argrelmax doesn't catch peaks that are wider than one sample. Decide
>> how to deal with this. I have implemented an alternative here which may
>> even be faster. But I plan to make a performance comparison to confirm
>> this. I have a feeling this should be addressed (if wanted) in a new
>> pull request.
>
> Another PR is fine, but we should merge that one before this find_peaks
> PR to avoid creating backward compatibility problems.
Actually I have changed my mind about submitting the alternative in
another PR. My current solution
http://nbviewer.jupyter.org/urls/gitlab.com/snippets/1695752/raw#Proposed-solution-2:-Cython
compares to `argrelmax` as follows:
- It is measurably faster than `argrelmax` for all
supported cases I could think of.
- It can find flat maxima / peaks which is my main
gripe with `argrelmax`.
- It uses Cython with all its implications. I have a
feeling that Python is preferred over creating
another file to compile but I think usage of
Cython is well-founded here. Dealing with flat peaks
was really costly in my pure-Python experiments.
- It only supports 1D arrays (which honestly is the
main use case for the signal module).
Because this function will be wrapped by find_peaks (or however choose
to name it) it doesn't really need to be exposed to the user
`find_peaks(x)` would be equivalent to `_maxima1D(x)`.
If nobody has any objections I'll include this as part of my original PR.
Regards, Lars
More information about the SciPy-Dev
mailing list