Giter Club home page Giter Club logo

find_peaks-rs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

find_peaks-rs's Issues

Question about how win_min_distance

Hi,

I'm using your library for technical analysis of the stock market and I use it for detection of local maxima/minima. Everything looks fine but I've detected several cases using with_min_distance in that the peaks returned are not the highest ones. In the image bellow you will see stock candles (white and blue) on a chart and the small blue triangles are the peaks returned by your library using win_min_distanance of 5.

image

As you can see the 3 biggest candles on the area were not marked as peaks/local maxima. Is this a bug?

Thanks.

Index out of bounds using with_min_distance

Hi,

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.