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

Function hfft

numpy/fft/_pocketfft.py:518–612  ·  view source on GitHub ↗

Compute the FFT of a signal that has Hermitian symmetry, i.e., a real spectrum. Parameters ---------- a : array_like The input array. n : int, optional Length of the transformed axis of the output. For `n` output points, ``n//2 + 1`` input points are

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

Source from the content-addressed store, hash-verified

516
517@array_function_dispatch(_fft_dispatcher)
518def hfft(a, n=None, axis=-1, norm=None):
519 """
520 Compute the FFT of a signal that has Hermitian symmetry, i.e., a real
521 spectrum.
522
523 Parameters
524 ----------
525 a : array_like
526 The input array.
527 n : int, optional
528 Length of the transformed axis of the output. For `n` output
529 points, ``n//2 + 1`` input points are necessary. If the input is
530 longer than this, it is cropped. If it is shorter than this, it is
531 padded with zeros. If `n` is not given, it is taken to be ``2*(m-1)``
532 where ``m`` is the length of the input along the axis specified by
533 `axis`.
534 axis : int, optional
535 Axis over which to compute the FFT. If not given, the last
536 axis is used.
537 norm : {"backward", "ortho", "forward"}, optional
538 .. versionadded:: 1.10.0
539
540 Normalization mode (see `numpy.fft`). Default is "backward".
541 Indicates which direction of the forward/backward pair of transforms
542 is scaled and with what normalization factor.
543
544 .. versionadded:: 1.20.0
545
546 The "backward", "forward" values were added.
547
548 Returns
549 -------
550 out : ndarray
551 The truncated or zero-padded input, transformed along the axis
552 indicated by `axis`, or the last one if `axis` is not specified.
553 The length of the transformed axis is `n`, or, if `n` is not given,
554 ``2*m - 2`` where ``m`` is the length of the transformed axis of
555 the input. To get an odd number of output points, `n` must be
556 specified, for instance as ``2*m - 1`` in the typical case,
557
558 Raises
559 ------
560 IndexError
561 If `axis` is not a valid axis of `a`.
562
563 See also
564 --------
565 rfft : Compute the one-dimensional FFT for real input.
566 ihfft : The inverse of `hfft`.
567
568 Notes
569 -----
570 `hfft`/`ihfft` are a pair analogous to `rfft`/`irfft`, but for the
571 opposite case: here the signal has Hermitian symmetry in the time
572 domain and is real in the frequency domain. So here it's `hfft` for
573 which you must supply the length of the result if it is to be odd.
574
575 * even: ``ihfft(hfft(a, 2*len(a) - 2)) == a``, within roundoff error,

Callers

nothing calls this directly

Calls 3

asarrayFunction · 0.90
_swap_directionFunction · 0.85
irfftFunction · 0.85

Tested by

no test coverage detected