pub fn magphase(
d: &Array2<Complex<f32>>,
power: Option<f32>,
) -> (Array2<f32>, Array2<Complex<f32>>)Expand description
Separates magnitude and phase from a complex spectrogram.
§Arguments
D- Input spectrogram as anArray2<Complex<f32>>power- Optional power to raise the magnitude (defaults to 1.0)
§Returns
Returns a tuple (magnitude, phase) where:
magnitudeis anArray2<f32>of magnitude valuesphaseis anArray2<Complex<f32>>of unit-magnitude phase values
§Examples
use ndarray::arr2;
let spectrogram = arr2(&[[Complex::new(3.0, 4.0)]]);
let (mag, phase) = magphase(&spectrogram, None);
assert_eq!(mag[[0, 0]], 5.0); // sqrt(3^2 + 4^2)