115 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			115 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| {
 | |
|  "metadata": {
 | |
|   "name": "",
 | |
|   "signature": "sha256:6886e71181444b36c7a33b59039603d34808e3af4a3cd70cd03670eb5d8d59b2"
 | |
|  },
 | |
|  "nbformat": 3,
 | |
|  "nbformat_minor": 0,
 | |
|  "worksheets": [
 | |
|   {
 | |
|    "cells": [
 | |
|     {
 | |
|      "cell_type": "code",
 | |
|      "collapsed": false,
 | |
|      "input": [
 | |
|       "%pylab inline"
 | |
|      ],
 | |
|      "language": "python",
 | |
|      "metadata": {},
 | |
|      "outputs": [
 | |
|       {
 | |
|        "output_type": "stream",
 | |
|        "stream": "stdout",
 | |
|        "text": [
 | |
|         "Populating the interactive namespace from numpy and matplotlib\n"
 | |
|        ]
 | |
|       }
 | |
|      ],
 | |
|      "prompt_number": 1
 | |
|     },
 | |
|     {
 | |
|      "cell_type": "code",
 | |
|      "collapsed": false,
 | |
|      "input": [
 | |
|       "boards = ['odroid', 'pi', 'dell']\n",
 | |
|       "pythons = ['3.4.1', '2.7.8', 'pypy-2.3.1']"
 | |
|      ],
 | |
|      "language": "python",
 | |
|      "metadata": {},
 | |
|      "outputs": [],
 | |
|      "prompt_number": 2
 | |
|     },
 | |
|     {
 | |
|      "cell_type": "code",
 | |
|      "collapsed": false,
 | |
|      "input": [
 | |
|       "import os\n",
 | |
|       "\n",
 | |
|       "from collections import defaultdict\n",
 | |
|       "\n",
 | |
|       "cpu_usage = defaultdict(dict)\n",
 | |
|       "controller_rw_time = defaultdict(dict)\n",
 | |
|       "\n",
 | |
|       "packet = defaultdict(lambda: defaultdict(dict))\n",
 | |
|       "\n",
 | |
|       "for b in boards:  \n",
 | |
|       "    for p in pythons:\n",
 | |
|       "        bp = os.path.join('res', b, p)\n",
 | |
|       "        \n",
 | |
|       "        l = eval(open(os.path.join(bp, 'robot.list')).read())\n",
 | |
|       "        cpu_usage[b][p] = array(l)\n",
 | |
|       "        \n",
 | |
|       "        l = eval(open(os.path.join(bp, 'dxl_controller.list')).read())\n",
 | |
|       "        controller_rw_time[b][p] = array(l)\n",
 | |
|       "        \n",
 | |
|       "        for s in ['serial', 'forged', 'pypot']:\n",
 | |
|       "            l = eval(open(os.path.join(bp, 'dxl_single', 'rw_{}.list'.format(s))).read())\n",
 | |
|       "            packet[s][b][p] = array(l)"
 | |
|      ],
 | |
|      "language": "python",
 | |
|      "metadata": {},
 | |
|      "outputs": [],
 | |
|      "prompt_number": 3
 | |
|     },
 | |
|     {
 | |
|      "cell_type": "code",
 | |
|      "collapsed": false,
 | |
|      "input": [
 | |
|       "data = {\n",
 | |
|       "    'cpu_usage': dict(cpu_usage),\n",
 | |
|       "    'controller_rw_time': dict(controller_rw_time),\n",
 | |
|       "    'packet': dict(packet)\n",
 | |
|       "}"
 | |
|      ],
 | |
|      "language": "python",
 | |
|      "metadata": {},
 | |
|      "outputs": []
 | |
|     },
 | |
|     {
 | |
|      "cell_type": "code",
 | |
|      "collapsed": false,
 | |
|      "input": [
 | |
|       "import pickle\n",
 | |
|       "\n",
 | |
|       "# get the file here: https://github.com/poppy-project/pypot/releases/download/2.4.0/data.pickle",
 | |
|       "with open('data.pickle', 'wb') as f:\n",
 | |
|       "    pickle.dump(data, f)"
 | |
|      ],
 | |
|      "language": "python",
 | |
|      "metadata": {},
 | |
|      "outputs": []
 | |
|     },
 | |
|     {
 | |
|      "cell_type": "code",
 | |
|      "collapsed": false,
 | |
|      "input": [],
 | |
|      "language": "python",
 | |
|      "metadata": {},
 | |
|      "outputs": []
 | |
|     }
 | |
|    ],
 | |
|    "metadata": {}
 | |
|   }
 | |
|  ]
 | |
| }
 |