Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9247888

Browse files
committed
Some more deprecations
1 parent 73b63cb commit 9247888

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

lib/matplotlib/mlab.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@
186186
long = int
187187

188188

189-
@cbook.deprecated("2.1",
190-
alternative='np.logspace(np.log(xmin), np.log(xmax), N)')
189+
@cbook.deprecated("2.2", alternative='np.logspace, np.geomspace')
191190
def logspace(xmin, xmax, N):
192191
'''
193192
Return N values logarithmically spaced between xmin and xmax.
@@ -196,6 +195,7 @@ def logspace(xmin, xmax, N):
196195
return np.exp(np.linspace(np.log(xmin), np.log(xmax), N))
197196

198197

198+
@cbook.deprecated("2.2", alternative='np.sqrt')
199199
def _norm(x):
200200
'''
201201
Return sqrt(x dot x).
@@ -2050,6 +2050,7 @@ def movavg(x, n):
20502050
exp_safe_MAX = 1.7976931348623157e+308
20512051

20522052

2053+
@cbook.deprecated("2.2")
20532054
def exp_safe(x):
20542055
"""
20552056
Compute exponentials which safely underflow to zero.
@@ -2065,6 +2066,7 @@ def exp_safe(x):
20652066
return math.exp(x)
20662067

20672068

2069+
@cbook.deprecated("2.2", alternative='np.array(list(map(fn, *args)))')
20682070
def amap(fn, *args):
20692071
"""
20702072
amap(function, sequence[, sequence, ...]) -> array.
@@ -2075,13 +2077,15 @@ def amap(fn, *args):
20752077
return np.array(list(map(fn, *args)))
20762078

20772079

2080+
@cbook.deprecated("2.2")
20782081
def rms_flat(a):
20792082
"""
20802083
Return the root mean square of all the elements of *a*, flattened out.
20812084
"""
20822085
return np.sqrt(np.mean(np.abs(a) ** 2))
20832086

20842087

2088+
@cbook.deprecated("2.2", alternative='np.linalg.norm(a, ord=1)')
20852089
def l1norm(a):
20862090
"""
20872091
Return the *l1* norm of *a*, flattened out.
@@ -2091,6 +2095,7 @@ def l1norm(a):
20912095
return np.sum(np.abs(a))
20922096

20932097

2098+
@cbook.deprecated("2.2", alternative='np.linalg.norm(a, ord=2)')
20942099
def l2norm(a):
20952100
"""
20962101
Return the *l2* norm of *a*, flattened out.
@@ -2100,6 +2105,7 @@ def l2norm(a):
21002105
return np.sqrt(np.sum(np.abs(a) ** 2))
21012106

21022107

2108+
@cbook.deprecated("2.2", alternative='np.linalg.norm(a.flat, ord=p)')
21032109
def norm_flat(a, p=2):
21042110
"""
21052111
norm(a,p=2) -> l-p norm of a.flat
@@ -2185,6 +2191,7 @@ def frange(xini, xfin=None, delta=None, **kw):
21852191
# end frange()
21862192

21872193

2194+
@cbook.deprecated("2.2")
21882195
def identity(n, rank=2, dtype='l', typecode=None):
21892196
"""
21902197
Returns the identity matrix of shape (*n*, *n*, ..., *n*) (rank *r*).
@@ -2248,6 +2255,7 @@ def binary_repr(number, max_length=1025):
22482255
return ''.join(map(repr, digits)).replace('L', '')
22492256

22502257

2258+
@cbook.deprecated("2.2")
22512259
def log2(x, ln2=math.log(2.0)):
22522260
"""
22532261
Return the log(*x*) in base 2.
@@ -2266,6 +2274,7 @@ def log2(x, ln2=math.log(2.0)):
22662274
return len(bin_n)
22672275

22682276

2277+
@cbook.deprecated("2.2")
22692278
def ispower2(n):
22702279
"""
22712280
Returns the log base 2 of *n* if *n* is a power of 2, zero otherwise.
@@ -2280,6 +2289,7 @@ def ispower2(n):
22802289
return len(bin_n)
22812290

22822291

