Commit 57dd9e33 authored by Ben Glocker's avatar Ben Glocker
Browse files

replaced deprecated matplotlib.mlab.normpdf with scipy.stats.norm.pdf

parent 8ae86f24
...@@ -362,14 +362,14 @@ ...@@ -362,14 +362,14 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import matplotlib.mlab as mlab\n", "from scipy.stats import norm\n",
"\n", "\n",
"def plot_gmm(x, gmm):\n", "def plot_gmm(x, gmm):\n",
" omega = gmm.weights_\n", " omega = gmm.weights_\n",
" mu = gmm.means_\n", " mu = gmm.means_\n",
" sigma = np.sqrt(gmm.covariances_)\n", " sigma = np.sqrt(gmm.covariances_)\n",
" for ind in range(0,omega.shape[0]): \n", " for ind in range(0,omega.shape[0]): \n",
" plt.plot(x,omega[ind]*mlab.normpdf(x, mu[ind], sigma[ind]), linewidth=2, label='GMM Component '+str(ind))\n", " plt.plot(x,omega[ind]*norm.pdf(x, mu[ind], sigma[ind]), linewidth=2, label='GMM Component '+str(ind))\n",
"\n", "\n",
"plt.figure(figsize=(10, 4), dpi=100)\n", "plt.figure(figsize=(10, 4), dpi=100)\n",
"plt.hist(X, bins=num_bins, density=True, range=(lim_low, lim_high), label='Intensity histogram', color='lightgray');\n", "plt.hist(X, bins=num_bins, density=True, range=(lim_low, lim_high), label='Intensity histogram', color='lightgray');\n",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment