{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# TriScale Interactive Plots\n", "\n", "This notebook generates and displays all the plots from the _TriScale_ paper.\n", "By default, large versions of the plots are shown. To exactly reproduce the plots from the paper, set `PaperPlots=True` in the first cell.\n", "\n", "- [Figure 1](#Figure-1)\n", " - [Figure 1.a](#Figure-1a)\n", " - [Figure 1.b](#Figure-1b)\n", "- [Figure 3](#Figure-3)\n", " - [Figure 3.a](#Figure-3a)\n", " - [Figure 3.b](#Figure-3b)\n", " - [Figure 3.c](#Figure-3c)\n", "- [Figure 4](#Figure-4)\n", "- [Figure 5](#Figure-5)\n", "- [Figure 7](#Figure-7)\n", "- [Figure 8](#Figure-8)\n", "- [Figure 9](#Figure-9)\n", "- [Figure 10](#Figure-10)\n", "\n", "---" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Set to False to view larger versions of the plots\n", "# Set to True to reproduce the exact plots from the paper\n", "PaperPlot = False" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import copy\n", "import json\n", "import os\n", "from pathlib import Path\n", "import yaml\n", "import zipfile\n", "\n", "import numpy as np\n", "import pandas as pd\n", "import plotly.graph_objects as go\n", "import plotly.io as pio\n", "pio.renderers.default = \"notebook\"\n", "\n", "import triscale\n", "import triplots" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "## Download Source Files and Data\n", "[[Back to top](#TriScale)]\n", "\n", "The entire dataset for this case study is available on Zenodo: \n", "\n", "[](https://doi.org/10.5281/zenodo.3451417)\n", "\n", "The wget commands below download the required files to reproduce this case study.\n", "> **The .zip file is ~2.7 GB**" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Nothing to download\n" ] } ], "source": [ "# Set `download = True` to download (and extract) the data from this case study\n", "# Eventually, adjust the record_id for the file version you are interested in.\n", "\n", "# For reproducing the original TriScale paper, set `record_id = 3666724`\n", "\n", "download = False\n", "record_id = 3666724 # v3.0.1 (https://doi.org/10.5281/zenodo.3666724)\n", "\n", "files= ['UseCase_Pantheon.zip',\n", " 'UseCase_Glossy.zip'\n", " 'UseCase_VideoStreaming.zip'\n", " 'UseCase_FailureDetection.zip']\n", "if download:\n", " for file in files:\n", " print(file)\n", " url = 'https://zenodo.org/record/'+str(record_id)+'/files/'+file \n", " os.system('wget %s' %url)\n", " if file[-4:] == '.zip': \n", " with zipfile.ZipFile(file,\"r\") as zip_file:\n", " zip_file.extractall()\n", " print('Done.')\n", "else: \n", " print('Nothing to download')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "import UseCase_Pantheon.pantheon as pantheon\n", "import UseCase_Glossy.flocklab as flocklab\n", "import UseCase_VideoStreaming.videostreaming as vs\n", "import UseCase_FailureDetection.failuredetection as fd" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "# Select the different output format settings\n", "\n", "if PaperPlot:\n", " output_format = 'CCR'\n", "else:\n", " output_format = 'online'\n", "\n", "if output_format == 'online':\n", " font_size_px = 14\n", " linewidth_px = 512\n", " landscapewidth_px = 654\n", " plot_path = None\n", " \n", " plot_path = Path('plots')\n", "\n", "if output_format == 'CCR':\n", " font_size_pt = 7\n", " offset = 5 # to compensate for the rounding of unit conversions\n", " linewidth_pt = 241 - offset \n", " landscapewidth_pt = 506 - offset\n", " \n", " # 1pt = 1.333px\n", " font_size_px = int(font_size_pt*1.333)+1\n", " linewidth_px = int(linewidth_pt*1.333)+1\n", " landscapewidth_px = int(landscapewidth_pt*1.333)+1\n", "\n", " plot_path = Path('plots_ccr')\n", " \n", "# Create plot directory if don't exist\n", "if (plot_path is not None) and not (os.path.exists(plot_path)):\n", " os.mkdir(plot_path)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Figure 1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Figure 1a" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "