186
186
long = int
187
187
188
188
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' )
191
190
def logspace (xmin , xmax , N ):
192
191
'''
193
192
Return N values logarithmically spaced between xmin and xmax.
@@ -196,6 +195,7 @@ def logspace(xmin, xmax, N):
196
195
return np .exp (np .linspace (np .log (xmin ), np .log (xmax ), N ))
197
196
198
197
198
+ @cbook .deprecated ("2.2" , alternative = 'np.sqrt' )
199
199
def _norm (x ):
200
200
'''
201
201
Return sqrt(x dot x).
@@ -2050,6 +2050,7 @@ def movavg(x, n):
2050
2050
exp_safe_MAX = 1.7976931348623157e+308
2051
2051
2052
2052
2053
+ @cbook .deprecated ("2.2" )
2053
2054
def exp_safe (x ):
2054
2055
"""
2055
2056
Compute exponentials which safely underflow to zero.
@@ -2065,6 +2066,7 @@ def exp_safe(x):
2065
2066
return math .exp (x )
2066
2067
2067
2068
2069
+ @cbook .deprecated ("2.2" , alternative = 'np.array(list(map(fn, *args)))' )
2068
2070
def amap (fn , * args ):
2069
2071
"""
2070
2072
amap(function, sequence[, sequence, ...]) -> array.
@@ -2075,13 +2077,15 @@ def amap(fn, *args):
2075
2077
return np .array (list (map (fn , * args )))
2076
2078
2077
2079
2080
+ @cbook .deprecated ("2.2" )
2078
2081
def rms_flat (a ):
2079
2082
"""
2080
2083
Return the root mean square of all the elements of *a*, flattened out.
2081
2084
"""
2082
2085
return np .sqrt (np .mean (np .abs (a ) ** 2 ))
2083
2086
2084
2087
2088
+ @cbook .deprecated ("2.2" , alternative = 'np.linalg.norm(a, ord=1)' )
2085
2089
def l1norm (a ):
2086
2090
"""
2087
2091
Return the *l1* norm of *a*, flattened out.
@@ -2091,6 +2095,7 @@ def l1norm(a):
2091
2095
return np .sum (np .abs (a ))
2092
2096
2093
2097
2098
+ @cbook .deprecated ("2.2" , alternative = 'np.linalg.norm(a, ord=2)' )
2094
2099
def l2norm (a ):
2095
2100
"""
2096
2101
Return the *l2* norm of *a*, flattened out.
@@ -2100,6 +2105,7 @@ def l2norm(a):
2100
2105
return np .sqrt (np .sum (np .abs (a ) ** 2 ))
2101
2106
2102
2107
2108
+ @cbook .deprecated ("2.2" , alternative = 'np.linalg.norm(a.flat, ord=p)' )
2103
2109
def norm_flat (a , p = 2 ):
2104
2110
"""
2105
2111
norm(a,p=2) -> l-p norm of a.flat
@@ -2185,6 +2191,7 @@ def frange(xini, xfin=None, delta=None, **kw):
2185
2191
# end frange()
2186
2192
2187
2193
2194
+ @cbook .deprecated ("2.2" )
2188
2195
def identity (n , rank = 2 , dtype = 'l' , typecode = None ):
2189
2196
"""
2190
2197
Returns the identity matrix of shape (*n*, *n*, ..., *n*) (rank *r*).
@@ -2248,6 +2255,7 @@ def binary_repr(number, max_length=1025):
2248
2255
return '' .join (map (repr , digits )).replace ('L' , '' )
2249
2256
2250
2257
2258
+ @cbook .deprecated ("2.2" )
2251
2259
def log2 (x , ln2 = math .log (2.0 )):
2252
2260
"""
2253
2261
Return the log(*x*) in base 2.
@@ -2266,6 +2274,7 @@ def log2(x, ln2=math.log(2.0)):
2266
2274
return len (bin_n )
2267
2275
2268
2276
2277
+ @cbook .deprecated ("2.2" )
2269
2278
def ispower2 (n ):
2270
2279
"""
2271
2280
Returns the log base 2 of *n* if *n* is a power of 2, zero otherwise.
@@ -2280,6 +2289,7 @@ def ispower2(n):
2280
2289
return len (bin_n )
2281
2290
2282
2291
2292
+ @cbook .deprecated ("2.2" )
2283
2293
def isvector (X ):
2284
2294
"""
2285
2295
Like the MATLAB function with the same name, returns *True*
@@ -2296,7 +2306,7 @@ def isvector(X):
2296
2306
2297
2307
2298
2308
# helpers for loading, saving, manipulating and viewing numpy record arrays
2299
-
2309
+ @ cbook . deprecated ( "2.2" )
2300
2310
def safe_isnan (x ):
2301
2311
':func:`numpy.isnan` for arbitrary types'
2302
2312
if isinstance (x , six .string_types ):
@@ -2311,6 +2321,7 @@ def safe_isnan(x):
2311
2321
return b
2312
2322
2313
2323
2324
+ @cbook .deprecated ("2.2" )
2314
2325
def safe_isinf (x ):
2315
2326
':func:`numpy.isinf` for arbitrary types'
2316
2327
if isinstance (x , six .string_types ):
@@ -3028,6 +3039,7 @@ def __init__(self, precision=4):
3028
3039
FormatFloat .__init__ (self , precision , scale = 1e-6 )
3029
3040
3030
3041
3042
+ @cbook .deprecated ("2.2" , date .strftime )
3031
3043
class FormatDate (FormatObj ):
3032
3044
def __init__ (self , fmt ):
3033
3045
self .fmt = fmt
@@ -3045,6 +3057,7 @@ def fromstr(self, x):
3045
3057
return dateutil .parser .parse (x ).date ()
3046
3058
3047
3059
3060
+ @cbook .deprecated ("2.2" , datetime .strftime )
3048
3061
class FormatDatetime (FormatDate ):
3049
3062
def __init__ (self , fmt = '%Y-%m-%d %H:%M:%S' ):
3050
3063
FormatDate .__init__ (self , fmt )
@@ -3088,6 +3101,7 @@ def csvformat_factory(format):
3088
3101
return format
3089
3102
3090
3103
3104
+ @cbook .deprecated ("2.2" , alternative = np .recarray .tofile )
3091
3105
def rec2txt (r , header = None , padding = 3 , precision = 3 , fields = None ):
3092
3106
"""
3093
3107
Returns a textual representation of a record array.
@@ -3208,6 +3222,7 @@ def format(item, just_pad_prec_spacer):
3208
3222
return text
3209
3223
3210
3224
3225
+ @cbook .deprecated ("2.2" , alternative = np .recarray .tofile )
3211
3226
def rec2csv (r , fname , delimiter = ',' , formatd = None , missing = '' ,
3212
3227
missingd = None , withheader = True ):
3213
3228
"""
@@ -3447,6 +3462,7 @@ def less_simple_linear_interpolation(x, y, xi, extrap=False):
3447
3462
return yi
3448
3463
3449
3464
3465
+ @cbook .deprecated ("2.2" )
3450
3466
def slopes (x , y ):
3451
3467
"""
3452
3468
:func:`slopes` calculates the slope *y*'(*x*)
@@ -3488,6 +3504,7 @@ def slopes(x, y):
3488
3504
return yp
3489
3505
3490
3506
3507
+ @cbook .deprecated ("2.2" )
3491
3508
def stineman_interp (xi , x , y , yp = None ):
3492
3509
"""
3493
3510
Given data vectors *x* and *y*, the slope vector *yp* and a new
@@ -3743,6 +3760,7 @@ def evaluate(self, points):
3743
3760
##################################################
3744
3761
# Code related to things in and around polygons
3745
3762
##################################################
3763
+ @cbook .deprecated ("2.2" )
3746
3764
def inside_poly (points , verts ):
3747
3765
"""
3748
3766
*points* is a sequence of *x*, *y* points.
@@ -3788,6 +3806,7 @@ def poly_below(xmin, xs, ys):
3788
3806
return x , y
3789
3807
3790
3808
3809
+ @cbook .deprecated ("2.2" )
3791
3810
def poly_between (x , ylower , yupper ):
3792
3811
"""
3793
3812
Given a sequence of *x*, *ylower* and *yupper*, return the polygon
@@ -3850,6 +3869,7 @@ def contiguous_regions(mask):
3850
3869
return list (zip (idx [::2 ], idx [1 ::2 ]))
3851
3870
3852
3871
3872
+ @cbook .deprecated ("2.2" )
3853
3873
def cross_from_below (x , threshold ):
3854
3874
"""
3855
3875
return the indices into *x* where *x* crosses some threshold from
@@ -3891,6 +3911,7 @@ def cross_from_below(x, threshold):
3891
3911
return ind
3892
3912
3893
3913
3914
+ @cbook .deprecated ("2.2" )
3894
3915
def cross_from_above (x , threshold ):
3895
3916
"""
3896
3917
return the indices into *x* where *x* crosses some threshold from
@@ -3914,6 +3935,7 @@ def cross_from_above(x, threshold):
3914
3935
##################################################
3915
3936
# Vector and path length geometry calculations
3916
3937
##################################################
3938
+ @cbook .deprecated ("2.2" , alternative = 'np.linalg.norm' )
3917
3939
def vector_lengths (X , P = 2. , axis = None ):
3918
3940
"""
3919
3941
Finds the length of a set of vectors in *n* dimensions. This is
@@ -3937,7 +3959,7 @@ def distances_along_curve(X):
3937
3959
distance.
3938
3960
"""
3939
3961
X = np .diff (X , axis = 0 )
3940
- return vector_lengths (X , axis = 1 )
3962
+ return np . linalg . norm (X , axis = 1 )
3941
3963
3942
3964
3943
3965
def path_length (X ):
@@ -3969,6 +3991,7 @@ def quad2cubic(q0x, q0y, q1x, q1y, q2x, q2y):
3969
3991
return q0x , q0y , c1x , c1y , c2x , c2y , q2x , q2y
3970
3992
3971
3993
3994
+ @cbook .deprecated ("2.2" )
3972
3995
def offset_line (y , yerr ):
3973
3996
"""
3974
3997
Offsets an array *y* by +/- an error and returns a tuple
0 commit comments