sample.sms.dsp module

Signal processing functions for SMS

sample.sms.dsp.dft(x: ndarray, w: ndarray, n: int, tol: float = 1e-14)

Discrete Fourier Transform with zero-phase windowing

Parameters:
  • x (array) – Input

  • w (array) – Window

  • n (int) – FFT size

  • tol (float) – Threshold below which all values are set to 0 for phase computation. Defaults to 1e-14

Returns:

Magnitude (in dB) and (unwrapped) phase spectra

Return type:

(array, array)

sample.sms.dsp.peak_detect(x: ndarray, t: Optional[float] = None) ndarray

Detect peaks (local maxima) in a signal

Parameters:
  • x (array) – Input signal

  • t (float) – Threshold (optional)

Returns:

The indices of the peaks in x

Return type:

array

sample.sms.dsp.peak_detect_interp(mx: ndarray, px: Optional[ndarray] = None, t: Optional[float] = None) Union[Tuple[ndarray, ndarray], Tuple[ndarray, ndarray, ndarray]]

Detect peaks (local maxima) in a signal, refining the value with parabolic interpolation

Parameters:
  • mx (array) – Magnitude spectrum in dB

  • px (array) – Phase spectrum

  • t (float) – Threshold (optional)

Returns:

Interpolated peak locations, magnitudes and phases

Return type:

(array, array, array)

sample.sms.dsp.peak_refine(ploc: ndarray, mx: ndarray, px: Optional[ndarray] = None) Union[Tuple[ndarray, ndarray], Tuple[ndarray, ndarray, ndarray]]

Refine detected peaks with parabolic approximation

Parameters:
  • ploc (array) – Peak locations

  • mx (array) – Magnitude spectrum in dB

  • px (array) – Phase spectrum

Returns:

Interpolated peak locations, magnitudes and phases

Return type:

(array, array, array)