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

REPET find_peaks max_num bug #45

Closed
kmads opened this issue Apr 18, 2016 · 0 comments
Closed

REPET find_peaks max_num bug #45

kmads opened this issue Apr 18, 2016 · 0 comments

Comments

@kmads
Copy link

kmads commented Apr 18, 2016

Function, as written on the page: find_peaks(data, min_thr=0.5, min_dist=None, max_num=1)
Simple example I used:
repet1 = Repet(signal)
data = np.array([0,0,.2,.5,1,1,0,1,0,1,0])
peaks_indices = repet1.find_peaks(data)
output: peaks_indices = [[4]]
peaks_indices = repet1.find_peaks(data, max_num=2)
output: peaks_indices = [[4 7]]
peaks_indices = repet1.find_peaks(data, max_num=3)
output: peaks_indices = [[0 4 7]]
peaks_indices = repet1.find_peaks(data, max_num=4)
output: peaks_indices = [[0 0 4 7]]
peaks_indices = repet1.find_peaks(data, max_num=5)
output: peaks_indices = [[0 0 0 4 7]]
etc.

So when max_num is set to an integer value greater than the number of peaks in the data, it adds the index 0 to the output peaks_indices list. It actually keeps adding index 0 (it does this (max_num - number_of_peaks_found) times). Instead, you should probably list only the peak indices found in data, and if fewer than max_num are found, then that is fine, because it is a max_num, not a min_num or total_num.

So in the example above, peaks_indices = repet1.find_peaks(data, max_num=5) should give an output of peaks_indices = [[4 7]]. Even though max_num=5, the system only found 2 peaks, so it should return just those two rather than adding in an incorrect (and repeated) index of 0.

@kmads kmads changed the title REPET find_peaks jax REPET find_peaks max_num bug Apr 18, 2016
@ethman ethman closed this as completed Sep 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants