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
I'm using your library and I'm having cases in that I get an error using with_min_distance().
let mut local_minima_fp = PeakFinder::new(&data); // a Vec<f64>
local_minima_fp.with_min_prominence(4.764600000000001);
local_minima_fp.with_min_distance(20);
This is the error message:
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/pmagaz/.cargo/registry/src/github.com-1ecc6299db9ec823/find_peaks-0.1.2/src/lib.rs:285:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Taking a quick look at the code, it looks like peaks variable could have no elements, therefore peaks[0] could be the reason?
let mut filtered = Vec::with_capacity(peaks.len());
filtered.push(peaks[0].clone());
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Thanks for reporting the issue!
I added a check for empty peaks vector before using distance-based filtering which should solve the issue.
Should be fixed in version 0.1.3
Hi,
I'm using your library and I'm having cases in that I get an error using with_min_distance().
This is the error message:
Taking a quick look at the code, it looks like peaks variable could have no elements, therefore peaks[0] could be the reason?
Thanks in advance!
The text was updated successfully, but these errors were encountered: