{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# R2lab's radiomap" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Foreword on Jupyter notebooks" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### How to run a notebook" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**For people not familiar with notebooks**, let us simply stress that:\n", "\n", "* in order to evaluate a code cell, you first **select it** (click in it), and then press ***Shift-Enter*** - or, equivalent, click the right arrow button in the menubar. The next cell gets selected, so you can essentially run you way through the document by selecting the first cell, and then pressing ***Shift-Enter*** until you're done.\n", "\n", "* you can also run the whole notebook in a single click - although this is not the recommended technique - from the menubar with ***Cell → Run All***" ] }, { "cell_type": "markdown", "metadata": { "run_control": { "frozen": false, "read_only": false } }, "source": [ "### Where to run notebooks" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There are several ways to run a notebook:\n", "\n", "1. some public sites offer the ability to host notebooks; the present notebook for example \n", " \n", " can be run on mybinder.org\n", " \n", " \n", "1. you can also simply install jupyter on your own machine, and run the notebook from there; please refer to [Jupyter's installation instructions](http://jupyter.readthedocs.io/en/latest/install.html) for details." ] }, { "cell_type": "markdown", "metadata": { "run_control": { "frozen": false, "read_only": false } }, "source": [ "The method that you chose is important, because :\n", "\n", "* on the one hand, using a public infrastructure removes the burden of having to install anything, so you can start playing around right away;\n", "\n", "* however, your ssh private key is of course unreachable from mybinder or any other public infrastructure, so as far as actually triggering experiments on R2lab is concerned, you will not have the necessary credentials until you go for the second option. You can still use the visualisation tools though, as some pre-gathered data are part of the git repository." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*****" ] }, { "cell_type": "markdown", "metadata": { "run_control": { "frozen": false, "read_only": false } }, "source": [ "## Purpose" ] }, { "cell_type": "markdown", "metadata": { "run_control": { "frozen": false, "read_only": false } }, "source": [ "R2lab's radiomap is a set of measurements that act as a calibration of the testbed.\n", "The goal is to measure and visualize **received power** at **all node locations** \n", "when a radio signal is sent **from any given sender** node.\n", "\n", "Additionally, that same experiment can be carried out with **various settings** \n", "for the emitted signal, like emission power, Tx rate, channel frequency, \n", "and with various antenna setups (single antenna, multiple antennas)." ] }, { "cell_type": "markdown", "metadata": { "run_control": { "frozen": false, "read_only": false } }, "source": [ "## Workflow" ] }, { "cell_type": "markdown", "metadata": { "run_control": { "frozen": false, "read_only": false } }, "source": [ "End to end experiment involves 2 successive stages:\n", "\n", "1. **data acquisition** : per se, including post-processing (aggregation); this can be carried out with the `acquiremap.py` python script, or interactively through the first part of the present notebook; this of course requires at the very least a reservation in the testbed, and as pointed out above is unfortunately not possible from a publicly hosted notebook;\n", "1. **visualization** : interactively, through the second part of this notebook.\n", "\n", "For convenience, this git repository also contains a directory `datasample` that contains one (partial) dataset obtained by running the first-stage acquisition script, so that visualization can be performed right away, as a way to give a quick sense of the results. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# by default we want to use the pre-shipped data\n", "datadir = 'datasample'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*****" ] }, { "cell_type": "markdown", "metadata": { "run_control": { "frozen": false, "read_only": false } }, "source": [ "# Data acquisition with `acquiremap.py`" ] }, { "cell_type": "markdown", "metadata": { "run_control": { "frozen": false, "read_only": false } }, "source": [ "The àcquiremap.py`python script is designed to expose to the outside 3 levels of scenarios:\n", "\n", "* a `one_run` python function, that runs a complete set of measurements on all nodes, with a specific combination of environment settings (like transmission power, number of antennas, and similar)\n", "\n", "* a `all_runs` python function, that calls `one_run` with all possible values for the environment settings\n", "\n", "* the script itself, when invoked from the command-line, calls `all_runs` with the environment settings specified as command-line options.\n", "\n", "Additionally, all these functions can be instructed to perform node initializations (load a fresh image on all nodes, and turn off unused nodes). When this feature is turned on with in multiple-runs mode (be it from python or from the shell), nodes initialization is performed only once before the the first invokation of `one_run`." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Digression " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As a side note, we recommend using the following trick: " ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "run_control": { "frozen": false, "read_only": false } }, "outputs": [], "source": [ "# for convenience, we use this notebook extension\n", "# that will reload any imported python module\n", "# this is handy if you want to use a tex editor to\n", "# change the code in separate python files while you run the notebook\n", "%load_ext autoreload\n", "%autoreload 2\n", "import nest_asyncio\n", "nest_asyncio.apply()" ] }, { "cell_type": "markdown", "metadata": { "run_control": { "frozen": false, "read_only": false } }, "source": [ "## `one_run`" ] }, { "cell_type": "markdown", "metadata": { "run_control": { "frozen": false, "read_only": false } }, "source": [ "Back to data acquisition, the `one_run` python function performs data collection on a set of nodes (default is all nodes), for one given setting of the environment variables." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "run_control": { "frozen": false, "read_only": false } }, "outputs": [], "source": [ "from acquiremap import one_run" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "run_control": { "frozen": false, "read_only": false } }, "outputs": [], "source": [ "one_run(wireless_driver, tx_power, phy_rate, antenna_mask, channel, run_name='myradiomap', slicename='inria_admin', load_images=False, node_ids=None, parallel=None, verbose_ssh=False, verbose_jobs=False, dry_run=False)" ] }, { "cell_type": "markdown", "metadata": { "run_control": { "frozen": false, "read_only": false } }, "source": [ "The `one_run` function implements a scenario in which each node sends a number of ping packets to every other node.\n", "\n", "In addition, all nodes run a tcpdump process, and at the end of the run, \n", "every pcap file (called `fit