[][src]Struct find_peaks::PeakFinder

pub struct PeakFinder<'a, T, S> where
    [S]: ToOwned
{ /* fields omitted */ }

Setup for the peak filtering.

Change the settings by using the methods for specifing the lower and upper bounds.

Implementations

impl<'a, T> PeakFinder<'a, T, usize> where
    T: Clone + Sub<Output = T> + PartialOrd
[src]

pub fn new(y_data: &'a [T]) -> Self[src]

Initialize with a data slice.

impl<'a, T, S> PeakFinder<'a, T, S> where
    T: Clone + Sub<Output = T> + PartialOrd,
    S: Clone + Sub<Output = S> + PartialOrd,
    [S]: ToOwned
[src]

pub fn new_with_x(y_data: &'a [T], x_data: &'a [S]) -> Self[src]

pub fn find_peaks(&self) -> Vec<Peak<T>>[src]

Outputs a vector of Peak<_> structures containing peaks that matched the criteria specified in PeakFinder<_>.

Output will not contain some properties (for example, height, prominence) unless you specified at least on of the corresponding bounds in PeakFinder<_> -- the calculation of the property is skipped.

Peaks are sorted by their height.

Examples

use find_peaks::PeakFinder;
let y = [1., 2., 3., 0., 5., 0.];

let ps = PeakFinder::new(&y)
           .with_min_height(0.)
           .with_min_prominence(1.)
           .find_peaks();

assert_eq!(
   ps.iter().map(|x| x.middle_position()).collect::<Vec<_>>(),
   vec![4, 2]
);

pub fn with_min_height(&mut self, h: T) -> &mut Self[src]

pub fn with_max_height(&mut self, h: T) -> &mut Self[src]

pub fn with_min_prominence(&mut self, prominence: T) -> &mut Self[src]

pub fn with_max_prominence(&mut self, prominence: T) -> &mut Self[src]

pub fn with_min_difference(&mut self, difference: T) -> &mut Self[src]

pub fn with_max_difference(&mut self, difference: T) -> &mut Self[src]

pub fn with_min_plateau_size(&mut self, size: usize) -> &mut Self[src]

pub fn with_max_plateau_size(&mut self, size: usize) -> &mut Self[src]

pub fn with_min_distance(&mut self, distance: S) -> &mut Self[src]

pub fn with_max_distance(&mut self, distance: S) -> &mut Self[src]

Trait Implementations

impl<'a, T: Clone, S: Clone> Clone for PeakFinder<'a, T, S> where
    [S]: ToOwned
[src]

Auto Trait Implementations

impl<'a, T, S> !RefUnwindSafe for PeakFinder<'a, T, S>

impl<'a, T, S> !Send for PeakFinder<'a, T, S>

impl<'a, T, S> !Sync for PeakFinder<'a, T, S>

impl<'a, T, S> !Unpin for PeakFinder<'a, T, S>

impl<'a, T, S> !UnwindSafe for PeakFinder<'a, T, S>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.