{ "cells": [ { "cell_type": "code", "execution_count": 105, "metadata": {}, "outputs": [], "source": [ "import math\n", "import statistics\n", "import json\n", "\n", "import numpy as np\n", "from matplotlib import pyplot as plt\n", "import matplotlib as mpl\n", "import tqdm" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "%matplotlib notebook" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "#from math import nan, inf\n", "#data = {'dec_proto_am_ber_top.py': ([1.0, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9, 4.7, 5.6, 6.8, 8.2, 10.0, 12.0, 15.0, 18.0, 22.0, 27.0, 33.0, 39.0, 47.0, 56.0, 68.0, 82.0, 100.0, 120.0, 150.0, 180.0, 220.00000000000003, 270.0, 330.0, 390.0, 470.0, 560.0, 680.0, 819.9999999999999], [-1.1706362050026655, -1.193387892562896, -1.2494141100905836, -1.273546683602035, -1.3226867043413222, -1.3284842972643673, -1.4249085476621985, -2.4881654670462012, -2.9280282892286777, -1.8337596086785197, -3.4516299068927765, -3.6739503433927894, -3.85142894461751, -4.2109690103679895, -4.841764334589243, -5.121118910610676, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf, -inf], [0.000562024584446438, 0.002583366143280799, 0.003536123538459578, 0.0060136203314800725, 0.0017120634851061035, 0.01202664019209608, 0.009352711681458127, 0.010626429313400118, 0.0031605552412962345, 0.07580074150906693, 0.008303067934118849, 0.010968003992851543, 0.010921403354231309, 0.014436211616218221, 0.045257276108434545, 0.05063300417965297, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan]), 'dec_proto_am_dc_ber_top.py': ([1.0, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9, 4.7, 5.6, 6.8, 8.2, 10.0, 12.0, 15.0, 18.0, 22.0, 27.0, 33.0, 39.0, 47.0, 56.0, 68.0, 82.0, 100.0, 120.0, 150.0, 180.0, 220.00000000000003, 270.0, 330.0, 390.0, 470.0, 560.0, 680.0, 819.9999999999999], [-1.208226392045617, -1.2001309534534812, -1.2082590111531317, -1.2057580375112593, -1.214704089694553, -1.231758143831406, -1.2328452042170934, -1.2342556988606688, -1.2555496906861663, -1.2633800823241472, -1.2801077286712825, -1.292429564986378, -1.2502315024699062, -1.2731027859982436, -1.3264964096914462, -1.350060076963517, -1.402916835230801, -1.6361557068303227, -1.3996004345826805, -2.025891115888953, -2.2259163050377957, -2.403329889470167, -2.5532801901852644, -2.6723825335502625, -2.7451475376985512, -2.7838943274880226, -2.7973828878928355, -2.8114503007382154, -2.7500487601808214, -2.7576294792325875, -2.7531131004032336, -2.771351588479543, -2.763352069271704, -2.7856492625232554, -2.8089246354122395, -2.805404500961304], [0.0006223969511333752, 0.001109700896962153, 0.00210398864758181, 0.0009171589283670842, 0.01005799259051457, 0.01198940071540007, 0.013730311872618627, 0.020358273695306007, 0.019376830251761356, 0.02698367824924875, 0.03015560422449139, 0.04189253434399468, 0.04626542022859063, 0.07217384274518368, 0.08584595043975161, 0.12539079396237413, 0.09791907379447246, 0.10581626829587948, 0.18250650933422224, 0.07591527055792387, 0.20120497031325296, 0.2529568393261202, 0.3140587593946733, 0.3626712973758648, 0.39454531783086805, 0.40694947364033235, 0.4101018950589088, 0.38136874448954844, 0.4108311426740005, 0.40839715897167816, 0.4083367927775933, 0.40823628264400785, 0.4080951641200549, 0.40959607776701595, 0.40969886669408834, 0.4099477409126599]), 'dec_proto_fm_ber_top.py': ([1.0, 1.2, 1.5, 1.8, 2.2, 2.7, 3.3, 3.9, 4.7, 5.6, 6.8, 8.2, 10.0, 12.0, 15.0, 18.0, 22.0, 27.0, 33.0, 39.0, 47.0, 56.0, 68.0, 82.0, 100.0, 120.0, 150.0, 180.0, 220.00000000000003, 270.0, 330.0, 390.0, 470.0, 560.0, 680.0, 819.9999999999999], [-1.3057961403392255, -1.3484294968657196, -1.4667961434461176, -2.8690875116735697, -1.6547222812660038, -1.3891625558026135, -3.5982019547373056, -3.771391890011728, -4.029223203659058, -4.187133187428117, -4.5257152915000916, -4.8291374538093805, -4.9882102105766535, -4.988903861492872, -4.977243402972817, -4.991583617404103, -4.978662932291627, -4.995597720146179, -4.980234434828162, -4.898328188806772, -4.886065758764744, -4.892892232164741, -4.887955756857991, -4.894121825695038, -4.874834077432752, -4.881909834221005, -4.885749246925116, -4.879474958404899, -4.893610496073961, -4.893589161336422, -4.900892127305269, -4.89244575984776, -4.886744260787964, -4.895636919885874, -4.909515650942922, -4.8994301706552505], [0.014213245118859085, 0.001330722343276248, 0.013951488821076687, 0.0041134580502828425, 0.038365233682153145, 0.030733212747131068, 0.0091992661239188, 0.010529797577944408, 0.014647350039240111, 0.014036738695564741, 0.0201667482688038, 0.03195929762792339, 0.050554225347760565, 0.05155121488079693, 0.05696637316379902, 0.05194819962648275, 0.04815391425232906, 0.04198674248536032, 0.0531488148233794, 0.043095657257340825, 0.05140641385191975, 0.047935496094956176, 0.05329373773860191, 0.05040869503181174, 0.05644083328947176, 0.053389328604204575, 0.05074839526504205, 0.053625197798602975, 0.047252304573416753, 0.051310379811370974, 0.046438087027853785, 0.05365724267638675, 0.0534321058650641, 0.04956836848859283, 0.04218369035098332, 0.05032427561533336])}" ] }, { "cell_type": "code", "execution_count": 54, "metadata": { "scrolled": true }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "75ad09f7b6df4c1aa68ef78b1e4ceb0a", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(IntProgress(value=0, max=380), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Will launch 450 simulation jobs in 38 batches of 12\n", "Starting batch 1/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 2/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 3/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 4/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 5/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 6/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 7/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 8/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 9/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 10/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 11/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 12/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 13/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 14/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 15/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 16/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 17/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 18/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 19/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 20/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 21/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 22/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 23/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 24/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 25/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 26/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 27/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 28/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 29/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 30/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 31/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 32/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 33/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 34/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 35/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 36/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 37/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "Starting batch 38/38...\n", "done.\n", "Waiting for simulation:\n", "Terminating processes...\n", "done.\n", "Processing simulation results\n", "\n" ] } ], "source": [ "import sweep_gr_sims\n", "data = sweep_gr_sims.run_simulation(\n", " amplitudes = [10**x for x in np.linspace(0, 2.5, 30)],\n", " #simulations=['dec_proto_am_ber_top.py'],\n", " duration=10.0,\n", " forklimit=12,\n", " repeat_runs=5,\n", " tqdm=tqdm.tqdm_notebook)" ] }, { "cell_type": "code", "execution_count": 76, "metadata": {}, "outputs": [], "source": [ "#with open('gr_sweep_results2.json', 'w') as f:\n", "# f.write(json.dumps(data))" ] }, { "cell_type": "code", "execution_count": 148, "metadata": {}, "outputs": [], "source": [ "with open('results_digitalocean2.json') as f:\n", " data = json.loads(f.read())\n", " for sim in list(data):\n", " data[sim] = {\n", " float(a): entry for a, entry in data[sim].items()\n", " }" ] }, { "cell_type": "code", "execution_count": 73, "metadata": {}, "outputs": [], "source": [ "labels = {\n", " 'dec_proto_am_dc_ber_top.py': '\"DC\"',\n", " 'dec_proto_am_ber_top.py': 'ASK',\n", " 'dec_proto_fm_ber_top.py': 'FSK'\n", "}" ] }, { "cell_type": "code", "execution_count": 150, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/javascript": [ "/* Put everything inside the global mpl namespace */\n", "window.mpl = {};\n", "\n", "\n", "mpl.get_websocket_type = function() {\n", " if (typeof(WebSocket) !== 'undefined') {\n", " return WebSocket;\n", " } else if (typeof(MozWebSocket) !== 'undefined') {\n", " return MozWebSocket;\n", " } else {\n", " alert('Your browser does not have WebSocket support.' +\n", " 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n", " 'Firefox 4 and 5 are also supported but you ' +\n", " 'have to enable WebSockets in about:config.');\n", " };\n", "}\n", "\n", "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n", " this.id = figure_id;\n", "\n", " this.ws = websocket;\n", "\n", " this.supports_binary = (this.ws.binaryType != undefined);\n", "\n", " if (!this.supports_binary) {\n", " var warnings = document.getElementById(\"mpl-warnings\");\n", " if (warnings) {\n", " warnings.style.display = 'block';\n", " warnings.textContent = (\n", " \"This browser does not support binary websocket messages. \" +\n", " \"Performance may be slow.\");\n", " }\n", " }\n", "\n", " this.imageObj = new Image();\n", "\n", " this.context = undefined;\n", " this.message = undefined;\n", " this.canvas = undefined;\n", " this.rubberband_canvas = undefined;\n", " this.rubberband_context = undefined;\n", " this.format_dropdown = undefined;\n", "\n", " this.image_mode = 'full';\n", "\n", " this.root = $('
');\n", " this._root_extra_style(this.root)\n", " this.root.attr('style', 'display: inline-block');\n", "\n", " $(parent_element).append(this.root);\n", "\n", " this._init_header(this);\n", " this._init_canvas(this);\n", " this._init_toolbar(this);\n", "\n", " var fig = this;\n", "\n", " this.waiting = false;\n", "\n", " this.ws.onopen = function () {\n", " fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n", " fig.send_message(\"send_image_mode\", {});\n", " if (mpl.ratio != 1) {\n", " fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n", " }\n", " fig.send_message(\"refresh\", {});\n", " }\n", "\n", " this.imageObj.onload = function() {\n", " if (fig.image_mode == 'full') {\n", " // Full images could contain transparency (where diff images\n", " // almost always do), so we need to clear the canvas so that\n", " // there is no ghosting.\n", " fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n", " }\n", " fig.context.drawImage(fig.imageObj, 0, 0);\n", " };\n", "\n", " this.imageObj.onunload = function() {\n", " fig.ws.close();\n", " }\n", "\n", " this.ws.onmessage = this._make_on_message_function(this);\n", "\n", " this.ondownload = ondownload;\n", "}\n", "\n", "mpl.figure.prototype._init_header = function() {\n", " var titlebar = $(\n", " '
');\n", " var titletext = $(\n", " '
');\n", " titlebar.append(titletext)\n", " this.root.append(titlebar);\n", " this.header = titletext[0];\n", "}\n", "\n", "\n", "\n", "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n", "\n", "}\n", "\n", "\n", "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n", "\n", "}\n", "\n", "mpl.figure.prototype._init_canvas = function() {\n", " var fig = this;\n", "\n", " var canvas_div = $('
');\n", "\n", " canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n", "\n", " function canvas_keyboard_event(event) {\n", " return fig.key_event(event, event['data']);\n", " }\n", "\n", " canvas_div.keydown('key_press', canvas_keyboard_event);\n", " canvas_div.keyup('key_release', canvas_keyboard_event);\n", " this.canvas_div = canvas_div\n", " this._canvas_extra_style(canvas_div)\n", " this.root.append(canvas_div);\n", "\n", " var canvas = $('');\n", " canvas.addClass('mpl-canvas');\n", " canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n", "\n", " this.canvas = canvas[0];\n", " this.context = canvas[0].getContext(\"2d\");\n", "\n", " var backingStore = this.context.backingStorePixelRatio ||\n", "\tthis.context.webkitBackingStorePixelRatio ||\n", "\tthis.context.mozBackingStorePixelRatio ||\n", "\tthis.context.msBackingStorePixelRatio ||\n", "\tthis.context.oBackingStorePixelRatio ||\n", "\tthis.context.backingStorePixelRatio || 1;\n", "\n", " mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n", "\n", " var rubberband = $('');\n", " rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n", "\n", " var pass_mouse_events = true;\n", "\n", " canvas_div.resizable({\n", " start: function(event, ui) {\n", " pass_mouse_events = false;\n", " },\n", " resize: function(event, ui) {\n", " fig.request_resize(ui.size.width, ui.size.height);\n", " },\n", " stop: function(event, ui) {\n", " pass_mouse_events = true;\n", " fig.request_resize(ui.size.width, ui.size.height);\n", " },\n", " });\n", "\n", " function mouse_event_fn(event) {\n", " if (pass_mouse_events)\n", " return fig.mouse_event(event, event['data']);\n", " }\n", "\n", " rubberband.mousedown('button_press', mouse_event_fn);\n", " rubberband.mouseup('button_release', mouse_event_fn);\n", " // Throttle sequential mouse events to 1 every 20ms.\n", " rubberband.mousemove('motion_notify', mouse_event_fn);\n", "\n", " rubberband.mouseenter('figure_enter', mouse_event_fn);\n", " rubberband.mouseleave('figure_leave', mouse_event_fn);\n", "\n", " canvas_div.on(\"wheel\", function (event) {\n", " event = event.originalEvent;\n", " event['data'] = 'scroll'\n", " if (event.deltaY < 0) {\n", " event.step = 1;\n", " } else {\n", " event.step = -1;\n", " }\n", " mouse_event_fn(event);\n", " });\n", "\n", " canvas_div.append(canvas);\n", " canvas_div.append(rubberband);\n", "\n", " this.rubberband = rubberband;\n", " this.rubberband_canvas = rubberband[0];\n", " this.rubberband_context = rubberband[0].getContext(\"2d\");\n", " this.rubberband_context.strokeStyle = \"#000000\";\n", "\n", " this._resize_canvas = function(width, height) {\n", " // Keep the size of the canvas, canvas container, and rubber band\n", " // canvas in synch.\n", " canvas_div.css('width', width)\n", " canvas_div.css('height', height)\n", "\n", " canvas.attr('width', width * mpl.ratio);\n", " canvas.attr('height', height * mpl.ratio);\n", " canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n", "\n", " rubberband.attr('width', width);\n", " rubberband.attr('height', height);\n", " }\n", "\n", " // Set the figure to an initial 600x600px, this will subsequently be updated\n", " // upon first draw.\n", " this._resize_canvas(600, 600);\n", "\n", " // Disable right mouse context menu.\n", " $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n", " return false;\n", " });\n", "\n", " function set_focus () {\n", " canvas.focus();\n", " canvas_div.focus();\n", " }\n", "\n", " window.setTimeout(set_focus, 100);\n", "}\n", "\n", "mpl.figure.prototype._init_toolbar = function() {\n", " var fig = this;\n", "\n", " var nav_element = $('
')\n", " nav_element.attr('style', 'width: 100%');\n", " this.root.append(nav_element);\n", "\n", " // Define a callback function for later on.\n", " function toolbar_event(event) {\n", " return fig.toolbar_button_onclick(event['data']);\n", " }\n", " function toolbar_mouse_event(event) {\n", " return fig.toolbar_button_onmouseover(event['data']);\n", " }\n", "\n", " for(var toolbar_ind in mpl.toolbar_items) {\n", " var name = mpl.toolbar_items[toolbar_ind][0];\n", " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n", " var image = mpl.toolbar_items[toolbar_ind][2];\n", " var method_name = mpl.toolbar_items[toolbar_ind][3];\n", "\n", " if (!name) {\n", " // put a spacer in here.\n", " continue;\n", " }\n", " var button = $('