Compute the 2-dimensional discrete Fourier Transform. This function computes the *n*-dimensional discrete Fourier Transform over any axes in an *M*-dimensional array by means of the Fast Fourier Transform (FFT). By default, the transform is computed over the last two axes of t
(a, s=None, axes=(-2, -1), norm=None)
| 920 | |
| 921 | @array_function_dispatch(_fftn_dispatcher) |
| 922 | def fft2(a, s=None, axes=(-2, -1), norm=None): |
| 923 | """ |
| 924 | Compute the 2-dimensional discrete Fourier Transform. |
| 925 | |
| 926 | This function computes the *n*-dimensional discrete Fourier Transform |
| 927 | over any axes in an *M*-dimensional array by means of the |
| 928 | Fast Fourier Transform (FFT). By default, the transform is computed over |
| 929 | the last two axes of the input array, i.e., a 2-dimensional FFT. |
| 930 | |
| 931 | Parameters |
| 932 | ---------- |
| 933 | a : array_like |
| 934 | Input array, can be complex |
| 935 | s : sequence of ints, optional |
| 936 | Shape (length of each transformed axis) of the output |
| 937 | (``s[0]`` refers to axis 0, ``s[1]`` to axis 1, etc.). |
| 938 | This corresponds to ``n`` for ``fft(x, n)``. |
| 939 | Along each axis, if the given shape is smaller than that of the input, |
| 940 | the input is cropped. If it is larger, the input is padded with zeros. |
| 941 | if `s` is not given, the shape of the input along the axes specified |
| 942 | by `axes` is used. |
| 943 | axes : sequence of ints, optional |
| 944 | Axes over which to compute the FFT. If not given, the last two |
| 945 | axes are used. A repeated index in `axes` means the transform over |
| 946 | that axis is performed multiple times. A one-element sequence means |
| 947 | that a one-dimensional FFT is performed. |
| 948 | norm : {"backward", "ortho", "forward"}, optional |
| 949 | .. versionadded:: 1.10.0 |
| 950 | |
| 951 | Normalization mode (see `numpy.fft`). Default is "backward". |
| 952 | Indicates which direction of the forward/backward pair of transforms |
| 953 | is scaled and with what normalization factor. |
| 954 | |
| 955 | .. versionadded:: 1.20.0 |
| 956 | |
| 957 | The "backward", "forward" values were added. |
| 958 | |
| 959 | Returns |
| 960 | ------- |
| 961 | out : complex ndarray |
| 962 | The truncated or zero-padded input, transformed along the axes |
| 963 | indicated by `axes`, or the last two axes if `axes` is not given. |
| 964 | |
| 965 | Raises |
| 966 | ------ |
| 967 | ValueError |
| 968 | If `s` and `axes` have different length, or `axes` not given and |
| 969 | ``len(s) != 2``. |
| 970 | IndexError |
| 971 | If an element of `axes` is larger than than the number of axes of `a`. |
| 972 | |
| 973 | See Also |
| 974 | -------- |
| 975 | numpy.fft : Overall view of discrete Fourier transforms, with definitions |
| 976 | and conventions used. |
| 977 | ifft2 : The inverse two-dimensional FFT. |
| 978 | fft : The one-dimensional FFT. |
| 979 | fftn : The *n*-dimensional FFT. |
nothing calls this directly
no test coverage detected