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