diff options
author | endolith <endolith@gmail.com> | 2012-11-18 17:19:46 -0500 |
---|---|---|
committer | endolith <endolith@gmail.com> | 2012-11-18 17:19:46 -0500 |
commit | 9bd89e470c3f3128f6a61fe9fa133a99b7887bbd (patch) | |
tree | f9622ba04fd9628c74214aff4920eb6f5eb35869 /numpy/fft/helper.py | |
parent | 2e2f4522275af6e256c243e2b43bf5fc1d37b07c (diff) | |
download | numpy-9bd89e470c3f3128f6a61fe9fa133a99b7887bbd.tar.gz |
MAINT: Don't use assert to check variable type
Diffstat (limited to 'numpy/fft/helper.py')
-rw-r--r-- | numpy/fft/helper.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/fft/helper.py b/numpy/fft/helper.py index 6a89b0c93..793aaa2ed 100644 --- a/numpy/fft/helper.py +++ b/numpy/fft/helper.py @@ -151,7 +151,8 @@ def fftfreq(n, d=1.0): array([ 0. , 1.25, 2.5 , 3.75, -5. , -3.75, -2.5 , -1.25]) """ - assert isinstance(n,types.IntType) or isinstance(n, integer) + if not (isinstance(n,types.IntType) or isinstance(n, integer)): + raise ValueError("n should be an integer") val = 1.0 / (n * d) results = empty(n, int) N = (n-1)//2 + 1 @@ -204,7 +205,8 @@ def rfftfreq(n, d=1.0): array([ 0., 10., 20., 30., 40., 50.]) """ - assert isinstance(n,types.IntType) or isinstance(n, integer) + if not (isinstance(n,types.IntType) or isinstance(n, integer)): + raise ValueError("n should be an integer") val = 1.0/(n*d) N = n//2 + 1 results = arange(0, N, dtype=int) |