summaryrefslogtreecommitdiff
path: root/numpy/fft
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/fft')
-rw-r--r--numpy/fft/__init__.py3
-rw-r--r--numpy/fft/__init__.pyi20
-rw-r--r--numpy/fft/_pocketfft.c6
-rw-r--r--numpy/fft/_pocketfft.py10
-rw-r--r--numpy/fft/helper.py3
-rw-r--r--numpy/fft/setup.py1
-rw-r--r--numpy/fft/tests/test_helper.py5
7 files changed, 34 insertions, 14 deletions
diff --git a/numpy/fft/__init__.py b/numpy/fft/__init__.py
index af0859def..a86bb3ac0 100644
--- a/numpy/fft/__init__.py
+++ b/numpy/fft/__init__.py
@@ -4,6 +4,9 @@ Discrete Fourier Transform (:mod:`numpy.fft`)
.. currentmodule:: numpy.fft
+The SciPy module `scipy.fft` is a more comprehensive superset
+of ``numpy.fft``, which includes only a basic set of routines.
+
Standard FFTs
-------------
diff --git a/numpy/fft/__init__.pyi b/numpy/fft/__init__.pyi
new file mode 100644
index 000000000..45190517f
--- /dev/null
+++ b/numpy/fft/__init__.pyi
@@ -0,0 +1,20 @@
+from typing import Any
+
+fft: Any
+ifft: Any
+rfft: Any
+irfft: Any
+hfft: Any
+ihfft: Any
+rfftn: Any
+irfftn: Any
+rfft2: Any
+irfft2: Any
+fft2: Any
+ifft2: Any
+fftn: Any
+ifftn: Any
+fftshift: Any
+ifftshift: Any
+fftfreq: Any
+rfftfreq: Any
diff --git a/numpy/fft/_pocketfft.c b/numpy/fft/_pocketfft.c
index 764116a84..ba9995f97 100644
--- a/numpy/fft/_pocketfft.c
+++ b/numpy/fft/_pocketfft.c
@@ -2206,7 +2206,6 @@ execute_complex(PyObject *a1, int is_forward, double fct)
double *dptr = (double *)PyArray_DATA(data);
int fail=0;
Py_BEGIN_ALLOW_THREADS;
- NPY_SIGINT_ON;
plan = make_cfft_plan(npts);
if (!plan) fail=1;
if (!fail)
@@ -2217,7 +2216,6 @@ execute_complex(PyObject *a1, int is_forward, double fct)
dptr += npts*2;
}
if (plan) destroy_cfft_plan(plan);
- NPY_SIGINT_OFF;
Py_END_ALLOW_THREADS;
if (fail) {
Py_XDECREF(data);
@@ -2258,7 +2256,6 @@ execute_real_forward(PyObject *a1, double fct)
*dptr = (double *)PyArray_DATA(data);
Py_BEGIN_ALLOW_THREADS;
- NPY_SIGINT_ON;
plan = make_rfft_plan(npts);
if (!plan) fail=1;
if (!fail)
@@ -2272,7 +2269,6 @@ execute_real_forward(PyObject *a1, double fct)
dptr += npts;
}
if (plan) destroy_rfft_plan(plan);
- NPY_SIGINT_OFF;
Py_END_ALLOW_THREADS;
}
if (fail) {
@@ -2303,7 +2299,6 @@ execute_real_backward(PyObject *a1, double fct)
*dptr = (double *)PyArray_DATA(data);
Py_BEGIN_ALLOW_THREADS;
- NPY_SIGINT_ON;
plan = make_rfft_plan(npts);
if (!plan) fail=1;
if (!fail) {
@@ -2316,7 +2311,6 @@ execute_real_backward(PyObject *a1, double fct)
}
}
if (plan) destroy_rfft_plan(plan);
- NPY_SIGINT_OFF;
Py_END_ALLOW_THREADS;
}
if (fail) {
diff --git a/numpy/fft/_pocketfft.py b/numpy/fft/_pocketfft.py
index 38ea69834..83ac86036 100644
--- a/numpy/fft/_pocketfft.py
+++ b/numpy/fft/_pocketfft.py
@@ -411,7 +411,7 @@ def rfft(a, n=None, axis=-1, norm=None):
@array_function_dispatch(_fft_dispatcher)
def irfft(a, n=None, axis=-1, norm=None):
"""
- Compute the inverse of the n-point DFT for real input.
+ Computes the inverse of `rfft`.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier Transform of real input computed by `rfft`.
@@ -1249,7 +1249,7 @@ def rfft2(a, s=None, axes=(-2, -1), norm=None):
@array_function_dispatch(_fftn_dispatcher)
def irfftn(a, s=None, axes=None, norm=None):
"""
- Compute the inverse of the N-dimensional FFT of real input.
+ Computes the inverse of `rfftn`.
This function computes the inverse of the N-dimensional discrete
Fourier Transform for real input over any number of axes in an
@@ -1359,7 +1359,7 @@ def irfftn(a, s=None, axes=None, norm=None):
@array_function_dispatch(_fftn_dispatcher)
def irfft2(a, s=None, axes=(-2, -1), norm=None):
"""
- Compute the 2-dimensional inverse FFT of a real array.
+ Computes the inverse of `rfft2`.
Parameters
----------
@@ -1388,6 +1388,10 @@ def irfft2(a, s=None, axes=(-2, -1), norm=None):
See Also
--------
+ rfft2 : The forward two-dimensional FFT of real input,
+ of which `irfft2` is the inverse.
+ rfft : The one-dimensional FFT for real input.
+ irfft : The inverse of the one-dimensional FFT of real input.
irfftn : Compute the inverse of the N-dimensional FFT of real input.
Notes
diff --git a/numpy/fft/helper.py b/numpy/fft/helper.py
index 3dacd9ee1..927ee1af1 100644
--- a/numpy/fft/helper.py
+++ b/numpy/fft/helper.py
@@ -2,7 +2,6 @@
Discrete Fourier Transforms - helper.py
"""
-from numpy.compat import integer_types
from numpy.core import integer, empty, arange, asarray, roll
from numpy.core.overrides import array_function_dispatch, set_module
@@ -10,7 +9,7 @@ from numpy.core.overrides import array_function_dispatch, set_module
__all__ = ['fftshift', 'ifftshift', 'fftfreq', 'rfftfreq']
-integer_types = integer_types + (integer,)
+integer_types = (int, integer)
def _fftshift_dispatcher(x, axes=None):
diff --git a/numpy/fft/setup.py b/numpy/fft/setup.py
index 9ed824e4f..477948a09 100644
--- a/numpy/fft/setup.py
+++ b/numpy/fft/setup.py
@@ -14,6 +14,7 @@ def configuration(parent_package='',top_path=None):
define_macros=defs,
)
+ config.add_data_files('*.pyi')
return config
if __name__ == '__main__':
diff --git a/numpy/fft/tests/test_helper.py b/numpy/fft/tests/test_helper.py
index 68f5990af..3fb700bb3 100644
--- a/numpy/fft/tests/test_helper.py
+++ b/numpy/fft/tests/test_helper.py
@@ -85,7 +85,6 @@ class TestFFTShift:
def test_equal_to_original(self):
""" Test that the new (>=v1.15) implementation (see #10073) is equal to the original (<=v1.14) """
- from numpy.compat import integer_types
from numpy.core import asarray, concatenate, arange, take
def original_fftshift(x, axes=None):
@@ -94,7 +93,7 @@ class TestFFTShift:
ndim = tmp.ndim
if axes is None:
axes = list(range(ndim))
- elif isinstance(axes, integer_types):
+ elif isinstance(axes, int):
axes = (axes,)
y = tmp
for k in axes:
@@ -110,7 +109,7 @@ class TestFFTShift:
ndim = tmp.ndim
if axes is None:
axes = list(range(ndim))
- elif isinstance(axes, integer_types):
+ elif isinstance(axes, int):
axes = (axes,)
y = tmp
for k in axes: