186
186
long = int
187
187
188
188
189
+ @cbook .deprecated ("2.2" , alternative = 'np.logspace, np.geomspace' )
189
190
def logspace (xmin , xmax , N ):
190
191
'''
191
192
Return N values logarithmically spaced between xmin and xmax.
@@ -194,6 +195,7 @@ def logspace(xmin, xmax, N):
194
195
return np .exp (np .linspace (np .log (xmin ), np .log (xmax ), N ))
195
196
196
197
198
+ @cbook .deprecated ("2.2" , alternative = 'np.sqrt' )
197
199
def _norm (x ):
198
200
'''
199
201
Return sqrt(x dot x).
@@ -2048,6 +2050,7 @@ def movavg(x, n):
2048
2050
exp_safe_MAX = 1.7976931348623157e+308
2049
2051
2050
2052
2053
+ @cbook .deprecated ("2.2" )
2051
2054
def exp_safe (x ):
2052
2055
"""
2053
2056
Compute exponentials which safely underflow to zero.
@@ -2063,6 +2066,7 @@ def exp_safe(x):
2063
2066
return math .exp (x )
2064
2067
2065
2068
2069
+ @cbook .deprecated ("2.2" , alternative = 'np.array(list(map(fn, *args)))' )
2066
2070
def amap (fn , * args ):
2067
2071
"""
2068
2072
amap(function, sequence[, sequence, ...]) -> array.
@@ -2073,13 +2077,15 @@ def amap(fn, *args):
2073
2077
return np .array (list (map (fn , * args )))
2074
2078
2075
2079
2080
+ @cbook .deprecated ("2.2" )
2076
2081
def rms_flat (a ):
2077
2082
"""
2078
2083
Return the root mean square of all the elements of *a*, flattened out.
2079
2084
"""
2080
2085
return np .sqrt (np .mean (np .abs (a ) ** 2 ))
2081
2086
2082
2087
2088
+ @cbook .deprecated ("2.2" , alternative = 'np.linalg.norm(a, ord=1)' )
2083
2089
def l1norm (a ):
2084
2090
"""
2085
2091
Return the *l1* norm of *a*, flattened out.
@@ -2089,6 +2095,7 @@ def l1norm(a):
2089
2095
return np .sum (np .abs (a ))
2090
2096
2091
2097
2098
+ @cbook .deprecated ("2.2" , alternative = 'np.linalg.norm(a, ord=2)' )
2092
2099
def l2norm (a ):
2093
2100
"""
2094
2101
Return the *l2* norm of *a*, flattened out.
@@ -2098,6 +2105,7 @@ def l2norm(a):
2098
2105
return np .sqrt (np .sum (np .abs (a ) ** 2 ))
2099
2106
2100
2107
2108
+ @cbook .deprecated ("2.2" , alternative = 'np.linalg.norm(a.flat, ord=p)' )
2101
2109
def norm_flat (a , p = 2 ):
2102
2110
"""
2103
2111
norm(a,p=2) -> l-p norm of a.flat
@@ -2182,6 +2190,7 @@ def frange(xini, xfin=None, delta=None, **kw):
2182
2190
# end frange()
2183
2191
2184
2192
2193
+ @cbook .deprecated ("2.2" )
2185
2194
def identity (n , rank = 2 , dtype = 'l' , typecode = None ):
2186
2195
"""
2187
2196
Returns the identity matrix of shape (*n*, *n*, ..., *n*) (rank *r*).
@@ -2245,6 +2254,7 @@ def binary_repr(number, max_length=1025):
2245
2254
return '' .join (map (repr , digits )).replace ('L' , '' )
2246
2255
2247
2256
2257
+ @cbook .deprecated ("2.2" )
2248
2258
def log2 (x , ln2 = math .log (2.0 )):
2249
2259
"""
2250
2260
Return the log(*x*) in base 2.
@@ -2263,6 +2273,7 @@ def log2(x, ln2=math.log(2.0)):
2263
2273
return len (bin_n )
2264
2274
2265
2275
2276
+ @cbook .deprecated ("2.2" )
2266
2277
def ispower2 (n ):
2267
2278
"""
2268
2279
Returns the log base 2 of *n* if *n* is a power of 2, zero otherwise.
@@ -2277,6 +2288,7 @@ def ispower2(n):
2277
2288
return len (bin_n )
2278
2289
2279
2290
2291
+ @cbook .deprecated ("2.2" )
2280
2292
def isvector (X ):
2281
2293
"""
2282
2294
Like the MATLAB function with the same name, returns *True*
@@ -2293,7 +2305,7 @@ def isvector(X):
2293
2305
2294
2306
2295
2307
# helpers for loading, saving, manipulating and viewing numpy record arrays
2296
-
2308
+ @ cbook . deprecated ( "2.2" )
2297
2309
def safe_isnan (x ):
2298
2310
':func:`numpy.isnan` for arbitrary types'
2299
2311
if isinstance (x , six .string_types ):
@@ -2308,6 +2320,7 @@ def safe_isnan(x):
2308
2320
return b
2309
2321
2310
2322
2323
+ @cbook .deprecated ("2.2" )
2311
2324
def safe_isinf (x ):
2312
2325
':func:`numpy.isinf` for arbitrary types'
2313
2326
if isinstance (x , six .string_types ):
@@ -3025,6 +3038,7 @@ def __init__(self, precision=4):
3025
3038
FormatFloat .__init__ (self , precision , scale = 1e-6 )
3026
3039
3027
3040
3041
+ @cbook .deprecated ("2.2" , date .strftime )
3028
3042
class FormatDate (FormatObj ):
3029
3043
def __init__ (self , fmt ):
3030
3044
self .fmt = fmt
@@ -3042,6 +3056,7 @@ def fromstr(self, x):
3042
3056
return dateutil .parser .parse (x ).date ()
3043
3057
3044
3058
3059
+ @cbook .deprecated ("2.2" , datetime .strftime )
3045
3060
class FormatDatetime (FormatDate ):
3046
3061
def __init__ (self , fmt = '%Y-%m-%d %H:%M:%S' ):
3047
3062
FormatDate .__init__ (self , fmt )
@@ -3085,6 +3100,7 @@ def csvformat_factory(format):
3085
3100
return format
3086
3101
3087
3102
3103
+ @cbook .deprecated ("2.2" , alternative = np .recarray .tofile )
3088
3104
def rec2txt (r , header = None , padding = 3 , precision = 3 , fields = None ):
3089
3105
"""
3090
3106
Returns a textual representation of a record array.
@@ -3205,6 +3221,7 @@ def format(item, just_pad_prec_spacer):
3205
3221
return text
3206
3222
3207
3223
3224
+ @cbook .deprecated ("2.2" , alternative = np .recarray .tofile )
3208
3225
def rec2csv (r , fname , delimiter = ',' , formatd = None , missing = '' ,
3209
3226
missingd = None , withheader = True ):
3210
3227
"""
@@ -3444,6 +3461,7 @@ def less_simple_linear_interpolation(x, y, xi, extrap=False):
3444
3461
return yi
3445
3462
3446
3463
3464
+ @cbook .deprecated ("2.2" )
3447
3465
def slopes (x , y ):
3448
3466
"""
3449
3467
:func:`slopes` calculates the slope *y*'(*x*)
@@ -3485,6 +3503,7 @@ def slopes(x, y):
3485
3503
return yp
3486
3504
3487
3505
3506
+ @cbook .deprecated ("2.2" )
3488
3507
def stineman_interp (xi , x , y , yp = None ):
3489
3508
"""
3490
3509
Given data vectors *x* and *y*, the slope vector *yp* and a new
@@ -3740,6 +3759,7 @@ def evaluate(self, points):
3740
3759
##################################################
3741
3760
# Code related to things in and around polygons
3742
3761
##################################################
3762
+ @cbook .deprecated ("2.2" )
3743
3763
def inside_poly (points , verts ):
3744
3764
"""
3745
3765
*points* is a sequence of *x*, *y* points.
@@ -3785,6 +3805,7 @@ def poly_below(xmin, xs, ys):
3785
3805
return x , y
3786
3806
3787
3807
3808
+ @cbook .deprecated ("2.2" )
3788
3809
def poly_between (x , ylower , yupper ):
3789
3810
"""
3790
3811
Given a sequence of *x*, *ylower* and *yupper*, return the polygon
@@ -3847,6 +3868,7 @@ def contiguous_regions(mask):
3847
3868
return list (zip (idx [::2 ], idx [1 ::2 ]))
3848
3869
3849
3870
3871
+ @cbook .deprecated ("2.2" )
3850
3872
def cross_from_below (x , threshold ):
3851
3873
"""
3852
3874
return the indices into *x* where *x* crosses some threshold from
@@ -3888,6 +3910,7 @@ def cross_from_below(x, threshold):
3888
3910
return ind
3889
3911
3890
3912
3913
+ @cbook .deprecated ("2.2" )
3891
3914
def cross_from_above (x , threshold ):
3892
3915
"""
3893
3916
return the indices into *x* where *x* crosses some threshold from
@@ -3911,6 +3934,7 @@ def cross_from_above(x, threshold):
3911
3934
##################################################
3912
3935
# Vector and path length geometry calculations
3913
3936
##################################################
3937
+ @cbook .deprecated ("2.2" , alternative = 'np.linalg.norm' )
3914
3938
def vector_lengths (X , P = 2. , axis = None ):
3915
3939
"""
3916
3940
Finds the length of a set of vectors in *n* dimensions. This is
@@ -3934,7 +3958,7 @@ def distances_along_curve(X):
3934
3958
distance.
3935
3959
"""
3936
3960
X = np .diff (X , axis = 0 )
3937
- return vector_lengths (X , axis = 1 )
3961
+ return np . linalg . norm (X , axis = 1 )
3938
3962
3939
3963
3940
3964
def path_length (X ):
@@ -3966,6 +3990,7 @@ def quad2cubic(q0x, q0y, q1x, q1y, q2x, q2y):
3966
3990
return q0x , q0y , c1x , c1y , c2x , c2y , q2x , q2y
3967
3991
3968
3992
3993
+ @cbook .deprecated ("2.2" )
3969
3994
def offset_line (y , yerr ):
3970
3995
"""
3971
3996
Offsets an array *y* by +/- an error and returns a tuple
0 commit comments