cupyx.scipy.signal.minimum_phase#

cupyx.scipy.signal.minimum_phase(h, method='homomorphic', n_fft=None, half=True)[source]#

Convert a linear-phase FIR filter to minimum phase

Parameters:
  • h (array) – Linear-phase FIR filter coefficients.

  • method ({'hilbert', 'homomorphic'}) –

    The method to use:

    ’homomorphic’ (default)

    This method [4] [5] works best with filters with an odd number of taps, and the resulting minimum phase filter will have a magnitude response that approximates the square root of the original filter’s magnitude response.

    ’hilbert’

    This method [1] is designed to be used with equiripple filters (e.g., from remez) with unity or zero gain regions.

  • n_fft (int) – The number of points to use for the FFT. Should be at least a few times larger than the signal length (see Notes).

  • half (bool) – If True, create a filter that is half the length of the original, with a magnitude spectrum that is the square root of the original. If False, create a filter that is the same length as the original, with a magnitude spectrum that is designed to match the original (only supported when method='homomorphic').

Returns:

h_minimum – The minimum-phase version of the filter, with length (length(h) + 1) // 2.

Return type:

array

Notes

Both the Hilbert [1] or homomorphic [4] [5] methods require selection of an FFT length to estimate the complex cepstrum of the filter.

In the case of the Hilbert method, the deviation from the ideal spectrum epsilon is related to the number of stopband zeros n_stop and FFT length n_fft as:

epsilon = 2. * n_stop / n_fft

For example, with 100 stopband zeros and a FFT length of 2048, epsilon = 0.0976. If we conservatively assume that the number of stopband zeros is one less than the filter length, we can take the FFT length to be the next power of 2 that satisfies epsilon=0.01 as:

n_fft = 2 ** int(np.ceil(np.log2(2 * (len(h) - 1) / 0.01)))

This gives reasonable results for both the Hilbert and homomorphic methods, and gives the value used when n_fft=None.

Alternative implementations exist for creating minimum-phase filters, including zero inversion [2] and spectral factorization [3] [4] [5]. For more information, see:

References