Skip to main content

Crate numra_signal

Crate numra_signal 

Source
Expand description

§Numra Signal Processing

Digital signal processing tools for Numra: IIR/FIR filter design and application, resampling, Hilbert transform, and peak detection.

§Modules

  • filter_design — Butterworth and Chebyshev Type I IIR filter design
  • filter_apply — SOS filter application (sosfilt, filtfilt)
  • fir — FIR filter design via windowed sinc
  • resample — FFT-based signal resampling
  • hilbert — Hilbert transform, envelope, instantaneous frequency
  • peak — Peak detection with height/distance/prominence constraints

§Example

use numra_signal::{butter, filtfilt, find_peaks, PeakOptions};

// Design a 4th-order Butterworth lowpass at 10 Hz, sampled at 100 Hz
let sos = butter(4, 10.0, 100.0).unwrap();

// Generate a noisy signal
let pi2 = 2.0 * std::f64::consts::PI;
let x: Vec<f64> = (0..200).map(|i| {
    let t = i as f64 / 100.0;
    (pi2 * 3.0 * t).sin() + 0.3 * (pi2 * 40.0 * t).sin()
}).collect();

// Filter the signal (zero-phase)
let y = filtfilt(&sos, &x);

// Find peaks in the filtered signal
let peaks = find_peaks(&y, &PeakOptions::default().height(0.5));
assert!(!peaks.is_empty());

Author: Moussa Leblouba Date: 9 February 2026 Modified: 2 May 2026

Re-exports§

pub use error::SignalError;
pub use filter_apply::filtfilt;
pub use filter_apply::sosfilt;
pub use filter_apply::SosFilter;
pub use filter_design::butter;
pub use filter_design::cheby1;
pub use fir::fir_filter;
pub use fir::firwin;
pub use hilbert::envelope;
pub use hilbert::hilbert;
pub use hilbert::instantaneous_frequency;
pub use peak::find_peaks;
pub use peak::PeakOptions;
pub use resample::resample;

Modules§

error
Error types for signal processing.
filter_apply
Apply digital filters via second-order sections.
filter_design
IIR filter design: Butterworth and Chebyshev Type I.
fir
FIR filter design via windowed sinc method.
hilbert
Hilbert transform, analytic signal, and envelope extraction.
peak
Peak detection in signals.
resample
Signal resampling via FFT-based interpolation.