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-06-27 16:28:07 +02:00
|
|
|
"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())))"
|
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": {},
|
2022-03-21 14:09:44 +01:00
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA6YAAAEWCAYAAAB114q3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nOzdd3yUVbrA8d+ZSacHCS0joUlNMoQQaZEmFpqIhbWsYsGCq6u7q+tVdt1l1cW2qFd2vSKLr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ONgLLhbdj1ldFj6j6moLjIGPweYKkaQoh6atUUe5xzZ/JMS3Of9GP3cigucO0qMVEIEUjWvG40MD2YvFN1HfeKPy3DoxFbTTHxz4t3kn7kbJWes3ubxrw0ukeF9i0qKmLVqlU89NBDgLF+5YIFC2jcuDEnTpygb9++jBkzhuuuu4633nqLp556itTUVPLz8ykoKGD9+vUkJyd7nPPUqVMsWLCAn376CaUUp0+f9rruAw88wAcffED//v15/vnnPd5LS0tj69athIaG0qVLF5588kksFguvvPIKkZGRFBUVMWzYMLZv305cXNxlfkuiqkmPaWU5GqgPfgXD/gADnsb1NWrY8i8jzUMIIeqy//7eGF/vZDJ6Ah5aDr+Y47qxsiTBqLeN1x74rz2zxDETn8REIUSAWPEnyFzh9kIpMRFc94oPLQ/omHjx4kWsVivNmzfn1KlTDB8+HDDWsHzhhReIi4vj+uuv5/Dhwxw7dozevXuzZcsWzp07R2h
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 1152x288 with 1 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {
|
|
|
|
"needs_background": "light"
|
|
|
|
},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
2022-03-07 18:34:26 +01:00
|
|
|
"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",
|
2022-03-21 14:09:44 +01:00
|
|
|
"if True:\n",
|
2022-03-10 14:59:35 +01:00
|
|
|
" 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-21 14:09:44 +01:00
|
|
|
"source = Emitter([0,0,9])*km\n",
|
2022-03-10 14:59:35 +01:00
|
|
|
"emitted = source.emit(mysignal)\n",
|
|
|
|
"\n",
|
|
|
|
"antennae = [\n",
|
2022-03-21 14:09:44 +01:00
|
|
|
" Receiver((*2*km*rot(0),8)),\n",
|
|
|
|
" Receiver((*3*km*rot(2), 4)),\n",
|
|
|
|
" Receiver((*10*km*rot(1), 7)),\n",
|
2022-03-10 17:38:54 +01:00
|
|
|
"]"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-03-21 14:09:44 +01:00
|
|
|
"execution_count": 5,
|
2022-03-10 17:38:54 +01:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
2022-03-21 14:09:44 +01:00
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAACqCAYAAACEYlLKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAUiklEQVR4nO2de7hWVZ3HP18gAQFNBfEahKMUaN4IJbqglqPUhD3JDIypKWVW3iZ9xtFRo8xKp8YuThmaTZZKTElRmbcUL4kiCIJgGupRkKsKchUDfvPHWq8sN+8578vhnPc9796/z/Ps5+y912/v9Vtr7++67fesJTPDcZx806neDjiO0/640B2nALjQHacAuNAdpwC40B2nALjQHacAuNDbEUkDJc2StEbSee0c16WSbmzPOGI8XSXNl7RXBbv3SXqkvf1J4vuspIdrFV+j0SZClzRG0mOS1klaHve/JEltcf+2QlKTpI/WMMp/B6aaWS8z+0EZf6ZKekPS2mT7fWsiMrNvmtnn4n37SzJJXZK42koIZwEPmtnSCv7MAVZJ+qc2iLNNkNQj5vEd23ndCEmL2suvWrDDQpd0IfB94L+AvYC+wNnAcGCnHb1/LUmF0Ub0A+ZVsDnHzHomW4cRRkqSN18AflHlZbdE+47CycBG4HhJe9fbmZpiZq3egF2BdcCnK9h1Bb4DvAQsA64HuifhnwcWAK8BU4B9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eGtt848BX0jOnQ1gZtcDJwNflLQJ2ACM8WWNnbyTO6Gb2Xpgj8y565P964Drau2X49STvDbdHcdJcKE7TgFwoTtOAXChO04
|
2022-03-10 17:38:54 +01:00
|
|
|
"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",
|
2022-03-21 14:09:44 +01:00
|
|
|
"execution_count": 6,
|
2022-03-10 17:38:54 +01:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
2022-03-21 14:09:44 +01:00
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA3EAAAGDCAYAAACFsZl3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nOzdd3wVVf7/8dcnCaETOtJbkI4IoS1WlAVdF1wrrgVd24qua8O6v7WurqsrurpfbKi4FhTsHQt2KaFKE5AivZcQEkhyP78/7gQvISGUJJOQ9/PxuI/MnJkz5zNzA7mfe2bOMXdHREREREREyoa4sAMQERERERGR/ackTkREREREpAxREiciIiIiIlKGKIkTEREREREpQ5TEiYiIiIiIlCFK4kRERERERMoQJXEiIiJlkJlVMbMPzGyrmb1azG2dYGZzirON4mZm35rZxWHHISJSFJTEiYhIuWBm22NeETPLiFk/P+z4DsK5QG2gjrufl3ejmd1nZll5znvDwTTk7l+6e8eYY68wsxNi1pPNrMxPPGtml5mZm9kZB1jvJTO7q5jCEhHZi5I4EREpF9y9Wu4L+AX4fUzZy3n3N7OEko/ygDQHfnL37H3s83Lsebt73ZIK7kCUoms9FNgU/BQRKbWUxImIiLC75+o1M3vVzNKAC8ysj5lNNLMtZrbazP5jZhVi6nQ2s8/MbJOZrTGzm4PyODO73cx+NrMNZjbGzGoF26qY2StmtjE47mQzyze5MrOOZvZVsN+PZva7oPwfwO3A+UEP2wElHWaWEPQ4XRXEmGZmd5pZm+B8twXXoUKw/8lmtjRYfhVoBHwUtH0D8HWwLbfHr0ewfpmZzTezzWb2kZk1zdP+MDNbBMzPJ8Y4MxsXXNctZvalmbWP2f5S8H58FMT/g5m1jNk+0Mx+Cm43fQywQq5JK6AvcCVwipnVi9l2spktNbObzWy9ma0ys4uCbcO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EREZFyzcyW5VeuJE7KPTNrAvwO+AdwQ8jhiJQYj0RYsXgOm5bPZ9fWdYCTWKM+tZu2pUnrzlic7rgXEREpjZTEicCjwM1A9YJ2MLMrgCsAmjVrVkJhiRQ9j0T4aeoXbPtuFK22fE9TttA0n/02UJMlSb2p/ptLadvjZCV0IiIipYiSOCnXzOw0YJ27TzWzEwraz92fBp4GSElJ8RIKT6RIzf7uPSpOuJt22QtJ90rMq9GXn5v1JanFUVSrdQQWZ6RtWsO2pTOJ++U72m/5imoffcyi8a3JPOFOOh07OOxTEBEREcDc9XlUyi8zewC4EMgGKhF9Ju5Nd7+goDopKSmuZ+KkLNmwZjnL//dnjk7/ljXUY1nHP9Np4GVUrV5zn/XS07Yw55PnaDr7/2jIeqZX+Q1NL3qKukeoN1pERKQkmNlUd0/Zq1xJnEhU0BN3U2GjUyqJk7Jk5hdjaPr1cKp6BtNaXcHRZ99OpSrVDugYmRnpzBj7T7r+PJIMq8yyvg/Stf8fiyliERERyVVQEqeHHEREDkMeiTDxhds56usr2Rxfh9VDPqbP0PsPOIEDqFS5Kr0vupe1541nY3w9un53FT88fwseiRRD5CIiIlIYJXEiAXf/srBeOJGyIGvXTlIfG0Lvpf8ltcbJNL7pO1q03+tLvAPWvF03mg7/lilJv6XPsieZ+ujZZO3aWQQRi4iIyIFQEicichjZmbmD2Y+dQY+tn/BDsyvpft1YKlWuWmTHr1ipCil/fY2JLa4mZdtnzHl0MJkZ6UV2fBERESmckjgRkcPErp2ZzH9sMEenf8vEtrfQ50//KpapASwujt4X38+k9rfTdccPLHhsEDszdxR5OyIiIpI/JXEiIoeBnOxsfnz8XI7KmMykjv+P3ufdXuxt9jr3FiZ3vosumanMfuI
|
2022-03-10 17:38:54 +01:00
|
|
|
"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",
|
2022-03-21 14:09:44 +01:00
|
|
|
"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",
|
2022-03-21 14:09:44 +01:00
|
|
|
" axs[i].set_ylabel(\"Antenna {}\\n at ({})\".format(j, ant.x), **ylabel_kw)\n",
|
2022-03-10 14:59:35 +01:00
|
|
|
" 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
|
|
|
]
|
2022-03-21 14:09:44 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 7,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEWCAYAAAB42tAoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nOydd3zb533n3w/2IAmQFIdEUouapERKtrxiO7ajmEwa27Gd2bRN4mua6/XSNperrxmXpE3bcxq3TZNrLrtpErcZTWzHTpxIHvGesiVRIrWpwb0BYs/n/gAgURQBLgA/AHrerxdeJIHn9/t9AJL44vlOIaVEoVAoFIp06LQWoFAoFIrCRhkKhUKhUGREGQqFQqFQZEQZCoVCoVBkRBkKhUKhUGREGQqFQqFQZEQZCkVJIYT4hhDis9lYK4T4tBDiO9lTB0KItUIIKYQwLPK4rGtJc50PCyGez/V1FMWFUHUUimJBCHEGqAOiQAzoAX4AfEtKGV/muW8GHpBSNi5T5nzXWQucBoxSymgur7UUhBAfBj4ipbxBay2KwkHtKBTFxu1SynJgDfBF4C+B72orSaEobZShUBQlUkq3lPIR4H3Ah4QQ2wCEEP8mhPjb1DohxP8SQgwJIQaFEB9Jun02zFwrhLADvwZWCSG8ydsqIcRfCSEeSK61CCEeEEJMCCFcQojXhBB1ycccQojvJq8zkDynPvmYXgjxD0KIcSFEL/COTM9LCPGXyXN4hBDHhBC7k/ef15L8+YNCiLNJPZ8VQpwRQrx1xtqfCiF+kDxPtxBi14xjPymEOJV8rEcIcVcaLUII8WUhxKgQwi2E6Eq9zorLC2UoFEWNlPJVoB+4cfZjQoi3AZ8A3gpsAG5Kcw4f8HZgUEpZlrwNzlr2IcABNAHVwB8Dg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
|
|
|
"needs_background": "light"
|
|
|
|
},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"import numpy as np\n",
|
|
|
|
"\n",
|
|
|
|
"import matplotlib.pyplot as plt\n",
|
|
|
|
"from lib.sampling import Digitizer\n",
|
|
|
|
"\n",
|
|
|
|
"digit = Digitizer(sampling_frequency=1e1, resolution=0.5)\n",
|
|
|
|
"\n",
|
|
|
|
"analog_samples = int(1e3)\n",
|
|
|
|
"analog_time = np.linspace(0, 10, analog_samples)\n",
|
|
|
|
"analog_signal = lambda t: np.cos(-t**2/6)\n",
|
|
|
|
"\n",
|
|
|
|
"sample_time = digit.sample(analog_time, analog_samples)\n",
|
|
|
|
"quantised_signal = digit.digitise(analog_signal(sample_time))\n",
|
|
|
|
"\n",
|
|
|
|
"fig, ax = plt.subplots()\n",
|
|
|
|
"ax.set_xlabel(\"Time\")\n",
|
|
|
|
"ax.set_ylabel(\"Amplitude\")\n",
|
|
|
|
"ax.set_title(\"Digitised signals\")\n",
|
|
|
|
"\n",
|
|
|
|
"ax.plot(analog_time, analog_signal(analog_time), 'y', label='Analog')\n",
|
|
|
|
"ax.plot(sample_time, quantised_signal)\n",
|
|
|
|
"ax.scatter(sample_time, quantised_signal)\n",
|
|
|
|
"\n",
|
|
|
|
"plt.show();"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"### Combination Antennae and Digitizers"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
|
|
|
"execution_count": 9,
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA3EAAAGDCAYAAACFsZl3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0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JzDjuhGNG7iIiIjUSkmc7NTM7DhgubtPN7Nhte3n7g8DDwMMHjzYmyg8ke1SXFbBioISxhzUmzP270FS9qe0++9tJC2fSWV8a9b3GsGKbgdS2n53KpLagxmxRatIWDWXpKWfcdKPkzm57GNKOu7FqgOvpbj7wTz75WL+8fEPFJaUk5KoPyEiIiLRoL/AsrMbCow0s2OAJCDVzJ529zOjHJfIdsvNLwZgYLtS+rx/Icx9A9K6w3HjidnrFFISU0ip8chDgQuhpBC+fYHEj/9G19dGwW7HMLDXnzbUndWp5qNFRESkcSmJk52au18DXAMQtsRdqQROdhQ5+cUcFvMVR370WyhfB4dfDwdcDPHJ9asgMQX2PQcGjILPH4IpYzli0WccEXMuufn7K4kTERGJEs0TJyKyI3Inddq9PJ4wDk/pAhd+BAf/of4JXKT4JDjocrjwYzy1K48m/I30L8eDq2exiIhINCiJEwm5+5QtzREn0iJUlMErv6H/nHt5peJ/qBjzLnTaY/vr7bgblee9y4sVB7HnvAfgpf8NziUiIiJNSkmciMiOpLwEnj8HZk7ggy5juCH2clq1arhuj0nJrbg9/ndM6nIBfPM8PHsWlBU3WP0iIiKyZUriRER2FOWl8OyZwQAmR9/JhFank5G+Dd0nt6BLejLPJp0Cx9wF896GiacHyaOIiIg0CQ1sIiLSQq0vLaewpDxYqawg9c2LSJo/mbV
|
|
|
|
"text/plain": [
|
|
|
|
"<Figure size 864x432 with 4 Axes>"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"metadata": {
|
|
|
|
"needs_background": "light"
|
|
|
|
},
|
|
|
|
"output_type": "display_data"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
|
|
|
"digit = Digitizer(sampling_frequency=1e1, resolution=0.5)\n",
|
|
|
|
"\n",
|
|
|
|
"########\n",
|
|
|
|
"### Plot Traces\n",
|
|
|
|
"########\n",
|
|
|
|
"\n",
|
|
|
|
"fig, axs = plt.subplots(1+len(antennae),1, sharex=True, figsize=(12,6), gridspec_kw={\"hspace\":0})\n",
|
|
|
|
"axs[0].set_title(\"Traces of Emitter and Antennae (digitised)\")\n",
|
|
|
|
"\n",
|
|
|
|
"# Emitter\n",
|
|
|
|
"i = 0\n",
|
|
|
|
"axs[i].set_ylabel(\"Emitter\\n at ({})\".format(source.x), **ylabel_kw)\n",
|
|
|
|
"axs[i].set_xlabel(\"Time (s)\")\n",
|
|
|
|
"axs[i].plot(time, digit.digitise(emitted(time)))\n",
|
|
|
|
"axs[i].plot(longtime, emitted(longtime))\n",
|
|
|
|
"\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, digit.digitise(ant.recv(emitted)(longtime)), label=\"Digitised Antenna {}\".format(j))\n",
|
|
|
|
" axs[i].set_xlabel(\"Time (s)\")\n",
|
|
|
|
" "
|
|
|
|
]
|
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
|
|
|
|
}
|