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

Skip to content

Commit b4a3430

Browse files
committed
Some more deprecations
1 parent d02024e commit b4a3430

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

lib/matplotlib/mlab.py

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

188188

189+
@cbook.deprecated("2.2", alternative='np.logspace, np.geomspace')
189190
def logspace(xmin, xmax, N):
190191
'''
191192
Return N values logarithmically spaced between xmin and xmax.
@@ -194,6 +195,7 @@ def logspace(xmin, xmax, N):
194195
return np.exp(np.linspace(np.log(xmin), np.log(xmax), N))
195196

196197

198+
@cbook.deprecated("2.2", alternative='np.sqrt')
197199
def _norm(x):
198200
'''
199201
Return sqrt(x dot x).
@@ -2048,6 +2050,7 @@ def movavg(x, n):
20482050
exp_safe_MAX = 1.7976931348623157e+308
20492051

20502052

2053+
@cbook.deprecated("2.2")
20512054
def exp_safe(x):
20522055
"""
20532056
Compute exponentials which safely underflow to zero.
@@ -2063,6 +2066,7 @@ def exp_safe(x):
20632066
return math.exp(x)
20642067

20652068

2069+
@cbook.deprecated("2.2", alternative='np.array(list(map(fn, *args)))')
20662070
def amap(fn, *args):
20672071
"""
20682072
amap(function, sequence[, sequence, ...]) -> array.
@@ -2073,13 +2077,15 @@ def amap(fn, *args):
20732077
return np.array(list(map(fn, *args)))
20742078

20752079

2080+
@cbook.deprecated("2.2")
20762081
def rms_flat(a):
20772082
"""
20782083
Return the root mean square of all the elements of *a*, flattened out.
20792084
"""
20802085
return np.sqrt(np.mean(np.abs(a) ** 2))
20812086

20822087

2088+
@cbook.deprecated("2.2", alternative='np.linalg.norm(a, ord=1)')
20832089
def l1norm(a):
20842090
"""
20852091
Return the *l1* norm of *a*, flattened out.
@@ -2089,6 +2095,7 @@ def l1norm(a):
20892095
return np.sum(np.abs(a))
20902096

20912097

2098+
@cbook.deprecated("2.2", alternative='np.linalg.norm(a, ord=2)')
20922099
def l2norm(a):
20932100
"""
20942101
Return the *l2* norm of *a*, flattened out.
@@ -2098,6 +2105,7 @@ def l2norm(a):
20982105
return np.sqrt(np.sum(np.abs(a) ** 2))
20992106

21002107

2108+
@cbook.deprecated("2.2", alternative='np.linalg.norm(a.flat, ord=p)')
21012109
def norm_flat(a, p=2):
21022110
"""
21032111
norm(a,p=2) -> l-p norm of a.flat
@@ -2182,6 +2190,7 @@ def frange(xini, xfin=None, delta=None, **kw):
21822190
# end frange()
21832191

21842192

2193+
@cbook.deprecated("2.2")
21852194
def identity(n, rank=2, dtype='l', typecode=None):
21862195
"""
21872196
Returns the identity matrix of shape (*n*, *n*, ..., *n*) (rank *r*).
@@ -2245,6 +2254,7 @@ def binary_repr(number, max_length=1025):
22452254
return ''.join(map(repr, digits)).replace('L', '')
22462255

22472256

2257+
@cbook.deprecated("2.2")
22482258
def log2(x, ln2=math.log(2.0)):
22492259
"""
22502260
Return the log(*x*) in base 2.
@@ -2263,6 +2273,7 @@ def log2(x, ln2=math.log(2.0)):
22632273
return len(bin_n)
22642274

22652275

2276+
@cbook.deprecated("2.2")
22662277
def ispower2(n):
22672278
"""
22682279
Returns the log base 2 of *n* if *n* is a power of 2, zero otherwise.
@@ -2277,6 +2288,7 @@ def ispower2(n):
22772288
return len(bin_n)
22782289

22792290

