packages

signal::spectral

Spectral estimation: periodograms averaged over segments (Welch), the short-time Fourier transform and its inverse, spectrograms, and the analytic signal. Defaults follow SciPy's scipy.signal.

Modules

  • analytic The analytic signal by the FFT (Marple 1999, "Computing the discrete-time analytic signal via FFT"): keep DC and Nyquist, double the positive frequencies, drop the negative ones.
  • frames The short-time Fourier transform, its inverse by weighted overlap-add (Griffin and Lim 1984), and the spectrogram, with SciPy's framing.
  • psd Power spectral density by averaged modified periodograms (Welch 1967): windowed, detrended, overlapping segments, each a real FFT, their squared magnitudes averaged.

Re-exports

analytic::{hilbert, envelope}Source

pub use analytic::{hilbert, envelope}
  • hilbert The analytic signal x + i H(x) of a real x (H the Hilbert transform), zero-padded or cut to n samples when given.
  • envelope The amplitude envelope |hilbert(x)|.

frames::{stft, istft, spectrogram, Stft, Spectrogram}Source

pub use frames::{stft, istft, spectrogram, Stft, Spectrogram}
  • stft The STFT of x (as SciPy's stft): nperseg / 2 zeros added at each end and zeros at the end to fill the last segment, so every sample is covered; segments of nperseg (256) overlapping by noverlap (half), windowed by a periodic Hann window, each a real FFT of nfft points scaled by 1 / sum(window).
  • istft The signal back from its STFT (as SciPy's istft): each column is inverse-transformed, windowed and overlap-added, divided by the summed squared window, and the nperseg / 2 boundary samples are dropped.
  • spectrogram The spectrogram of x (as SciPy's spectrogram): power spectral density of each segment, by default nperseg 256 samples of a Tukey(0.25) window overlapping by an eighth, each detrended.
  • Stft An STFT: z[k, m] is frequency f[k] in the segment centred at time t[m].
  • Spectrogram A spectrogram: s[k, m] is the power at f[k] in the segment centred at t[m].

psd::{welch, periodogram, Spectrum, Scaling}Source

pub use psd::{welch, periodogram, Spectrum, Scaling}
  • welch Welch's power spectral density estimate of x sampled at fs: segments of nperseg samples (256 by default, at most the signal length), overlapping by noverlap (half by default), each detrended (Detrend::Constant by default, none for no detrending), windowed (periodic Hann by default) and zero-padded to nfft.
  • periodogram The periodogram of x: one segment, the whole signal, no window by default.
  • Spectrum A one-sided spectrum: p[k] is the power at frequency f[k].
  • Scaling What the estimate is scaled to.