Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scipy.signal.find_peaks_cwt has a "bad" default parameter that isn't an argument #9016

Open
chelsell opened this issue Jul 10, 2018 · 2 comments

Comments

@chelsell
Copy link

This is a useful function, but I've noticed that its performance on data composed of nearby peaks is much worse than on data that is more spread out. I think this is likely because the default value for window_size in _filter_ridge_lines is just the number of original data points divided by 20. In cases where peaks are relatively close together, points that lie on neighboring peaks are included in the noise floor calculation! I've noticed this problem is particularly bad if a peak is found midway between two larger neighbors.

This window size should probably be an argument to find_peaks_cwt anyway, but I would further propose that the default window be something more like 4 * max(cwt[0]), or 4 times the width of the largest wavelet scale, since the wavelet scales are already intuitively related to expected peak widths.

@v0dro
Copy link
Contributor

v0dro commented Mar 22, 2022

@chelsell can you provide some examples where using your proposed default value leads to an improvement of the result? If there is an improvement for most cases, we can consider changing the default value.

@v0dro
Copy link
Contributor

v0dro commented Mar 23, 2022

@rgommers consider closing due to danger of backward incompatibility?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants