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

Skip to content

Commit 00cace4

Browse files
committed
Remove mlab.frange
1 parent 2d15f21 commit 00cace4

3 files changed

Lines changed: 1 addition & 69 deletions

File tree

doc/api/next_api_changes/2018-09-18-DS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ in Matplotlib 2.2 has been removed. See below for a list:
1111
- `mlab.l1norm` (use ``numpy.linalg.norm(a, ord=1)`` instead)
1212
- `mlab.l2norm` (use ``numpy.linalg.norm(a, ord=2)`` instead)
1313
- `mlab.norm_flat` (use ``numpy.linalg.norm(a.flat, ord=2)`` instead)
14+
- `mlab.frange` (use numpy.arange instead)
1415
- `mlab.cohere_pairs` (use scipy.signal.coherence instead)
1516
- `mlab.entropy` (use scipy.stats.entropy instead)
1617
- `mlab.normpdf` (use scipy.stats.norm.pdf instead)

lib/matplotlib/mlab.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -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')
13191251
def identity(n, rank=2, dtype='l', typecode=None):
13201252
"""

lib/matplotlib/pylab.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@
231231
from matplotlib.mlab import (
232232
base_repr, binary_repr, csv2rec,
233233
demean, detrend, detrend_linear, detrend_mean, detrend_none,
234-
frange,
235234
identity, ispower2, isvector,
236235
log2, movavg,
237236
window_hanning, window_none)

0 commit comments

Comments
 (0)