summaryrefslogtreecommitdiff
path: root/numpy/fft/helper.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-04-13 12:21:42 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-04-14 08:57:45 -0600
commitc879ad8a39f2b74edcdaa05a2f2f854fb235537d (patch)
tree378c562ff234193cc7391a0f89095b693f42a42e /numpy/fft/helper.py
parent3f2c789ffd0d2e05596b15ea6cd644262f96200e (diff)
downloadnumpy-c879ad8a39f2b74edcdaa05a2f2f854fb235537d.tar.gz
2to3: Apply types fixer.
Python 3 removes the builtin types from the types module. The types fixer replaces such references with the builtin types where possible and also takes care of some special cases: types.TypeNone <- type(None) types.NotImplementedType <- type(NotImplemented) types.EllipsisType <- type(Ellipsis) The only two tricky substitutions are types.StringType <- bytes types.LongType <- int These are fixed up to support both Python 3 and Python 2 code by importing the long and bytes types from numpy.compat. Closes #3240.
Diffstat (limited to 'numpy/fft/helper.py')
-rw-r--r--numpy/fft/helper.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/numpy/fft/helper.py b/numpy/fft/helper.py
index 56d03619f..0a475153f 100644
--- a/numpy/fft/helper.py
+++ b/numpy/fft/helper.py
@@ -4,14 +4,15 @@ Discrete Fourier Transforms - helper.py
"""
from __future__ import division, absolute_import, print_function
+import numpy.core.numerictypes as nt
+from numpy.core import (
+ asarray, concatenate, arange, take, integer, empty
+ )
+
# Created by Pearu Peterson, September 2002
__all__ = ['fftshift', 'ifftshift', 'fftfreq', 'rfftfreq']
-from numpy.core import asarray, concatenate, arange, take, \
- integer, empty
-import numpy.core.numerictypes as nt
-import types
def fftshift(x, axes=None):
"""
@@ -156,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,types.IntType) 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)
@@ -212,7 +213,7 @@ def rfftfreq(n, d=1.0):
array([ 0., 10., 20., 30., 40., 50.])
"""
- if not (isinstance(n,types.IntType) 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