@@ -1247,74 +1247,6 @@ def movavg(x, n):
12471247"""
12481248
12491249
1250- @cbook .deprecated ("2.2" , 'numpy.arange' )
1251- def frange (xini , xfin = None , delta = None , ** kw ):
1252- """
1253- frange([start,] stop[, step, keywords]) -> array of floats
1254-
1255- Return a numpy ndarray containing a progression of floats. Similar to
1256- :func:`numpy.arange`, but defaults to a closed interval.
1257-
1258- ``frange(x0, x1)`` returns ``[x0, x0+1, x0+2, ..., x1]``; *start*
1259- defaults to 0, and the endpoint *is included*. This behavior is
1260- different from that of :func:`range` and
1261- :func:`numpy.arange`. This is deliberate, since :func:`frange`
1262- will probably be more useful for generating lists of points for
1263- function evaluation, and endpoints are often desired in this
1264- use. The usual behavior of :func:`range` can be obtained by
1265- setting the keyword *closed* = 0, in this case, :func:`frange`
1266- basically becomes :func:numpy.arange`.
1267-
1268- When *step* is given, it specifies the increment (or
1269- decrement). All arguments can be floating point numbers.
1270-
1271- ``frange(x0,x1,d)`` returns ``[x0,x0+d,x0+2d,...,xfin]`` where
1272- *xfin* <= *x1*.
1273-
1274- :func:`frange` can also be called with the keyword *npts*. This
1275- sets the number of points the list should contain (and overrides
1276- the value *step* might have been given). :func:`numpy.arange`
1277- doesn't offer this option.
1278-
1279- Examples::
1280-
1281- >>> frange(3)
1282- array([ 0., 1., 2., 3.])
1283- >>> frange(3,closed=0)
1284- array([ 0., 1., 2.])
1285- >>> frange(1,6,2)
1286- array([1, 3, 5]) or 1,3,5,7, depending on floating point vagueries
1287- >>> frange(1,6.5,npts=5)
1288- array([ 1. , 2.375, 3.75 , 5.125, 6.5 ])
1289- """
1290-
1291- # defaults
1292- kw .setdefault ('closed' , 1 )
1293- endpoint = kw ['closed' ] != 0
1294-
1295- # funny logic to allow the *first* argument to be optional (like range())
1296- # This was modified with a simpler version from a similar frange() found
1297- # at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66472
1298- if xfin is None :
1299- xfin = xini + 0.0
1300- xini = 0.0
1301-
1302- if delta is None :
1303- delta = 1.0
1304-
1305- # compute # of points, spacing and return final list
1306- try :
1307- npts = kw ['npts' ]
1308- delta = (xfin - xini ) / (npts - endpoint )
1309- except KeyError :
1310- npts = int (np .round ((xfin - xini )/ delta )) + endpoint
1311- # round finds the nearest, so the endpoint can be up to
1312- # delta/2 larger than xfin.
1313-
1314- return np .arange (npts )* delta + xini
1315- # end frange()
1316-
1317-
13181250@cbook .deprecated ("2.2" , 'numpy.identity' )
13191251def identity (n , rank = 2 , dtype = 'l' , typecode = None ):
13201252 """
0 commit comments