MCPcopy Create free account
hub / github.com/numpy/numpy / ihfft

Function ihfft

numpy/fft/_pocketfft.py:616–679  ·  view source on GitHub ↗

Compute the inverse FFT of a signal that has Hermitian symmetry. Parameters ---------- a : array_like Input array. n : int, optional Length of the inverse FFT, the number of points along transformation axis in the input to use. If `n` is smaller than

(a, n=None, axis=-1, norm=None)

Source from the content-addressed store, hash-verified

614
615@array_function_dispatch(_fft_dispatcher)
616def ihfft(a, n=None, axis=-1, norm=None):
617 """
618 Compute the inverse FFT of a signal that has Hermitian symmetry.
619
620 Parameters
621 ----------
622 a : array_like
623 Input array.
624 n : int, optional
625 Length of the inverse FFT, the number of points along
626 transformation axis in the input to use. If `n` is smaller than
627 the length of the input, the input is cropped. If it is larger,
628 the input is padded with zeros. If `n` is not given, the length of
629 the input along the axis specified by `axis` is used.
630 axis : int, optional
631 Axis over which to compute the inverse FFT. If not given, the last
632 axis is used.
633 norm : {"backward", "ortho", "forward"}, optional
634 .. versionadded:: 1.10.0
635
636 Normalization mode (see `numpy.fft`). Default is "backward".
637 Indicates which direction of the forward/backward pair of transforms
638 is scaled and with what normalization factor.
639
640 .. versionadded:: 1.20.0
641
642 The "backward", "forward" values were added.
643
644 Returns
645 -------
646 out : complex ndarray
647 The truncated or zero-padded input, transformed along the axis
648 indicated by `axis`, or the last one if `axis` is not specified.
649 The length of the transformed axis is ``n//2 + 1``.
650
651 See also
652 --------
653 hfft, irfft
654
655 Notes
656 -----
657 `hfft`/`ihfft` are a pair analogous to `rfft`/`irfft`, but for the
658 opposite case: here the signal has Hermitian symmetry in the time
659 domain and is real in the frequency domain. So here it's `hfft` for
660 which you must supply the length of the result if it is to be odd:
661
662 * even: ``ihfft(hfft(a, 2*len(a) - 2)) == a``, within roundoff error,
663 * odd: ``ihfft(hfft(a, 2*len(a) - 1)) == a``, within roundoff error.
664
665 Examples
666 --------
667 >>> spectrum = np.array([ 15, -4, 0, -1, 0, -4])
668 >>> np.fft.ifft(spectrum)
669 array([1.+0.j, 2.+0.j, 3.+0.j, 4.+0.j, 3.+0.j, 2.+0.j]) # may vary
670 >>> np.fft.ihfft(spectrum)
671 array([ 1.-0.j, 2.-0.j, 3.-0.j, 4.-0.j]) # may vary
672
673 """

Callers

nothing calls this directly

Calls 3

asarrayFunction · 0.90
_swap_directionFunction · 0.85
rfftFunction · 0.85

Tested by

no test coverage detected