2292+
@cbook.deprecated("2.2")
22832293
def isvector(X):
22842294
"""
22852295
Like the MATLAB function with the same name, returns *True*
@@ -2296,7 +2306,7 @@ def isvector(X):
22962306

22972307

22982308
# helpers for loading, saving, manipulating and viewing numpy record arrays
2299-
2309+
@cbook.deprecated("2.2")
23002310
def safe_isnan(x):
23012311
':func:`numpy.isnan` for arbitrary types'
23022312
if isinstance(x, six.string_types):
@@ -2311,6 +2321,7 @@ def safe_isnan(x):
23112321
return b
23122322

23132323

2324+
@cbook.deprecated("2.2")
23142325
def safe_isinf(x):
23152326
':func:`numpy.isinf` for arbitrary types'
23162327
if isinstance(x, six.string_types):
@@ -3028,6 +3039,7 @@ def __init__(self, precision=4):
30283039
FormatFloat.__init__(self, precision, scale=1e-6)
30293040

30303041

3042+
@cbook.deprecated("2.2", date.strftime)
30313043
class FormatDate(FormatObj):
30323044
def __init__(self, fmt):
30333045
self.fmt = fmt
@@ -3045,6 +3057,7 @@ def fromstr(self, x):
30453057
return dateutil.parser.parse(x).date()
30463058

30473059

3060+
@cbook.deprecated("2.2", datetime.strftime)
30483061
class FormatDatetime(FormatDate):
30493062
def __init__(self, fmt='%Y-%m-%d %H:%M:%S'):
30503063
FormatDate.__init__(self, fmt)
@@ -3088,6 +3101,7 @@ def csvformat_factory(format):
30883101
return format
30893102

30903103

3104+
@cbook.deprecated("2.2", alternative=np.recarray.tofile)
30913105
def rec2txt(r, header=None, padding=3, precision=3, fields=None):
30923106
"""
30933107
Returns a textual representation of a record array.
@@ -3208,6 +3222,7 @@ def format(item, just_pad_prec_spacer):
32083222
return text
32093223

32103224

3225+
@cbook.deprecated("2.2", alternative=np.recarray.tofile)
32113226
def rec2csv(r, fname, delimiter=',', formatd=None, missing='',
32123227
missingd=None, withheader=True):
32133228
"""
@@ -3447,6 +3462,7 @@ def less_simple_linear_interpolation(x, y, xi, extrap=False):
34473462
return yi
34483463

34493464

3465+
@cbook.deprecated("2.2")
34503466
def slopes(x, y):
34513467
"""
34523468
:func:`slopes` calculates the slope *y*'(*x*)
@@ -3488,6 +3504,7 @@ def slopes(x, y):
34883504
return yp
34893505

34903506

3507+
@cbook.deprecated("2.2")
34913508
def stineman_interp(xi, x, y, yp=None):
34923509
"""
34933510
Given data vectors *x* and *y*, the slope vector *yp* and a new
@@ -3743,6 +3760,7 @@ def evaluate(self, points):
37433760
##################################################
37443761
# Code related to things in and around polygons
37453762
##################################################
3763+
@cbook.deprecated("2.2")
37463764
def inside_poly(points, verts):
37473765
"""
37483766
*points* is a sequence of *x*, *y* points.
@@ -3788,6 +3806,7 @@ def poly_below(xmin, xs, ys):
37883806
return x, y
37893807

37903808

3809+
@cbook.deprecated("2.2")
37913810
def poly_between(x, ylower, yupper):
37923811
"""
37933812
Given a sequence of *x*, *ylower* and *yupper*, return the polygon
@@ -3850,6 +3869,7 @@ def contiguous_regions(mask):
38503869
return list(zip(idx[::2], idx[1::2]))
38513870

38523871

3872+
@cbook.deprecated("2.2")
38533873
def cross_from_below(x, threshold):
38543874
"""
38553875
return the indices into *x* where *x* crosses some threshold from
@@ -3891,6 +3911,7 @@ def cross_from_below(x, threshold):
38913911
return ind
38923912

38933913

3914+
@cbook.deprecated("2.2")
38943915
def cross_from_above(x, threshold):
38953916
"""
38963917
return the indices into *x* where *x* crosses some threshold from
@@ -3914,6 +3935,7 @@ def cross_from_above(x, threshold):
39143935
##################################################
39153936
# Vector and path length geometry calculations
39163937
##################################################
3938+
@cbook.deprecated("2.2", alternative='np.linalg.norm')
39173939
def vector_lengths(X, P=2., axis=None):
39183940
"""
39193941
Finds the length of a set of vectors in *n* dimensions. This is
@@ -3937,7 +3959,7 @@ def distances_along_curve(X):
39373959
distance.
39383960
"""
39393961
X = np.diff(X, axis=0)
3940-
return vector_lengths(X, axis=1)
3962+
return np.linalg.norm(X, axis=1)
39413963

39423964

39433965
def path_length(X):
@@ -3969,6 +3991,7 @@ def quad2cubic(q0x, q0y, q1x, q1y, q2x, q2y):
39693991
return q0x, q0y, c1x, c1y, c2x, c2y, q2x, q2y
39703992

39713993

3994+
@cbook.deprecated("2.2")
39723995
def offset_line(y, yerr):
39733996
"""
39743997
Offsets an array *y* by +/- an error and returns a tuple

0 commit comments

Comments
 (0)