From: Stefan Huber Date: Wed, 17 Apr 2024 14:56:14 +0000 (+0200) Subject: ipynb: Update X-Git-Url: https://git.sthu.org/?a=commitdiff_plain;h=ec09779b0a5485c361d81407ed2cdb426fbb362e;p=persistence.git ipynb: Update --- diff --git a/2Dpers.ipynb b/2Dpers.ipynb index 898a094..9e162fb 100644 --- a/2Dpers.ipynb +++ b/2Dpers.ipynb @@ -7,6 +7,7 @@ "outputs": [], "source": [ "from scipy import misc\n", + "from PIL import Image\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", @@ -22,7 +23,10 @@ "outputs": [], "source": [ "im = np.loadtxt('paws.numpy')\n", - "im = misc.imresize(im, 2.0)\n", + "print(\"pre shape:\", im.shape)\n", + "w, h = im.shape\n", + "im = np.array(Image.fromarray(im).resize((h*2, w*2)))\n", + "print(\"post shape:\", im.shape)\n", "im = im * (255 / np.max(im))" ] }, @@ -103,10 +107,12 @@ "metadata": {}, "outputs": [], "source": [ - "fig = plt.figure()\n", - "ax = fig.gca(projection='3d')\n", + "fig = plt.figure(figsize=(6, 6))\n", + "ax = fig.add_subplot(111, projection='3d')\n", + "ax.set_zlim(0, 800)\n", "ax.plot_surface(xx, yy, im ,rstride=1, cstride=1, cmap=plt.cm.jet,\n", - " linewidth=0)" + " linewidth=0)\n", + "plt.show()" ] }, { @@ -114,24 +120,20 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "plt.show()" - ] + "source": [] }, { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": true - }, + "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3", - "language": "python3.5", + "display_name": "Python 3 (ipykernel)", + "language": "python", "name": "python3" }, "language_info": { @@ -144,9 +146,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.5" + "version": "3.11.8" } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 4 }