Make `peak_local_max` return indices always sorted #2432

Closed
b52 opened this Issue Jan 6, 2017 · 4 comments

Projects

None yet

4 participants

@b52
Contributor
b52 commented Jan 6, 2017 edited

Currently, the method peak_local_max returns sorted indices (w.r.t. the intensities) if the number of indices is > num_peaks. I do understand that it is nowhere stated that peak_local_max does that, it is merely a side-effect, but I found it quite convenient.

Different behaviour arises when the number of indices <= num_peaks, in which case the indices are not sorted.

This is somewhat counter-intuitive and I therefore propose to make it the documented default to return indices sorted by their intensities in decreasing order.

I would be willing to write a PR for this.

@soupault
Member
soupault commented Jan 6, 2017

Sounds like a good change. 👍 from me.

@ahojnnes
Member
ahojnnes commented Jan 8, 2017

I think, this is a useful addition and shouldn't impact perfromance too much.

@kevcolin
kevcolin commented Jan 9, 2017 edited

Hello guys,
I've faced some problems recently when trying to use peak_local_max. I've asked a question on stackoverflow (http://stackoverflow.com/questions/41550022/typeerror-peak-local-max-got-an-unexpected-keyword-argument-num-peaks-per-la). Maybe some of you could take a quick look please ? Considering I'm a beginner, it's very likely that the function is fine and that I did something wrong, but still. Thank you (Edit : hi again, somebody pointed out I was just reading the wrong version of the documentation, sorry for disrupting)

@soupault
Member

Closed via #2435 .

@soupault soupault closed this Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment