diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-02-08 22:05:11 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-02-20 22:03:05 +0000 |
commit | 370b6506f128460371484a50c813d66e64582f44 (patch) | |
tree | 31470f73a17e41608865d900228796800c4bb988 /numpy/polynomial/hermite.py | |
parent | 763589d5adbda6230b30ba054cda7206dd14d379 (diff) | |
download | numpy-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/hermite.py')
-rw-r--r-- | numpy/polynomial/hermite.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index 0ebae2027..a03fe722c 100644 --- a/numpy/polynomial/hermite.py +++ b/numpy/polynomial/hermite.py @@ -62,6 +62,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 @@ -700,10 +701,7 @@ def hermder(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 @@ -822,10 +820,7 @@ def hermint(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 |