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: u32The 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: u32The number of samples since t0.
w0: f64The intercept of the fit.
w1: f64The slope of the fit.
p00: f64The inverse covariance element P00.
p11: f64The inverse covariance element P11.
p01: f64The off-diagonal inverse covariance element.
lam: f64The forgetting factor.
Implementations§
Source§impl Dejitterer
impl Dejitterer
Sourcepub fn new(t0: f64, srate: f64, halftime: f64) -> Self
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.
Sourcepub fn is_initialized(&self) -> bool
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.
Sourcepub fn smoothing_applicable(&self) -> bool
pub fn smoothing_applicable(&self) -> bool
True when the filter changes a timestamp.
Sourcepub fn dejitter(&mut self, t: f64) -> f64
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.
Sourcepub fn skip_samples(&mut self, skipped: u32)
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
impl Clone for Dejitterer
Source§fn clone(&self) -> Dejitterer
fn clone(&self) -> Dejitterer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more