SciPy

numpy.fft.hfft

numpy.fft.hfft(a, n=None, axis=-1)[source]

Compute the FFT of a signal whose spectrum has Hermitian symmetry.

Parameters :

a : array_like

The input array.

n : int, optional

The length of the FFT.

axis : int, optional

The axis over which to compute the FFT, assuming Hermitian symmetry of the spectrum. Default is the last axis.

Returns :

out : ndarray

The transformed input.

See also

rfft
Compute the one-dimensional FFT for real input.
ihfft
The inverse of hfft.

Notes

hfft/ihfft are a pair analogous to rfft/irfft, but for the opposite case: here the signal is real in the frequency domain and has Hermite symmetry in the time domain. So here it’s hfft for which you must supply the length of the result if it is to be odd: ihfft(hfft(a), len(a)) == a, within numerical accuracy.

Examples

>>> signal = np.array([[1, 1.j], [-1.j, 2]])
>>> np.conj(signal.T) - signal   # check Hermitian symmetry
array([[ 0.-0.j,  0.+0.j],
       [ 0.+0.j,  0.-0.j]])
>>> freq_spectrum = np.fft.hfft(signal)
>>> freq_spectrum
array([[ 1.,  1.],
       [ 2., -2.]])

Previous topic

numpy.fft.irfftn

Next topic

numpy.fft.ihfft