]> git.sthu.org Git - persistence.git/commitdiff
ipynb: Update master
authorStefan Huber <shuber@sthu.org>
Wed, 17 Apr 2024 14:56:14 +0000 (16:56 +0200)
committerStefan Huber <shuber@sthu.org>
Wed, 17 Apr 2024 14:56:14 +0000 (16:56 +0200)
2Dpers.ipynb

index 898a094962eee19f88fbf045f5d979fd697cd643..9e162fbb4fda767ac30ef2dd477bff4c1e1b3e55 100644 (file)
@@ -7,6 +7,7 @@
    "outputs": [],
    "source": [
     "from scipy import misc\n",
    "outputs": [],
    "source": [
     "from scipy import misc\n",
+    "from PIL import Image\n",
     "import numpy as np\n",
     "import matplotlib.pyplot as plt\n",
     "\n",
     "import numpy as np\n",
     "import matplotlib.pyplot as plt\n",
     "\n",
    "outputs": [],
    "source": [
     "im = np.loadtxt('paws.numpy')\n",
    "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))"
    ]
   },
     "im = im * (255 / np.max(im))"
    ]
   },
    "metadata": {},
    "outputs": [],
    "source": [
    "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",
     "ax.plot_surface(xx, yy, im ,rstride=1, cstride=1, cmap=plt.cm.jet,\n",
-    "        linewidth=0)"
+    "        linewidth=0)\n",
+    "plt.show()"
    ]
   },
   {
    ]
   },
   {
    "execution_count": null,
    "metadata": {},
    "outputs": [],
    "execution_count": null,
    "metadata": {},
    "outputs": [],
-   "source": [
-    "plt.show()"
-   ]
+   "source": []
   },
   {
    "cell_type": "code",
    "execution_count": null,
   },
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": []
   }
  ],
  "metadata": {
   "kernelspec": {
    "outputs": [],
    "source": []
   }
  ],
  "metadata": {
   "kernelspec": {
-   "display_name": "Python 3",
-   "language": "python3.5",
+   "display_name": "Python 3 (ipykernel)",
+   "language": "python",
    "name": "python3"
   },
   "language_info": {
    "name": "python3"
   },
   "language_info": {
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.5.5"
+   "version": "3.11.8"
   }
  },
  "nbformat": 4,
   }
  },
  "nbformat": 4,
- "nbformat_minor": 1
+ "nbformat_minor": 4
 }
 }