From c9b9d3f35a542e37808f2f7de4973adeca20edde Mon Sep 17 00:00:00 2001 From: sbosse Date: Wed, 28 Aug 2024 21:39:13 +0200 Subject: [PATCH] Wed 28 Aug 21:38:52 CEST 2024 --- .../PerformancePacking-checkpoint.ipynb | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 src/SimNDT/core/.ipynb_checkpoints/PerformancePacking-checkpoint.ipynb diff --git a/src/SimNDT/core/.ipynb_checkpoints/PerformancePacking-checkpoint.ipynb b/src/SimNDT/core/.ipynb_checkpoints/PerformancePacking-checkpoint.ipynb new file mode 100644 index 0000000..11128ce --- /dev/null +++ b/src/SimNDT/core/.ipynb_checkpoints/PerformancePacking-checkpoint.ipynb @@ -0,0 +1,159 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:93a4bc0a8c10cda2b046ddec701b7579a4ab116bfc7ab026f65073ed6ef9a967" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "from quadtree import ellipseMatrix\n", + "import time\n", + "from matplotlib.patches import Ellipse\n", + "from pylab import figure, show, rand" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%run -p test_packing.py" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "0 50.0 184304.092036\n", + "1 38.0 183802.842426\n", + "2 29.0 183302.956059\n", + "3 22.0 182804.429226\n", + "4 17.0 182307.258231\n", + "5" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 13.0 181811.439386\n", + "6" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 10.0 181316.969013\n", + "7" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 7.0 180823.843445\n", + "8" + ] + } + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "print \"draw\"\n", + "start = time.time()\n", + "\n", + "for c in Objs:\n", + " ellipseMatrix(c.y(), c.x(), c.a(), c.b(), c.theta(), Image, Label, XX, YY)\n", + " \n", + "print time.time()-start" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "plt.figure()\n", + "plt.imshow(Image)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ells = [Ellipse(xy=[c.x(), c.y()], width=2*c.a(), height=2*c.b(), angle=c.theta()*180.0/np.pi)\n", + " for c in Objs]\n", + "\n", + "fig = figure()\n", + "ax = fig.add_subplot(111, aspect='equal')\n", + "for e in ells:\n", + " ax.add_artist(e)\n", + " e.set_clip_box(ax.bbox)\n", + " #e.set_alpha(rand())\n", + " #e.set_facecolor([1.0,0,0])\n", + " #e.set_edgecolor([1.0,0,0])\n", + " e.set_facecolor(rand(3))\n", + " \n", + "ax.set_xlim(0, 2000)\n", + "ax.set_ylim(0, 2000)\n", + "\n", + "show()" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file