detrend 0.1.1

Signal detrending
Documentation
  • Coverage
  • 87.5%
    7 out of 8 items documented0 out of 3 items with examples
  • Size
  • Source code size: 34.24 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.98 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 18s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Documentation
  • awxkee/detrend
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • awxkee

🦀 detrend: Signal Detrending for Rust

A lightweight and efficient Rust crate for removing underlying trends and baseline drift from signals (time series data). This is essential in signal processing and data analysis to isolate meaningful fluctuations from long-term bias.


💡 Example

use detrend::{detrend_f64, DetrendingMethod, DetrendError};

fn main() -> Result<(), DetrendError> {
    // A signal with a clear upward trend: y = 0.5 * x + 1.0
    let signal = vec![1.0, 1.5, 2.0, 2.5, 3.0];

    // Remove the linear trend using Least Squares
    let detrended_ls = detrend_f64(&signal, DetrendingMethod::LeastSquares)?;

    Ok(())
}

🧩 Functions

The crate provides type-specific functions for precision and performance:

  • detrend_f32(signal: &[f32], method: DetrendingMethod)
  • detrend_f64(signal: &[f64], method: DetrendingMethod)

Both functions return a Result<Vec<T>, DetrendError>, primarily for handling potential DetrendError::AllocationError in low-memory environments.


This project is licensed under either of

  • BSD-3-Clause License (see LICENSE)
  • Apache License, Version 2.0 (see LICENSE)

at your option.