summaryrefslogtreecommitdiff
path: root/numpy/fft
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/fft')
-rw-r--r--numpy/fft/fftpack.py18
-rw-r--r--numpy/fft/helper.py12
-rw-r--r--numpy/fft/setup.py2
-rw-r--r--numpy/fft/tests/test_helper.py2
4 files changed, 17 insertions, 17 deletions
diff --git a/numpy/fft/fftpack.py b/numpy/fft/fftpack.py
index 2ca6cc668..1fb7bafc4 100644
--- a/numpy/fft/fftpack.py
+++ b/numpy/fft/fftpack.py
@@ -32,7 +32,7 @@ version of the FFTPACK routines.
"""
from __future__ import division, absolute_import, print_function
-__all__ = ['fft','ifft', 'rfft', 'irfft', 'hfft', 'ihfft', 'rfftn',
+__all__ = ['fft', 'ifft', 'rfft', 'irfft', 'hfft', 'ihfft', 'rfftn',
'irfftn', 'rfft2', 'irfft2', 'fft2', 'ifft2', 'fftn', 'ifftn']
from numpy.core import asarray, zeros, swapaxes, shape, conjugate, \
@@ -62,11 +62,11 @@ def _raw_fft(a, n=None, axis=-1, init_function=fftpack.cffti,
s = list(a.shape)
if s[axis] > n:
index = [slice(None)]*len(s)
- index[axis] = slice(0,n)
+ index[axis] = slice(0, n)
a = a[index]
else:
index = [slice(None)]*len(s)
- index[axis] = slice(0,s[axis])
+ index[axis] = slice(0, s[axis])
s[axis] = n
z = zeros(s, a.dtype.char)
z[index] = a
@@ -619,7 +619,7 @@ def fftn(a, s=None, axes=None):
"""
- return _raw_fftnd(a,s,axes,fft)
+ return _raw_fftnd(a, s, axes, fft)
def ifftn(a, s=None, axes=None):
"""
@@ -714,7 +714,7 @@ def ifftn(a, s=None, axes=None):
return _raw_fftnd(a, s, axes, ifft)
-def fft2(a, s=None, axes=(-2,-1)):
+def fft2(a, s=None, axes=(-2, -1)):
"""
Compute the 2-dimensional discrete Fourier Transform
@@ -792,10 +792,10 @@ def fft2(a, s=None, axes=(-2,-1)):
"""
- return _raw_fftnd(a,s,axes,fft)
+ return _raw_fftnd(a, s, axes, fft)
-def ifft2(a, s=None, axes=(-2,-1)):
+def ifft2(a, s=None, axes=(-2, -1)):
"""
Compute the 2-dimensional inverse discrete Fourier Transform.
@@ -965,7 +965,7 @@ def rfftn(a, s=None, axes=None):
a = fft(a, s[ii], axes[ii])
return a
-def rfft2(a, s=None, axes=(-2,-1)):
+def rfft2(a, s=None, axes=(-2, -1)):
"""
Compute the 2-dimensional FFT of a real array.
@@ -1086,7 +1086,7 @@ def irfftn(a, s=None, axes=None):
a = irfft(a, s[-1], axes[-1])
return a
-def irfft2(a, s=None, axes=(-2,-1)):
+def irfft2(a, s=None, axes=(-2, -1)):
"""
Compute the 2-dimensional inverse FFT of a real array.
diff --git a/numpy/fft/helper.py b/numpy/fft/helper.py
index 058f6864d..2e35f6db6 100644
--- a/numpy/fft/helper.py
+++ b/numpy/fft/helper.py
@@ -68,8 +68,8 @@ def fftshift(x, axes=None):
for k in axes:
n = tmp.shape[k]
p2 = (n+1)//2
- mylist = concatenate((arange(p2,n),arange(p2)))
- y = take(y,mylist,k)
+ mylist = concatenate((arange(p2, n), arange(p2)))
+ y = take(y, mylist, k)
return y
@@ -116,8 +116,8 @@ def ifftshift(x, axes=None):
for k in axes:
n = tmp.shape[k]
p2 = n-(n+1)//2
- mylist = concatenate((arange(p2,n),arange(p2)))
- y = take(y,mylist,k)
+ mylist = concatenate((arange(p2, n), arange(p2)))
+ y = take(y, mylist, k)
return y
@@ -157,7 +157,7 @@ def fftfreq(n, d=1.0):
array([ 0. , 1.25, 2.5 , 3.75, -5. , -3.75, -2.5 , -1.25])
"""
- if not (isinstance(n,int) or isinstance(n, integer)):
+ if not (isinstance(n, int) or isinstance(n, integer)):
raise ValueError("n should be an integer")
val = 1.0 / (n * d)
results = empty(n, int)
@@ -213,7 +213,7 @@ def rfftfreq(n, d=1.0):
array([ 0., 10., 20., 30., 40., 50.])
"""
- if not (isinstance(n,int) or isinstance(n, integer)):
+ if not (isinstance(n, int) or isinstance(n, integer)):
raise ValueError("n should be an integer")
val = 1.0/(n*d)
N = n//2 + 1
diff --git a/numpy/fft/setup.py b/numpy/fft/setup.py
index 23a945fce..79f681e55 100644
--- a/numpy/fft/setup.py
+++ b/numpy/fft/setup.py
@@ -3,7 +3,7 @@ from __future__ import division, print_function
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
- config = Configuration('fft',parent_package,top_path)
+ config = Configuration('fft', parent_package, top_path)
config.add_data_dir('tests')
diff --git a/numpy/fft/tests/test_helper.py b/numpy/fft/tests/test_helper.py
index f30d9fff6..7eaa99fdb 100644
--- a/numpy/fft/tests/test_helper.py
+++ b/numpy/fft/tests/test_helper.py
@@ -25,7 +25,7 @@ class TestFFTShift(TestCase):
assert_array_almost_equal(fft.ifftshift(y), x)
def test_inverse(self):
- for n in [1,4,9,100,211]:
+ for n in [1, 4, 9, 100, 211]:
x = np.random.random((n,))
assert_array_almost_equal(fft.ifftshift(fft.fftshift(x)), x)