apply_window

Function apply_window 

Source
pub fn apply_window<F, S>(
    x: &ArrayBase<S, Ix1>,
    window: Window,
) -> FFTResult<Array1<F>>
where S: Data<Elem = F>, F: Float + FromPrimitive + Debug,
Expand description

Apply window function to a signal

§Arguments

  • x - Input signal
  • window - Window function to apply

§Returns

The windowed signal.

§Examples

use scirs2_fft::window::{Window, apply_window};
use scirs2_core::ndarray::Array1;

let signal = Array1::from_vec(vec![1.0, 2.0, 3.0, 4.0, 5.0]);
let window = Window::Hann;
let windowed = apply_window(&signal, window).unwrap();

§Errors

Returns an error if the window calculation fails or if the value cannot be converted to the target floating point type.

§Panics

Panics if the conversion from f64 to type F fails.