Compute the one-dimensional discrete Fourier Transform. This function computes the one-dimensional *n*-point discrete Fourier Transform (DFT) with the efficient Fast Fourier Transform (FFT) algorithm [CT]. Parameters ---------- a : array_like Input array, can b
(a, n=None, axis=-1, norm=None)
| 121 | |
| 122 | @array_function_dispatch(_fft_dispatcher) |
| 123 | def fft(a, n=None, axis=-1, norm=None): |
| 124 | """ |
| 125 | Compute the one-dimensional discrete Fourier Transform. |
| 126 | |
| 127 | This function computes the one-dimensional *n*-point discrete Fourier |
| 128 | Transform (DFT) with the efficient Fast Fourier Transform (FFT) |
| 129 | algorithm [CT]. |
| 130 | |
| 131 | Parameters |
| 132 | ---------- |
| 133 | a : array_like |
| 134 | Input array, can be complex. |
| 135 | n : int, optional |
| 136 | Length of the transformed axis of the output. |
| 137 | If `n` is smaller than the length of the input, the input is cropped. |
| 138 | If it is larger, the input is padded with zeros. If `n` is not given, |
| 139 | the length of the input along the axis specified by `axis` is used. |
| 140 | axis : int, optional |
| 141 | Axis over which to compute the FFT. If not given, the last axis is |
| 142 | used. |
| 143 | norm : {"backward", "ortho", "forward"}, optional |
| 144 | .. versionadded:: 1.10.0 |
| 145 | |
| 146 | Normalization mode (see `numpy.fft`). Default is "backward". |
| 147 | Indicates which direction of the forward/backward pair of transforms |
| 148 | is scaled and with what normalization factor. |
| 149 | |
| 150 | .. versionadded:: 1.20.0 |
| 151 | |
| 152 | The "backward", "forward" values were added. |
| 153 | |
| 154 | Returns |
| 155 | ------- |
| 156 | out : complex ndarray |
| 157 | The truncated or zero-padded input, transformed along the axis |
| 158 | indicated by `axis`, or the last one if `axis` is not specified. |
| 159 | |
| 160 | Raises |
| 161 | ------ |
| 162 | IndexError |
| 163 | If `axis` is not a valid axis of `a`. |
| 164 | |
| 165 | See Also |
| 166 | -------- |
| 167 | numpy.fft : for definition of the DFT and conventions used. |
| 168 | ifft : The inverse of `fft`. |
| 169 | fft2 : The two-dimensional FFT. |
| 170 | fftn : The *n*-dimensional FFT. |
| 171 | rfftn : The *n*-dimensional FFT of real input. |
| 172 | fftfreq : Frequency bins for given FFT parameters. |
| 173 | |
| 174 | Notes |
| 175 | ----- |
| 176 | FFT (Fast Fourier Transform) refers to a way the discrete Fourier |
| 177 | Transform (DFT) can be calculated efficiently, by using symmetries in the |
| 178 | calculated terms. The symmetry is highest when `n` is a power of 2, and |
| 179 | the transform is therefore most efficient for these sizes. |
| 180 |