Skip to content

Commit 67bdfea

Browse files
committed
Asserts removed throughout the files m*
1 parent 33fdabe commit 67bdfea

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/matplotlib/image.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,8 @@ def set_filterrad(self, filterrad):
520520
ACCEPTS: positive float
521521
"""
522522
r = float(filterrad)
523-
assert(r > 0)
523+
if r<=0:
524+
raise ValueError("The filter radius must be a positive number")
524525
self._filterrad = r
525526

526527
def get_filterrad(self):

lib/matplotlib/mlab.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,8 @@ def cohere_pairs(X, ij, NFFT=256, Fs=2, detrend=detrend_none,
14851485
# of every channel. If preferSpeedOverMemory, cache the conjugate
14861486
# as well
14871487
if cbook.iterable(window):
1488-
assert(len(window) == NFFT)
1488+
if len(window) != NFFT:
1489+
raise ValueError("The length of the window must be equal to NFFT")
14891490
windowVals = window
14901491
else:
14911492
windowVals = window(np.ones(NFFT, X.dtype))
@@ -3575,9 +3576,10 @@ def stineman_interp(xi, x, y, yp=None):
35753576
"""
35763577

35773578
# Cast key variables as float.
3578-
x = np.asarray(x, np.float_)
3579-
y = np.asarray(y, np.float_)
3580-
assert x.shape == y.shape
3579+
x=np.asarray(x, np.float_)
3580+
y=np.asarray(y, np.float_)
3581+
if x.shape != y.shape:
3582+
raise ValueError("'x' and 'y' must be of same shape")
35813583

35823584
if yp is None:
35833585
yp = slopes(x, y)
@@ -3824,7 +3826,8 @@ def poly_below(xmin, xs, ys):
38243826
ys = numpy.asarray(ys)
38253827
Nx = len(xs)
38263828
Ny = len(ys)
3827-
assert(Nx == Ny)
3829+
if Nx!=Ny:
3830+
raise ValueError("'xs' and 'ys' must have the same length")
38283831
x = xmin*numpy.ones(2*Nx)
38293832
y = numpy.ones(2*Nx)
38303833
x[:Nx] = xs

0 commit comments

Comments
 (0)