@@ -1194,72 +1194,6 @@ def cohere(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning,
11941194 return Cxy , f
11951195
11961196
1197- @cbook .deprecated ('2.2' , 'numpy.percentile' )
1198- def prctile (x , p = (0.0 , 25.0 , 50.0 , 75.0 , 100.0 )):
1199- """
1200- Return the percentiles of *x*. *p* can either be a sequence of
1201- percentile values or a scalar. If *p* is a sequence, the ith
1202- element of the return sequence is the *p*(i)-th percentile of *x*.
1203- If *p* is a scalar, the largest value of *x* less than or equal to
1204- the *p* percentage point in the sequence is returned.
1205- """
1206-
1207- # This implementation derived from scipy.stats.scoreatpercentile
1208- def _interpolate (a , b , fraction ):
1209- """Returns the point at the given fraction between a and b, where
1210- 'fraction' must be between 0 and 1.
1211- """
1212- return a + (b - a ) * fraction
1213-
1214- per = np .array (p )
1215- values = np .sort (x , axis = None )
1216-
1217- idxs = per / 100 * (values .shape [0 ] - 1 )
1218- ai = idxs .astype (int )
1219- bi = ai + 1
1220- frac = idxs % 1
1221-
1222- # handle cases where attempting to interpolate past last index
1223- cond = bi >= len (values )
1224- if per .ndim :
1225- ai [cond ] -= 1
1226- bi [cond ] -= 1
1227- frac [cond ] += 1
1228- else :
1229- if cond :
1230- ai -= 1
1231- bi -= 1
1232- frac += 1
1233-
1234- return _interpolate (values [ai ], values [bi ], frac )
1235-
1236-
1237- @cbook .deprecated ('2.2' )
1238- def prctile_rank (x , p ):
1239- """
1240- Return the rank for each element in *x*, return the rank
1241- 0..len(*p*). e.g., if *p* = (25, 50, 75), the return value will be a
1242- len(*x*) array with values in [0,1,2,3] where 0 indicates the
1243- value is less than the 25th percentile, 1 indicates the value is
1244- >= the 25th and < 50th percentile, ... and 3 indicates the value
1245- is above the 75th percentile cutoff.
1246-
1247- *p* is either an array of percentiles in [0..100] or a scalar which
1248- indicates how many quantiles of data you want ranked.
1249- """
1250-
1251- if not np .iterable (p ):
1252- p = np .arange (100.0 / p , 100.0 , 100.0 / p )
1253- else :
1254- p = np .asarray (p )
1255-
1256- if p .max () <= 1 or p .min () < 0 or p .max () > 100 :
1257- raise ValueError ('percentiles should be in range 0..100, not 0..1' )
1258-
1259- ptiles = prctile (x , p )
1260- return np .searchsorted (ptiles , x )
1261-
1262-
12631197@cbook .deprecated ('2.2' )
12641198def center_matrix (M , dim = 0 ):
12651199 """
0 commit comments