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

Function rfft

numpy/fft/_pocketfft.py:321–410  ·  view source on GitHub ↗

Compute the one-dimensional discrete Fourier Transform for real input. This function computes the one-dimensional *n*-point discrete Fourier Transform (DFT) of a real-valued array by means of an efficient algorithm called the Fast Fourier Transform (FFT). Parameters ------

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

Source from the content-addressed store, hash-verified

319
320@array_function_dispatch(_fft_dispatcher)
321def rfft(a, n=None, axis=-1, norm=None):
322 """
323 Compute the one-dimensional discrete Fourier Transform for real input.
324
325 This function computes the one-dimensional *n*-point discrete Fourier
326 Transform (DFT) of a real-valued array by means of an efficient algorithm
327 called the Fast Fourier Transform (FFT).
328
329 Parameters
330 ----------
331 a : array_like
332 Input array
333 n : int, optional
334 Number of points along transformation axis in the input to use.
335 If `n` is smaller than the length of the input, the input is cropped.
336 If it is larger, the input is padded with zeros. If `n` is not given,
337 the length of the input along the axis specified by `axis` is used.
338 axis : int, optional
339 Axis over which to compute the FFT. If not given, the last axis is
340 used.
341 norm : {"backward", "ortho", "forward"}, optional
342 .. versionadded:: 1.10.0
343
344 Normalization mode (see `numpy.fft`). Default is "backward".
345 Indicates which direction of the forward/backward pair of transforms
346 is scaled and with what normalization factor.
347
348 .. versionadded:: 1.20.0
349
350 The "backward", "forward" values were added.
351
352 Returns
353 -------
354 out : complex ndarray
355 The truncated or zero-padded input, transformed along the axis
356 indicated by `axis`, or the last one if `axis` is not specified.
357 If `n` is even, the length of the transformed axis is ``(n/2)+1``.
358 If `n` is odd, the length is ``(n+1)/2``.
359
360 Raises
361 ------
362 IndexError
363 If `axis` is not a valid axis of `a`.
364
365 See Also
366 --------
367 numpy.fft : For definition of the DFT and conventions used.
368 irfft : The inverse of `rfft`.
369 fft : The one-dimensional FFT of general (complex) input.
370 fftn : The *n*-dimensional FFT.
371 rfftn : The *n*-dimensional FFT of real input.
372
373 Notes
374 -----
375 When the DFT is computed for purely real input, the output is
376 Hermitian-symmetric, i.e. the negative frequency terms are just the complex
377 conjugates of the corresponding positive-frequency terms, and the
378 negative-frequency terms are therefore redundant. This function does not

Callers 2

ihfftFunction · 0.85
rfftnFunction · 0.85

Calls 3

asarrayFunction · 0.90
_get_forward_normFunction · 0.85
_raw_fftFunction · 0.85

Tested by

no test coverage detected