summaryrefslogtreecommitdiff
path: root/numpy/polynomial/chebyshev.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-02-08 22:05:11 +0000
committerEric Wieser <wieser.eric@gmail.com>2017-02-20 22:03:05 +0000
commit370b6506f128460371484a50c813d66e64582f44 (patch)
tree31470f73a17e41608865d900228796800c4bb988 /numpy/polynomial/chebyshev.py
parent763589d5adbda6230b30ba054cda7206dd14d379 (diff)
downloadnumpy-370b6506f128460371484a50c813d66e64582f44.tar.gz
MAINT: Use normalize_axis_index in all python axis checking
As a result, some exceptions change from ValueError to IndexError This also changes the exception types raised in places where normalize_axis_index is not quite appropriate
Diffstat (limited to 'numpy/polynomial/chebyshev.py')
-rw-r--r--numpy/polynomial/chebyshev.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py
index 3babb8fc2..49d0302e0 100644
--- a/numpy/polynomial/chebyshev.py
+++ b/numpy/polynomial/chebyshev.py
@@ -90,6 +90,7 @@ from __future__ import division, absolute_import, print_function
import warnings
import numpy as np
import numpy.linalg as la
+from numpy.core.multiarray import normalize_axis_index
from . import polyutils as pu
from ._polybase import ABCPolyBase
@@ -936,10 +937,7 @@ def chebder(c, m=1, scl=1, axis=0):
raise ValueError("The order of derivation must be non-negative")
if iaxis != axis:
raise ValueError("The axis must be integer")
- if not -c.ndim <= iaxis < c.ndim:
- raise ValueError("The axis is out of range")
- if iaxis < 0:
- iaxis += c.ndim
+ iaxis = normalize_axis_index(iaxis, c.ndim)
if cnt == 0:
return c
@@ -1064,10 +1062,7 @@ def chebint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
raise ValueError("Too many integration constants")
if iaxis != axis:
raise ValueError("The axis must be integer")
- if not -c.ndim <= iaxis < c.ndim:
- raise ValueError("The axis is out of range")
- if iaxis < 0:
- iaxis += c.ndim
+ iaxis = normalize_axis_index(iaxis, c.ndim)
if cnt == 0:
return c