Skip to main content

Dejitterer

Struct Dejitterer 

Source
pub struct Dejitterer {
    pub t0: u32,
    pub samples_since_t0: u32,
    pub w0: f64,
    pub w1: f64,
    pub p00: f64,
    pub p11: f64,
    pub p01: f64,
    pub lam: f64,
}
Expand description

The recursive least squares filter that removes jitter.

The filter fits t = w0 + w1 * n over the sample index n. SPEC.md 8.5.

Fields§

§t0: u32

The first timestamp, truncated to a whole number.

liblsl stores this in an unsigned integer (src/time_postprocessor.h:18). The truncation is part of the behavior, because the value comes back at the end of every call.

§samples_since_t0: u32

The number of samples since t0.

§w0: f64

The intercept of the fit.

§w1: f64

The slope of the fit.

§p00: f64

The inverse covariance element P00.

§p11: f64

The inverse covariance element P11.

§p01: f64

The off-diagonal inverse covariance element.

§lam: f64

The forgetting factor.

Implementations§

Source§

impl Dejitterer

Source

pub fn new(t0: f64, srate: f64, halftime: f64) -> Self

Build a filter for a stream.

src/time_postprocessor.cpp:104-110. A rate of zero or less leaves the forgetting factor at zero, and the filter then returns every timestamp unchanged.

Source

pub fn is_initialized(&self) -> bool

True once a first timestamp has set the baseline.

liblsl tests the baseline against zero (src/time_postprocessor.h:35). A first timestamp below 1.0 therefore truncates to zero, and the filter reads as uninitialized.

Source

pub fn smoothing_applicable(&self) -> bool

True when the filter changes a timestamp.

Source

pub fn dejitter(&mut self, t: f64) -> f64

Take one timestamp and return the fitted value.

The operation order matches src/time_postprocessor.cpp:112-131 line for line. Do not tidy this function.

Source

pub fn skip_samples(&mut self, skipped: u32)

Move the sample counter forward for samples that never arrived.

src/time_postprocessor.cpp:133-135.

Trait Implementations§

Source§

impl Clone for Dejitterer

Source§

fn clone(&self) -> Dejitterer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Dejitterer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Dejitterer

Source§

fn default() -> Self

The state before the first sample.

src/time_postprocessor.h:20-26 gives every initial value.

Source§

impl PartialEq for Dejitterer

Source§

fn eq(&self, other: &Dejitterer) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Dejitterer

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.