diff --git a/simulations/03_emitter_receiver_simulation.ipynb b/simulations/03_emitter_receiver_simulation.ipynb index 9210294..0f026a9 100644 --- a/simulations/03_emitter_receiver_simulation.ipynb +++ b/simulations/03_emitter_receiver_simulation.ipynb @@ -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())))" ] }, { diff --git a/simulations/04_recover_timing_errors.ipynb b/simulations/04_recover_timing_errors.ipynb index 6e7359a..4e20076 100644 --- a/simulations/04_recover_timing_errors.ipynb +++ b/simulations/04_recover_timing_errors.ipynb @@ -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();" ] },