Commit 386542c
ENH: Extend peak finding capabilities in scipy.signal (scipy#8264)
* ENH: Add function to calculate peak prominence to scipy.signal
This function allows to calculate the prominince of a peak in a signal.
The prominence is a measure for how much a peak stands out from the
base line of a signal.
See scipy#8264.
* ENH: Add function to calculate peak width to scipy.signal
This function allows to calculate the width of a peak in a signal.
The width is the horizontal distance between a peaks rising and
falling slope at a chosen height.
See scipy#8264
* ENH: Add new find_peaks function to scipy.signal
This function allows to find a subset of all local maxima in a vector
by specifying requirements e.g. peak height, distance, etc.
It wraps and uses the two public functions
- peak_prominences
- peak_widths
and the private functions
- _unpack_filter_args
- _filter_generic
- _filter_by_peak_threshold
- _filter_by_peak_distance
See scipy#8264
* TST: Add tests for new functions in scipy.signal
Adds basic tests (full coverage) for the functions:
- scipy.signal.peak_promineces
- scipy.signal.peak_widths
- scipy.signal._peak_finding._unpack_filter_args
- scipy.signal.find_peaks
Also add notice to THANKS.txt and use better function order in signals
toctree.
See scipy#8264.
* DOC: Shorter function references & fix example in peak_widths
- The prefix `scipy.signal.` is not needed to create references to other
functions within the module. The shorter version is more readable.
- The example in `peak_widths` was broken for Python 2.7 because it
relied on implicit float division with integers.
- The example now uses the argument `rel_height` to be more explicit.
See scipy#8264
* MAINT: Address suggested improvements in scipy#8264
- Replace kwargs in peak_widths with optional keyword arguments which
improves introspection and resistance against typos.
- Removed obsolete if-statement if number of peaks was 0. That way
the content of `properties` gets populated properly. Extended unit
tests to account for this.
- Removed unnecessary indentation for prominence and with filtering.
- Refactored "wheights" to "width_heights" which is more consistent
with "peak_heights" and more descriptive.
- More readable format for properties-key-list in docstring of
find_peaks.
- Explained usage of open interval `(None, None)` and made unit tests
use this construct.
- Replaced example in find_peaks's docstring with a more complex one
that demonstrates simple and more advanced usage.
* MAINT: Improve terminology in documentation and code
- Don't use the term "filter" because in the context of this module it
already has a meaning. Instead use "condition", "select" or other
terms.
- "filter options" are now named "conditions" which has a clearer
meaning.
- Remove unnecessary argument `peaks` in for function
`_select_by_property`.
- Use "in samples" where horizontal distance is required.
- Added some cases to unit tests and refactored a few objects.
* DOC: Add new functions for peak finding to release notes 1.1.0
* DOC: Describe behavior on flat extrema for argrelmax & argrelmin
A reference to find_peaks which detects flat maxima was added as well
where appropriate.1 parent 102c334 commit 386542c
File tree
5 files changed
+1116
-15
lines changed- doc/release
- scipy/signal
- tests
5 files changed
+1116
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
48 | 60 | | |
49 | 61 | | |
50 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
285 | 288 | | |
286 | 289 | | |
287 | 290 | | |
| |||
0 commit comments