Skip to content

Commit 6286efa

Browse files
committed
Merge pull request matplotlib#3037 from tacaswell/mlab_cleanup
DEP : removed levypdf from mlab
2 parents a705fa9 + 9a86dea commit 6286efa

File tree

3 files changed

+23
-34
lines changed

3 files changed

+23
-34
lines changed

doc/api/api_changes.rst

+12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ For new features that were added to matplotlib, please see
1414
Changes in 1.4.x
1515
================
1616

17+
Code changes
18+
------------
19+
1720
* A major refactoring of the axes module was made. The axes module has been
1821
split into smaller modules:
1922

@@ -157,6 +160,15 @@ original location:
157160

158161
* Added clockwise parameter to control sectors direction in `axes.pie`
159162

163+
Code removal
164+
------------
165+
166+
* Removed ``mlab.levypdf``. The code raised a numpy error (and has for
167+
a long time) and was not the standard form of the Levy distribution.
168+
``scipy.stats.levy`` should be used instead
169+
170+
171+
160172

161173
.. _changes_in_1_3:
162174

lib/matplotlib/mlab.py

+10-32
Original file line numberDiff line numberDiff line change
@@ -1557,28 +1557,6 @@ def normpdf(x, *args):
15571557
return 1./(np.sqrt(2*np.pi)*sigma)*np.exp(-0.5 * (1./sigma*(x - mu))**2)
15581558

15591559

1560-
def levypdf(x, gamma, alpha):
1561-
"Returm the levy pdf evaluated at *x* for params *gamma*, *alpha*"
1562-
1563-
N = len(x)
1564-
1565-
if N % 2 != 0:
1566-
raise ValueError('x must be an event length array; try\n' + \
1567-
'x = np.linspace(minx, maxx, N), where N is even')
1568-
1569-
dx = x[1] - x[0]
1570-
1571-
f = 1/(N*dx)*np.arange(-N / 2, N / 2, np.float_)
1572-
1573-
ind = np.concatenate([np.arange(N / 2, N, int),
1574-
np.arange(0, N / 2, int)])
1575-
df = f[1] - f[0]
1576-
cfl = np.exp(-gamma * np.absolute(2 * np.pi * f) ** alpha)
1577-
1578-
px = np.fft.fft(np.take(cfl, ind) * df).astype(np.float_)
1579-
return np.take(px, ind)
1580-
1581-
15821560
def find(condition):
15831561
"Return the indices where ravel(condition) is true"
15841562
res, = np.nonzero(np.ravel(condition))
@@ -1670,13 +1648,13 @@ def __init__(self, a, standardize=True):
16701648
16711649
*numrows*, *numcols*: the dimensions of a
16721650
1673-
*mu* : a numdims array of means of a. This is the vector that points to the
1674-
origin of PCA space.
1651+
*mu* : a numdims array of means of a. This is the vector that points to the
1652+
origin of PCA space.
16751653
16761654
*sigma* : a numdims array of standard deviation of a
16771655
16781656
*fracs* : the proportion of variance of each of the principal components
1679-
1657+
16801658
*s* : the actual eigenvalues of the decomposition
16811659
16821660
*Wt* : the weight vector for projecting a numdims point or array into PCA space
@@ -1705,23 +1683,23 @@ def __init__(self, a, standardize=True):
17051683
U, s, Vh = np.linalg.svd(a, full_matrices=False)
17061684

17071685
# Note: .H indicates the conjugate transposed / Hermitian.
1708-
1686+
17091687
# The SVD is commonly written as a = U s V.H.
17101688
# If U is a unitary matrix, it means that it satisfies U.H = inv(U).
1711-
1689+
17121690
# The rows of Vh are the eigenvectors of a.H a.
1713-
# The columns of U are the eigenvectors of a a.H.
1691+
# The columns of U are the eigenvectors of a a.H.
17141692
# For row i in Vh and column i in U, the corresponding eigenvalue is s[i]**2.
1715-
1693+
17161694
self.Wt = Vh
1717-
1695+
17181696
# save the transposed coordinates
17191697
Y = np.dot(Vh, a.T).T
17201698
self.Y = Y
1721-
1699+
17221700
# save the eigenvalues
17231701
self.s = s**2
1724-
1702+
17251703
# and now the contribution of the individual components
17261704
vars = self.s/float(len(s))
17271705
self.fracs = vars/vars.sum()

lib/matplotlib/pylab.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@
156156
157157
_Probability
158158
159-
levypdf - The levy probability density function from the char. func.
160159
normpdf - The Gaussian probability density function
161160
rand - random numbers from the uniform distribution
162161
randn - random numbers from the normal distribution
@@ -251,7 +250,7 @@
251250
is_closed_polygon, path_length, distances_along_curve, vector_lengths
252251

253252
from matplotlib.mlab import window_hanning, window_none, detrend, demean, \
254-
detrend_mean, detrend_none, detrend_linear, entropy, normpdf, levypdf, \
253+
detrend_mean, detrend_none, detrend_linear, entropy, normpdf, \
255254
find, longest_contiguous_ones, longest_ones, prepca, \
256255
prctile, prctile_rank, \
257256
center_matrix, rk4, bivariate_normal, get_xyz_where, \

0 commit comments

Comments
 (0)