You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
kmads
changed the title
REPET find_peaks jax
REPET find_peaks max_num bug
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 ofpeaks_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.The text was updated successfully, but these errors were encountered: