Simu: update code to use new location of lib

This commit is contained in:
Eric Teunis de Boone 2022-06-27 16:28:07 +02:00
parent 6763bbc64c
commit 9ed9b25db5
2 changed files with 10 additions and 4 deletions

View file

@ -15,7 +15,12 @@
"source": [
"import numpy as np\n",
"\n",
"import matplotlib.pyplot as plt"
"import matplotlib.pyplot as plt\n",
"\n",
"import os\n",
"import sys\n",
"# Append parent directory to import path so lib can be found\n",
"sys.path.append(os.path.dirname(os.path.abspath(os.getcwd())))"
]
},
{

View file

@ -50,7 +50,7 @@
"def distance(x, y = emit_location):\n",
" return np.sqrt( np.sum((x - y)**2, axis=-1) )\n",
"\n",
"actual_err_timings = rng.random(N)\n",
"actual_err_timings = 2 * rng.random(N) - 1\n",
"if not True:\n",
" # undo timing errors\n",
" actual_err_timings = np.zeros_like(actual_err_timings)\n",
@ -132,10 +132,11 @@
"# plot\n",
"if True:\n",
" fig, ax = plt.subplots()\n",
" ax.plot(distance(locations, 0), actual_timings, 'o')\n",
" ax.plot(distance(locations, 0), timings, 'o')\n",
" ax.plot(distance(locations, 0), actual_timings, 'o', label='actual')\n",
" ax.plot(distance(locations, 0), timings, 'o', label='with errors' )\n",
" ax.set_xlabel(\"Distance\")\n",
" ax.set_ylabel(\"Timing\")\n",
" ax.legend()\n",
" plt.show();"
]
},