Struct hampel::Window

source ·
pub struct Window<T: FloatCore, const WINDOW_SIZE: usize> { /* private fields */ }
Expand description

Window of Hampel filter

  • WINDOW_SIZE >= 3

Implementations§

source§

impl<T: FloatCore, const WINDOW_SIZE: usize> Window<T, WINDOW_SIZE>

source

pub fn new(init_val: T, n_sigma: T) -> Self

  • init_val: Initialization value of window.
  • n_sigma: Threshold for determining an outlier.

If the window’s input value exceeds the window's standard deviation * n_sigma, it is determined to be an outlier. The larger n_sigma is, the harder it is to detect outliers.

source

pub fn update(&mut self, x: T) -> T

Update element in window.

When x is determined to be an outlier, the median value of the window is usually returned. If the extrapolation feature is enabled, the linear extrapolated value is returned.

When x is judged not to be an outlier, x is returned as is.

Auto Trait Implementations§

§

impl<T, const WINDOW_SIZE: usize> Freeze for Window<T, WINDOW_SIZE>
where T: Freeze,

§

impl<T, const WINDOW_SIZE: usize> RefUnwindSafe for Window<T, WINDOW_SIZE>
where T: RefUnwindSafe,

§

impl<T, const WINDOW_SIZE: usize> Send for Window<T, WINDOW_SIZE>
where T: Send,

§

impl<T, const WINDOW_SIZE: usize> Sync for Window<T, WINDOW_SIZE>
where T: Sync,

§

impl<T, const WINDOW_SIZE: usize> Unpin for Window<T, WINDOW_SIZE>
where T: Unpin,

§

impl<T, const WINDOW_SIZE: usize> UnwindSafe for Window<T, WINDOW_SIZE>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.