2291+
@cbook.deprecated("2.2")
22802292
def isvector(X):
22812293
"""
22822294
Like the MATLAB function with the same name, returns *True*
@@ -2293,7 +2305,7 @@ def isvector(X):
22932305

22942306

22952307
# helpers for loading, saving, manipulating and viewing numpy record arrays
2296-
2308+
@cbook.deprecated("2.2")
22972309
def safe_isnan(x):
22982310
':func:`numpy.isnan` for arbitrary types'
22992311
if isinstance(x, six.string_types):
@@ -2308,6 +2320,7 @@ def safe_isnan(x):
23082320
return b
23092321

23102322

2323+
@cbook.deprecated("2.2")
23112324
def safe_isinf(x):
23122325
':func:`numpy.isinf` for arbitrary types'
23132326
if isinstance(x, six.string_types):
@@ -3025,6 +3038,7 @@ def __init__(self, precision=4):
30253038
FormatFloat.__init__(self, precision, scale=1e-6)
30263039

30273040

3041+
@cbook.deprecated("2.2", date.strftime)
30283042
class FormatDate(FormatObj):
30293043
def __init__(self, fmt):
30303044
self.fmt = fmt
@@ -3042,6 +3056,7 @@ def fromstr(self, x):
30423056
return dateutil.parser.parse(x).date()
30433057

30443058

3059+
@cbook.deprecated("2.2", datetime.strftime)
30453060
class FormatDatetime(FormatDate):
30463061
def __init__(self, fmt='%Y-%m-%d %H:%M:%S'):
30473062
FormatDate.__init__(self, fmt)
@@ -3085,6 +3100,7 @@ def csvformat_factory(format):
30853100
return format
30863101

30873102

3103+
@cbook.deprecated("2.2", alternative=np.recarray.tofile)
30883104
def rec2txt(r, header=None, padding=3, precision=3, fields=None):
30893105
"""
30903106
Returns a textual representation of a record array.
@@ -3205,6 +3221,7 @@ def format(item, just_pad_prec_spacer):
32053221
return text
32063222

32073223

3224+
@cbook.deprecated("2.2", alternative=np.recarray.tofile)
32083225
def rec2csv(r, fname, delimiter=',', formatd=None, missing='',
32093226
missingd=None, withheader=True):
32103227
"""
@@ -3444,6 +3461,7 @@ def less_simple_linear_interpolation(x, y, xi, extrap=False):
34443461
return yi
34453462

34463463

3464+
@cbook.deprecated("2.2")
34473465
def slopes(x, y):
34483466
"""
34493467
:func:`slopes` calculates the slope *y*'(*x*)
@@ -3485,6 +3503,7 @@ def slopes(x, y):
34853503
return yp
34863504

34873505

3506+
@cbook.deprecated("2.2")
34883507
def stineman_interp(xi, x, y, yp=None):
34893508
"""
34903509
Given data vectors *x* and *y*, the slope vector *yp* and a new
@@ -3740,6 +3759,7 @@ def evaluate(self, points):
37403759
##################################################
37413760
# Code related to things in and around polygons
37423761
##################################################
3762+
@cbook.deprecated("2.2")
37433763
def inside_poly(points, verts):
37443764
"""
37453765
*points* is a sequence of *x*, *y* points.
@@ -3785,6 +3805,7 @@ def poly_below(xmin, xs, ys):
37853805
return x, y
37863806

37873807

3808+
@cbook.deprecated("2.2")
37883809
def poly_between(x, ylower, yupper):
37893810
"""
37903811
Given a sequence of *x*, *ylower* and *yupper*, return the polygon
@@ -3847,6 +3868,7 @@ def contiguous_regions(mask):
38473868
return list(zip(idx[::2], idx[1::2]))
38483869

38493870

3871+
@cbook.deprecated("2.2")
38503872
def cross_from_below(x, threshold):
38513873
"""
38523874
return the indices into *x* where *x* crosses some threshold from
@@ -3888,6 +3910,7 @@ def cross_from_below(x, threshold):
38883910
return ind
38893911

38903912

3913+
@cbook.deprecated("2.2")
38913914
def cross_from_above(x, threshold):
38923915
"""
38933916
return the indices into *x* where *x* crosses some threshold from
@@ -3911,6 +3934,7 @@ def cross_from_above(x, threshold):
39113934
##################################################
39123935
# Vector and path length geometry calculations
39133936
##################################################
3937+
@cbook.deprecated("2.2", alternative='np.linalg.norm')
39143938
def vector_lengths(X, P=2., axis=None):
39153939
"""
39163940
Finds the length of a set of vectors in *n* dimensions. This is
@@ -3934,7 +3958,7 @@ def distances_along_curve(X):
39343958
distance.
39353959
"""
39363960
X = np.diff(X, axis=0)
3937-
return vector_lengths(X, axis=1)
3961+
return np.linalg.norm(X, axis=1)
39383962

39393963

39403964
def path_length(X):
@@ -3966,6 +3990,7 @@ def quad2cubic(q0x, q0y, q1x, q1y, q2x, q2y):
39663990
return q0x, q0y, c1x, c1y, c2x, c2y, q2x, q2y
39673991

39683992

3993+
@cbook.deprecated("2.2")
39693994
def offset_line(y, yerr):
39703995
"""
39713996
Offsets an array *y* by +/- an error and returns a tuple

0 commit comments

Comments
 (0)