m-thesis-introduction/simulations/03_emitter_receiver_simulation.ipynb

246 lines
62 KiB
Text
Raw Normal View History

2022-03-07 18:34:26 +01:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Emitter/Receiver Simulation with Signals"
]
},
{
"cell_type": "code",
2022-03-10 14:59:35 +01:00
"execution_count": 1,
2022-03-07 18:34:26 +01:00
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
2022-03-10 14:59:35 +01:00
"import matplotlib.pyplot as plt"
2022-03-07 18:34:26 +01:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Signal"
]
},
{
"cell_type": "code",
2022-03-10 14:59:35 +01:00
"execution_count": 2,
2022-03-07 18:34:26 +01:00
"metadata": {},
"outputs": [],
"source": [
2022-03-10 15:41:09 +01:00
"from lib import TravelSignal\n",
2022-03-07 18:34:26 +01:00
"\n",
2022-03-10 14:59:35 +01:00
"####\n",
"from scipy.stats import norm\n",
2022-03-07 18:34:26 +01:00
"\n",
2022-03-10 14:59:35 +01:00
"sample_rate = 3e2 # Hz\n",
"interp_sample_rate = sample_rate * 1/10 # Hz\n",
"\n",
"t_offset = 8\n",
"periodic = False\n",
"\n",
"time = t_offset + np.arange(0, 1, 1/sample_rate) #s\n",
"time2 = t_offset + np.arange(-1.5, 1, 1/sample_rate) #s\n",
"\n",
"signal = norm.pdf(time, time[len(time)//2], (time[-1] - time[0])/10)\n",
"\n",
"if False:\n",
" mysignal = TravelSignal(signal, sample_rate, t_0 = t_offset, periodic=True)\n",
" mysignal2 = TravelSignal(signal, sample_rate, t_0 = t_offset, periodic=False)\n",
"\n",
" fig, ax = plt.subplots(1, 1, figsize=(16,4))\n",
" ax.set_title(\"Raw and TravelSignal\")\n",
" ax.set_ylabel(\"Amplitude\")\n",
" ax.set_xlabel(\"Time\")\n",
"\n",
" ax.plot(time, signal, label='Raw signal')\n",
" ax.plot(time2, mysignal(time2)+0.5, '.-', label='TravelSignal(periodic)+0.5')\n",
" ax.plot(time2, mysignal2(time2)-0.5, '.-', label='TravelSignal-0.5')\n",
"\n",
" ax.legend()\n",
"\n",
" plt.show();"
2022-03-07 18:34:26 +01:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## New code"
]
},
{
"cell_type": "code",
2022-03-10 14:59:35 +01:00
"execution_count": 3,
2022-03-07 18:34:26 +01:00
"metadata": {},
"outputs": [],
"source": [
2022-03-10 15:41:09 +01:00
"from lib.location import Receiver, Emitter"
2022-03-10 14:59:35 +01:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Testing"
]
},
{
"cell_type": "code",
2022-03-10 15:41:09 +01:00
"execution_count": 4,
2022-03-10 14:59:35 +01:00
"metadata": {},
2022-03-10 17:38:54 +01:00
"outputs": [],
2022-03-10 14:59:35 +01:00
"source": [
"if True:\n",
" sample_rate = 3e2 # Hz\n",
" periodic = False\n",
" \n",
2022-03-10 17:38:54 +01:00
" t_offset = -0.5\n",
2022-03-10 14:59:35 +01:00
" t_start = 0\n",
" t_end = 1\n",
" time = t_offset + np.arange(t_start, t_end, 1/sample_rate) #s\n",
"\n",
"if False:\n",
" if True:\n",
2022-03-10 17:38:54 +01:00
" periodic = True\n",
2022-03-10 14:59:35 +01:00
" freq = sample_rate/8\n",
" signal = np.cos(2*np.pi*freq*time)\n",
" else: \n",
" from scipy.stats import norm\n",
" signal = norm.pdf(time, time[len(time)//2], (time[-1] - time[0])/10)\n",
"\n",
"\n",
"#####\n",
"# Setup Signal, Emitter and Antennae\n",
"\n",
2022-03-10 17:38:54 +01:00
"rot = lambda phi=0.12345: np.cos(np.array([phi, phi-np.pi/2]))\n",
"\n",
"km=1e7\n",
"\n",
2022-03-10 14:59:35 +01:00
"mysignal = TravelSignal(signal, sample_rate, t_0 = t_offset, periodic=periodic)\n",
"\n",
2022-03-10 17:38:54 +01:00
"source = Emitter([0,0])*km\n",
2022-03-10 14:59:35 +01:00
"emitted = source.emit(mysignal)\n",
"\n",
"antennae = [\n",
2022-03-10 17:38:54 +01:00
" Receiver(2*km*rot(0)),\n",
" Receiver(3*km*rot(2)),\n",
" Receiver(10*km*rot(1)),\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAACqCAYAAACEYlLKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAVI0lEQVR4nO2debhWVb3HP18gBkEpBXEGNSeUUCOHtDpomVD36n3SeyFSU8occLjpc62u+limZreupeZAZlczJW5JUdd5QC0RAUURcUA9CiKTisggivzuH2u9sN28531fDu909v59nud9zt57/fZav7X2/u417H3WkpnhOE626dRoBxzHqT0udMfJAS50x8kBLnTHyQEudMfJAS50x8kBLvQaImkPSU9KelfSmTVO6weSbqhlGjGdbpKelbRNGbtPSXq01v4k0vumpL/XK72ORlWELmmEpCmSVkhaFLdPk6RqxF8tJLVK+mIdk/wPYJKZbW5mVxbxZ5Kk9yQtT/z+2p6EzOxSM/tWjHeAJJPUJZFWtYRwMvCwmS0o48/TwFJJ/1SFNKuCpJ6xjO/YyPNaJM2rlV/1YJOFLukc4JfAfwHbAP2AU4BDgK6bGn89SQqjSvQHZpWxGWNmvRK/phFGkkTZfAf4XYWn/T7aNwvHAKuBIyRt22hn6oqZtfsH9AZWAF8rY9cN+BnwGrAQuA7okQj/NjAHeAuYCGyXCDPgNOBF4F3gYmBXYDKwDBgPdE3YfxWYASwFHgU+FY//DlgLrAKWE2rbATH+0dG3h4H/A85I+f80cHQbeftngpiXApOAveLxB4APgfdiersXOXcS8K024m0B5kU/FwFvAEcDw4EXYln9IGF/EXBL3H4t5mt5/B0c/fgw7i8td10S6Z8HLIjlt1Msvy6JdIcDz8Zr8zpwbiJs+2jfrY08ngjMjue+DHynSP7PS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2aGp4wOAv5nZPpK2AJ43szbfyUp6Eji9XNOqoxBbXU8SBqLeKGE3CBhrZuk+u9MA/BPYIkjajPDufmwpOzNbBrxSaDrF7sLgRDx7EF45Ta6hu3XFzFab2cBSIo92M13kzYMLPUXsoy4mNJtuTYXdRhDtHpLmSRpNaJ6OlvQUoWmc7KeNBMaZN5ucBuNNd8fJAV6jO04OcKE7Tg6o9n9rZZI+ffrYgAEDGu0GK1asoGfPno12o+rUOl/Tp09fYmZ9y1tmFxd6BQwYMIBp06Y12g0mTZpES0tLo92oOrXOl6Ryn8dmHm+6O04OcKE7Tg5woTtODnChO04OcKE7Tcfiq65utAuZw4XuNB1LfvWrRruQOVzojpMDXOhOU7D4qquZvedezN5zL4B1296Mrw7+wYzTFPQ9Ywx9zxgDBJHv9dzsBnuULbxGd5wc4EJ3mo4+p5/eaBcyhwvdaToKTXinerjQHScHZEroCssUz0j8lkk6O2XTIumdhM2FjfLXcepFpkbdzex5wpzdSOpMmI55QhHTR8zsq/X0zXEaSaZq9BSHAy+ZWe7/F9lxsiz0EbS9DNLBkp6SdGdhxQvHyTKZnAU2Ljs0n7Cu2MJU2BbAWjNbLmk48Esz261IHCcDJwP069fv0+PGjauD56VZvnw5vXq1d03F5qXW+Ro6dOh0MxtSswQ6AFkV+lGE1VHKruUlqZWwCP2StmyGDBliPpVU7ajDVFK5F3pWm+5trl4qaRtJitsHEMrgzTr65jh1J1Oj7rBuOaUvAd9JHDsFwMyuA44BTpW0hrBs8AhfScXJOpkTelxJdKvUsesS21cTVlt1nNyQ1aa74zgJXOiOkwNc6I6TA1zojpMDXOiOkwNc6I6TA1zojpMDXOiOkwNc6I6TA1zojpMDXOiOkwNc6I6TA1zojpMDXOiOkwNc6I6TA1zojpMDXOiOkwNc6I6TAzIndEmtkmbG5ZY2mLp
"text/plain": [
"<Figure size 144x144 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"########\n",
"### Geometry Plot\n",
"########\n",
2022-03-10 14:59:35 +01:00
"ylabel_kw = {\"rotation\": \"horizontal\", \"va\":\"center\", \"ha\":\"center\", \"labelpad\": 30}\n",
"\n",
"fig, axs = plt.subplots(1,1, figsize=(2,2))\n",
"axs = [ axs ]\n",
"i = 0\n",
2022-03-10 17:38:54 +01:00
"axs[i].grid()\n",
2022-03-10 14:59:35 +01:00
"axs[i].set_title(\"Geometry of Emitter(s) and Antennae\")\n",
2022-03-10 17:38:54 +01:00
"axs[i].set_ylabel(\"y (m)\", **ylabel_kw)\n",
"axs[i].set_xlabel(\"x (m)\")\n",
2022-03-10 14:59:35 +01:00
"axs[i].plot(*source.x, '*', label=\"Emitter\")\n",
"\n",
"for j, ant in enumerate(antennae):\n",
" axs[i].plot(*ant.x, '+', label=\"Antenna {}\".format(j))\n",
"\n",
2022-03-10 17:38:54 +01:00
"# make it a square plot\n",
"axs[i].set_aspect('equal', 'datalim')\n",
"axs[i].margins(0.1)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1IAAAGDCAYAAAAh2yGkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nOzdd3xW5fnH8c+VSdh7b0GRLURAsQ60okLdCqhFrVatWkXram1rf87auheK27pQrIKidU8EJGzZGyJ7hTAyn+v3xznBGBI2OUn4vl+vvHKec859n+9zEvG5cp9zH3N3REREREREZPfFRR1ARERERESkvFEhJSIiIiIisodUSImIiIiIiOwhFVIiIiIiIiJ7SIWUiIiIiIjIHlIhJSIiIiIisodUSImIiOwFM6tsZqPNLMPM3jjAxzrezGYcyGMcaGb2nZldEnUOEZH9RYWUiIiUCjPbXOgrZmbbCr2+MOp8e2EAUBuo4+6Dim40s7vNLLfI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1RISZni7l/tajRKpDyY/MmrNH3vHPJIYNX579Pj3BuxuH37J7dSShV6XT2MSb0epUXuAvKePoElsyftp8QiIiKyJ1RIiYjsZ2kfDKPTmD+yLLElSX/4ilYdeu7X/rudcgnpZ/2XBHKp9uYZLJg+br/2LyIiIrumQkpEZD+aMPIpuk24hTnJHWh83SfUadD0gBynbddfse3CUeSSSN13zmb+1DEH5DgiIiJSPBVSIiL7yeRPXuWISbczs1IXWl//EVWr1zqgx2vWtgv5F3/INlKo+e4F/LRw1gE9noiIiPxMhZSIyH4wY8xo2o8ZwoLEtrS6diQpVUp
"text/plain": [
"<Figure size 864x432 with 4 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"t_longoffset = t_offset\n",
"t_longstart = t_start\n",
"t_longend = 2*t_end\n",
"longtime = t_longoffset + np.arange(t_longstart, t_longend, 1/sample_rate) #s\n",
"\n",
"########\n",
2022-03-10 14:59:35 +01:00
"### Plot Traces\n",
2022-03-10 17:38:54 +01:00
"########\n",
"\n",
"fig, axs = plt.subplots(1+len(antennae),1, sharex=True, figsize=(12,6), gridspec_kw={\"hspace\":0})\n",
2022-03-10 15:41:09 +01:00
"axs[0].set_title(\"Traces of Emitter and Antennae\")\n",
2022-03-10 14:59:35 +01:00
"\n",
"# Emitter\n",
"i = 0\n",
"axs[i].set_ylabel(\"Emitter\\n at ({},{})\".format(*source.x), **ylabel_kw)\n",
2022-03-10 17:38:54 +01:00
"axs[i].set_xlabel(\"Time (s)\")\n",
2022-03-10 14:59:35 +01:00
"axs[i].plot(time, emitted(time))\n",
2022-03-10 17:38:54 +01:00
"axs[i].plot(longtime, emitted(longtime))\n",
2022-03-10 14:59:35 +01:00
"\n",
"# Antenna\n",
"for j, ant in enumerate(antennae):\n",
" i +=1\n",
" axs[i].set_ylabel(\"Antenna {}\\n at ({},{})\".format(j, *ant.x), **ylabel_kw)\n",
" axs[i].plot(longtime, ant.recv(emitted)(longtime), label=\"Antenna {}\".format(j))\n",
2022-03-10 17:38:54 +01:00
" axs[i].set_xlabel(\"Time (s)\")\n",
2022-03-10 14:59:35 +01:00
" "
2022-03-07 18:34:26 +01:00
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}