FerroWave · examples
Streaming denoise
Denoise a live tick stream with the streaming MODWT denoiser.
StreamingDenoiser emits one denoised sample per update(tick) from a bounded
ring of MODWT coefficients — measured at 42 ns p50 on a single core for Db4 at
4 levels, with zero steady-state allocation.
When to use it
- You are on a live feed and cannot afford to re-batch a window on every update.
- You want a denoised value emitted per tick for a strategy or online-inference loop, at nanosecond latency.
- You need bounded, predictable memory — state lives in a ring buffer, not a growing history.
Example
use ferro_wave::{Daubechies, DaubechiesType, BoundaryMode};
use ferro_wave::streaming::denoising::{StreamingDenoiser,
StreamingDenoiseConfig, ThresholdMethod, ThresholdRule};
let wavelet = Daubechies::new(DaubechiesType::Db4);
let config: StreamingDenoiseConfig<f64> = StreamingDenoiseConfig {
levels: 4,
method: ThresholdMethod::Soft,
rule: ThresholdRule::Universal,
boundary: BoundaryMode::Periodic,
..StreamingDenoiseConfig::default()
};
let mut denoiser = StreamingDenoiser::new(&wavelet, config)?;
for &tick in &live_feed {
let out = denoiser.update(tick)?;
on_clean(out.clean); // emit to strategy
}
# Ok::<(), ferro_wave::WaveletError>(())Notes
- Per-tick cost is
O(filter_length × levels); steady-state allocation is zero after warm-up. - The configuration mirrors batch denoise — same methods, rules, and boundary modes — so the streaming path tracks the batch result.
Use the sanitized streaming API for the current denoising contract and update-trigger configuration.