summaryrefslogtreecommitdiff
path: root/numpy/fft/fftpack.py
diff options
context:
space:
mode:
authoralex <argriffi@ncsu.edu>2015-05-29 10:13:57 -0400
committeralex <argriffi@ncsu.edu>2015-05-29 10:13:57 -0400
commit949315787a51eb86db0f8a19b4c257a0ef739f32 (patch)
tree54fdf1de541da72f906b7d919517116841c8345b /numpy/fft/fftpack.py
parent3e86500a165efa4e3b54c724fb1812bec05b87f7 (diff)
downloadnumpy-949315787a51eb86db0f8a19b4c257a0ef739f32.tar.gz
MAINT: remove unnecessary helper function
Diffstat (limited to 'numpy/fft/fftpack.py')
-rw-r--r--numpy/fft/fftpack.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/numpy/fft/fftpack.py b/numpy/fft/fftpack.py
index 2a9a53576..19c6bed0f 100644
--- a/numpy/fft/fftpack.py
+++ b/numpy/fft/fftpack.py
@@ -35,18 +35,14 @@ from __future__ import division, absolute_import, print_function
__all__ = ['fft', 'ifft', 'rfft', 'irfft', 'hfft', 'ihfft', 'rfftn',
'irfftn', 'rfft2', 'irfft2', 'fft2', 'ifft2', 'fftn', 'ifftn']
-from numpy.core import asarray, zeros, swapaxes, shape, conjugate, \
- take
+import numpy as np
+from numpy.core import asarray, zeros, swapaxes, shape, conjugate, take
from . import fftpack_lite as fftpack
_fft_cache = {}
_real_fft_cache = {}
-def _asarray_copy(*args, **kwargs):
- return asarray(*args, **kwargs).copy()
-
-
def _raw_fft(a, n=None, axis=-1, init_function=fftpack.cffti,
work_function=fftpack.cfftf, fft_cache=_fft_cache):
a = asarray(a)
@@ -253,7 +249,7 @@ def ifft(a, n=None, axis=-1):
>>> plt.show()
"""
- a = _asarray_copy(a, dtype=complex)
+ a = np.array(a, dtype=complex)
if n is None:
n = shape(a)[axis]
return _raw_fft(a, n, axis, fftpack.cffti, fftpack.cfftb, _fft_cache) / n
@@ -333,7 +329,7 @@ def rfft(a, n=None, axis=-1):
exploited to compute only the non-negative frequency terms.
"""
- a = _asarray_copy(a, dtype=float)
+ a = np.array(a, dtype=float)
return _raw_fft(a, n, axis, fftpack.rffti, fftpack.rfftf, _real_fft_cache)
@@ -413,7 +409,7 @@ def irfft(a, n=None, axis=-1):
specified, and the output array is purely real.
"""
- a = _asarray_copy(a, dtype=complex)
+ a = np.array(a, dtype=complex)
if n is None:
n = (shape(a)[axis] - 1) * 2
return _raw_fft(a, n, axis, fftpack.rffti, fftpack.rfftb,
@@ -486,7 +482,7 @@ def hfft(a, n=None, axis=-1):
[ 2., -2.]])
"""
- a = _asarray_copy(a, dtype=complex)
+ a = np.array(a, dtype=complex)
if n is None:
n = (shape(a)[axis] - 1) * 2
return irfft(conjugate(a), n, axis) * n
@@ -539,7 +535,7 @@ def ihfft(a, n=None, axis=-1):
array([ 1.-0.j, 2.-0.j, 3.-0.j, 4.-0.j])
"""
- a = _asarray_copy(a, dtype=float)
+ a = np.array(a, dtype=float)
if n is None:
n = shape(a)[axis]
return conjugate(rfft(a, n, axis))/n
@@ -1007,7 +1003,7 @@ def rfftn(a, s=None, axes=None):
[ 0.+0.j, 0.+0.j]]])
"""
- a = _asarray_copy(a, dtype=float)
+ a = np.array(a, dtype=float)
s, axes = _cook_nd_args(a, s, axes)
a = rfft(a, s[-1], axes[-1])
for ii in range(len(axes)-1):
@@ -1127,7 +1123,7 @@ def irfftn(a, s=None, axes=None):
[ 1., 1.]]])
"""
- a = _asarray_copy(a, dtype=complex)
+ a = np.array(a, dtype=complex)
s, axes = _cook_nd_args(a, s, axes, invreal=1)
for ii in range(len(axes)-1):
a = ifft(a, s[ii], axes[ii])