mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 11:33:32 +01:00
400 lines
101 KiB
Text
400 lines
101 KiB
Text
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### Recover time information from multiple antennae"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"rng = np.random.default_rng(12345)\n",
|
||
|
"from scipy import signal as sgl\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())))\n",
|
||
|
"\n",
|
||
|
"from lib import TravelSignal\n",
|
||
|
"from lib.sampling import Digitizer\n",
|
||
|
"from lib.location import Receiver, Emitter\n",
|
||
|
"\n",
|
||
|
"import lib.sampling as smp\n",
|
||
|
"import lib.location as loc\n",
|
||
|
"import lib.util as util\n",
|
||
|
"\n",
|
||
|
"km = 1e3\n",
|
||
|
"ns = 1e9"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# Setup emitters and Antenna\n",
|
||
|
"############################\n",
|
||
|
"if True:\n",
|
||
|
" emitter = Emitter([1,1])*km\n",
|
||
|
"else:\n",
|
||
|
" emitter = Emitter([0,0])*km\n",
|
||
|
"\n",
|
||
|
"# reference antenna\n",
|
||
|
"ref_ant = Receiver(np.array([2,2])*km)\n",
|
||
|
"\n",
|
||
|
"# antenna circle\n",
|
||
|
"antennae = [\n",
|
||
|
" Receiver( 5*km * util.rot_vector(np.pi*2/6* n)) for n in range(6)\n",
|
||
|
"]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAASYAAAEWCAYAAADLvjp3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deXhV1bn48e8LkUEQAVEkgBAotIJixFxwgCtDFQQZvEibVhms9/JzRGxtwRkVrVCHqhW9VGjBShBsQbwOgEiqoMykKAIFASEIyihEGQy8vz/WStgJ5yQhJNk75P08z3myz9prn/3u4bxZe+1zzhJVxRhjoqRS2AEYY0x+lpiMMZFjickYEzmWmIwxkWOJyRgTOZaYjDGRY4nJ5BKRH4vIChHZLyJDS3ld94nIK6W5Dr+eqiLyuYicW0i9NiLycWnHE1jfYBGZX1brK28qZGISkVQRWSQi34nIN376NhGRsGMLEpFNIvLTMlzl74B0VT1DVZ+PEU+6iBwUkazA463irEhVn1DV//av21REVEQSAusqqTfuEOBDVd1eSDwrgb0i0qsE1lkiRKSG38fvnOBynUQks7TiKgsVLjGJyG+A54A/AOcC9YFbgCuAKiGGdsKCb+QS0gRYVUidO1S1ZuARmTdyUGDf/D/g1SIu9pqvHxXXA4eAq0WkQdjBlClVrTAP4EzgO6BfIfWqAk8Bm4GvgZeB6oH5/wOsB3YDM4HEwDwFbgPWAfuBx4DmwCfAPmAqUCVQ/1ogA9gLfAy08eWvAkeBA0AWrjXT1L/+zT62D4G3gTvzxb8S6Btn23rjks9eIB0435d/ABwBDvr1tYyxbDrw33FetxOQ6eP8BtgG9AV6AP/2++q+QP2RwN/89Ga/XVn+cZmP44h/vrew4xJY/3Bgu99/5/n9lxBYbw/gc39stgL3BOY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f559RhOQqvkPKlHMiMhAYoqodwo4lSnyrdgWu43dbAfUuBMapav4+JxMCS0ynABE5HdfCGKuqk8KOx5iTVeEu5U41vo9lB64ZPTnkcIwpEdZiMsZEjrWYjDGRU9JfAi036tWrp02bNg01hu+++44aNWqEGkM8FlvxRTm+KMS2bNmynap6dkF1Kmxiatq0KUuXLg01hvT0dDp16hRqDPFYbMUX5fiiEJuIFPapd7uUM8ZEjyUmY0zkWGIyxkSOJSZjTORYYjLGRI4lJmNM5FhiMsZEjiUmY0zkWGIyxkSOJSZjTOSEmphEpLaIvCEia0RktYhcJiJ1RWSOiKzzf+v4uiIiz4vIehFZKSJtA68zyNdfJyKF/sKfMSbawm4xPQe8p6o/wY1ltRo3eN5cVW2BG49thK97De4H2lvghn1+CUBE6gIP434mtB3wcE4yM8aUT6ElJhGphRvHbTyAqh72gwX0wY36gf/b10/3ASapsxCo7YdN7gbMUdXdqroH9yPu3ctwU4wxJSzMXxdohvvlxb+IyEW4wRDvwg2Nsw1AVbfljIiBG4cqOC5Xpi+LV34cERmCa21Rv3590tPTS2xjiiMrKyv0GOKx2IovyvFFObagMBNTAm6I7DtVdZGIPMexy7ZYYo3fpQWUH1+oOg4YB5CSkqJh//xDFH6CIh6LrfiiHF+UYwsKs48pEzeM8SL//A1covraX6Lh/34TqB8cMLARbgDHeOXGmHIqtMSkqtuBLSKSMy5YV+Bz3NhXOXfWBgFv+umZwEB/d+5S4Ft/yTcLuFpE6vhO76t9mTGmnAr7FyzvBF7zo61uAG7CJcupInIzsBnIGbXzHdxY8etxY6ffBKCqu0XkMWCJr/eoqu4uu00wxpS0UBOTqmYAKTFmdY1RV4Hb47zOBGBCyUZnjAlL2J9jMsaY41hiMsZEjiUmY0zkWGIyxkSOJSZjTORYYjLGRI4
|
||
|
"text/plain": [
|
||
|
"<Figure size 288x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"## Show Geometry\n",
|
||
|
"#################\n",
|
||
|
"if True:\n",
|
||
|
" fig, ax = plt.subplots(1,1, figsize=(4,4))\n",
|
||
|
" loc.plot_geometry(ax, [emitter], antennae)\n",
|
||
|
"\n",
|
||
|
" if True:\n",
|
||
|
" ax.plot(*ref_ant.x, \"x\")\n",
|
||
|
" ax.annotate(\"$\\mathrm{A}_\\mathrm{ref}$\", ref_ant.x);"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEFCAYAAADuT+DpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deZhcd3ng++9ba3dV75ska2vJEt73xoDZwWDDnVgOq32TYGfM9ZCLw53LE24gvpdkyDBhknsDkwdmEoc4mITYGAMTEWyMN5YHI2N5kyzbsuSWLbW1dKv3ruru2n73j3NOdXV1VddyTnWXqt/P8/TTVWep81Op+rz1/lYxxqCUUmrt8q12AZRSSq0uDQRKKbXGaSBQSqk1TgOBUkqtcRoIlFJqjQusdgGq0dPTY/r7+1e7GEopdUZ56qmnThtjevO3n5GBoL+/n7179652MZRS6owiIq8V2q5VQ0optcZpIFBKqTVOA4FSSq1xGgiUUmqN00CglFJrnCeBQETuFJFhEXm+yH4Rkb8RkcMisk9ELs/Zd5OIHLJ/bvKiPEoppcrnVUbwLeDaZfZ/ANhp/9wK/A8AEekC/hR4E3Al8Kci0ulRmZRSSpXBk0BgjPkFMLbMIbuAbxvLHqBDRDYA1wAPGWPGjDHjwEMsH1CUUhUaiyX41q+OMD2XXO2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ilvvynHy+w1BHZjscdtBBPxBAdPTXNlfxcAb93RDcCTr+rwoHqmgUCpFfDUa+NcvqWTcMC6SV++tZO5ZIbDw962E1TcWOxxG8Hzr08BcNmWTgA6IiF29LWwVwNBXdNAoFSNzSXTvHRymks2t2e3nbu+FYC
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Setup signal\n",
|
||
|
"########################\n",
|
||
|
"\n",
|
||
|
"fc = 50e6# MHz\n",
|
||
|
"signal_t_length = 200e-9\n",
|
||
|
"signal_pulse_center = 125e-9 # 100 ns\n",
|
||
|
"signal_sample_rate = 5e9 # Hz\n",
|
||
|
"signal_time = util.sampled_time(\n",
|
||
|
" sample_rate=signal_sample_rate,\n",
|
||
|
" start=0,\n",
|
||
|
" end=signal_t_length\n",
|
||
|
")\n",
|
||
|
"\n",
|
||
|
"analog_signal = TravelSignal(\n",
|
||
|
" sgl.gausspulse(signal_time - signal_pulse_center, fc=fc),\n",
|
||
|
" signal_sample_rate,\n",
|
||
|
" t_0 = 0,\n",
|
||
|
" periodic=False\n",
|
||
|
")\n",
|
||
|
"\n",
|
||
|
"del fc, signal_t_length, signal_pulse_center, signal_sample_rate\n",
|
||
|
"\n",
|
||
|
"if True:\n",
|
||
|
" fig, ax = plt.subplots()\n",
|
||
|
" ax.plot(signal_time, analog_signal(signal_time))\n",
|
||
|
" plt.show()\n",
|
||
|
" \n",
|
||
|
" \n",
|
||
|
"## the emitted signal\n",
|
||
|
"emitted = emitter.emit(analog_signal)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 5,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Sp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bzVHqafBqZF0f5wG4pqjI9V5ndTZDIH24zi2rixWsu0XL7m4Sw7FivLySiUfW32vzwzV450gxHxCorM7Uso/uZTge8OWmzwuauVf8DnjpFdF9XltwFeMejcTwLOpfgMTaPIBA62DfC2iDi4Mm0y8LM6y/4UmF4e5x+BOcD3KtsZzeu+3vK1z/A5wPkR8QXg3RQ//KxtfwWN/g7bAP8eA3tcDorPU6MyD/47jPR81pb/XkT0Vab1UtTQWNftNzq2ral/DYzks9Aviqrtp1FUI59B8T3/6KDFBpdhSxobyTlodEz15k2LiEmZ2RMR7wH+jiKAplxvUyRNCAa+ksZcZv6+bG9Wr/3tAxRVzoCioV11fCgRMZUio/ge4AeZuSqKtncx9JoQRXvezwL7AreVAdyjtXUzcxHwzojooqiGfXFEbJKZfx60qfsoskEnjaTMaymHX6Tx/iPiNcBWERGVm/rZ1L8ZHWk5llFUr63tIyhucO9fy20Ot5+RuI8iS7TDCJb9E0XguktmjkZZq+qVe/C0kex/bY//f4CvA6/LzJUR8VVGfpP9AMXf7bZyfPYI1qmW7z7g55m5/+CFys/MSoomCL8bNPs+igzi+4fdWfGZvIjix7IHgR9l5pOV7YzmdV9v+XllOa6LiGcpAq+/KV8Niz3ccQ1SO47z1mKdwX+HEZ3PyvJ/m5nXDJ4REduOwvYH72vPOtPX9rP4T2WZds3MhyPiTRTX/UjU+3uM5BystSjaZn+T4n/KtZnZGxELGMH/I0njw86tJI26KDq9+VREzCrHt6a4eb2uzuL/B7w0io6EJlG04xvpo3RqWa7lQE+Z/R3pY5JmUFTBXg5MiogvUmR8a8fwrojYLDP7gFpWq3fNzfBN4IMR8YoorBdFp0MzRliOoTxI0W51qGlD7f/a8hg/FkWHWW+h/o3o2rgIeEN
|
||
|
"text/plain": [
|
||
|
"<Figure size 1152x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Show how the signal is emitted\n",
|
||
|
"# and received by a reference antenna\n",
|
||
|
"########################\n",
|
||
|
"\n",
|
||
|
"# analog time corresponds to a very high sampled time range\n",
|
||
|
"# (to fully show the signal)\n",
|
||
|
"# that is sufficiently long to show both the emitted and received signal\n",
|
||
|
"if not True:\n",
|
||
|
" t_start = 0\n",
|
||
|
"else:\n",
|
||
|
" t_start = -50e-8\n",
|
||
|
"\n",
|
||
|
"if not True:\n",
|
||
|
" t_end = 5e-7 # ms\n",
|
||
|
"else:\n",
|
||
|
" t_end = 50e-7 # ms\n",
|
||
|
"t_offset = 0 # 100 ns\n",
|
||
|
"sample_rate = 1e10 # 1/s\n",
|
||
|
"\n",
|
||
|
"analog_time = util.sampled_time(sample_rate=sample_rate, start=t_start, end=t_end, offset=t_offset)\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"if True:\n",
|
||
|
" # Figure\n",
|
||
|
" fig, ax = plt.subplots(1, 1, figsize=(16,4))\n",
|
||
|
" ax.set_title(\"Signal as emitted from the emitter, and received by the reference antenna\")\n",
|
||
|
" ax.set_ylabel(\"Amplitude\")\n",
|
||
|
" ax.set_xlabel(\"Time (ns)\")\n",
|
||
|
"\n",
|
||
|
" ## Emitter\n",
|
||
|
" received = emitter.recv(emitted)\n",
|
||
|
"\n",
|
||
|
" ax.plot(analog_time * ns, received(analog_time), label=\"Emitter\")\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
" ## Reference antenna\n",
|
||
|
" received = ref_ant.recv(emitted)\n",
|
||
|
"\n",
|
||
|
" ax.plot(analog_time * ns, received(analog_time), label=\"Reference Antenna\")\n",
|
||
|
" print(\"Spatial time offset emitter-antenna: {:.6g} ns\".format(analog_signal.spatial_time_offset(emitter.x, ref_ant.x)*ns))\n",
|
||
|
"\n",
|
||
|
" ax.legend(loc='upper center')\n",
|
||
|
" plt.show();"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||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1i0eDGLFk3ldsySJEmaC1auXLm2qnr+DoeJ/QwkOQ04DWDZsmWMjY21HFEfVuzKmjydvd9+a9uRSJIkaYqS/MdkyxyKMwNVdW5VjVbV6NKlPb84zWl713fbDkGSJEkDYmIvSZIkDQETe0mSJGkImNj3kOQC4GrgOUnWJDm17ZgkSZKkzfHi2R6qannbMUiSJEn9sMdekiRJGgIm9pIkSdIQMLGXJEmShoCJvSRJkjQETOwlSZKkIWBivwD96JGH2g5BkiRJA2ZivwBd/6EzN07fufrWFiORJEnSoJjYL0DbPbhm4/SjD/2gxUgkSZI0KCb2C9z6devaDkGSJEkDsFUS+yTrk1zf9Tirj7rPTHJxM31Ikpd1LTs6yU9ujZgXklAbp6s2tBiJJEmSBmXJVmr3kao6ZDoVq+pO4NXN7CHAKHBZM3808CDwxam2l2RJVdkt3a26EvsNJvaSJEnDYFaH4iRZneTdSa5OMpbksCSfTvLNJG9o1hlJclOSbYF3Ar/U9Pr/LvAG4I3N/E8lWZrk40mubR5HNW2sSHJukn8Bzp/NfZwPwhPJ/IYNfueRJEkaBlurx36HJNd3zb+nqi5qpu+oqiOT/DnwYeAoYHvgZuCD4xWq6rEkfwCMVtXpAEl2AB6sqv/VzP8j8OdV9fkky4BPAz/eNHE48OKqemQ6O5DkBOB9wGLgb6rqvdNpZy5KV4899thLkiQNhTaG4lzS/P0qsFNVPQA8kORHSXbrczvHAQclGZ/fJcnO49uZQVK/GDgH+BlgDXBtkkuq6mvTaW+uecaPVm2cfuS+O1uMRJIkSYOytRL7zXm0+buha3p8vt94FgFHTkzgm0R/Jr/CdASwqqpub9q7EDgJmFOJ/Vkfv5Hb73mIDVXNA6r5u6GKmvD39x7+E56x4XscyH0b2zj06jP4469/n5XbH9n
|
||
|
"text/plain": [
|
||
|
"<Figure size 864x432 with 8 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Show absolute timing over all antennae\n",
|
||
|
"########################################\n",
|
||
|
"\n",
|
||
|
"if True:\n",
|
||
|
" longtime = util.sampled_time(\n",
|
||
|
" sample_rate=sample_rate,\n",
|
||
|
" start=t_start,\n",
|
||
|
" end=5*t_end,\n",
|
||
|
" offset=t_offset\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
" ylabel_kw = {\"rotation\": \"horizontal\", \"va\":\"center\", \"ha\":\"center\", \"labelpad\": 30}\n",
|
||
|
" \n",
|
||
|
" fig, axs = plt.subplots(2+len(antennae), 1, sharex=True, figsize=(12,6), gridspec_kw={\"hspace\":0})\n",
|
||
|
" axs[0].set_title(\"Traces of Emitter and Antennae\")\n",
|
||
|
"\n",
|
||
|
" # Emitter\n",
|
||
|
" i = 0\n",
|
||
|
" axs[i].set_ylabel(\"Emitter\".format(), **ylabel_kw)\n",
|
||
|
" axs[i].set_xlabel(\"Time (ns)\")\n",
|
||
|
" axs[i].plot(longtime * ns, emitted(longtime), label=\"Emitter\")\n",
|
||
|
" axs[i].plot(signal_time * ns, emitted(signal_time), label=\"Signal time\", zorder=2.5)\n",
|
||
|
"\n",
|
||
|
" # Reference Antenna\n",
|
||
|
" i +=1\n",
|
||
|
" axs[i].set_ylabel(\"Ref Antenna\", **ylabel_kw)\n",
|
||
|
" axs[i].plot(longtime * ns, ref_ant.recv(emitted)(longtime), label=\"Ref Antenna\")\n",
|
||
|
" axs[i].set_xlabel(\"Time (ns)\")\n",
|
||
|
"\n",
|
||
|
" # Antenna\n",
|
||
|
" for j, ant in enumerate(antennae):\n",
|
||
|
" i +=1\n",
|
||
|
" axs[i].set_ylabel(\"Antenna {}\".format(j), **ylabel_kw)\n",
|
||
|
" axs[i].plot(longtime * ns, ant.recv(emitted)(longtime), label=\"Antenna {}\".format(j))\n",
|
||
|
" axs[i].set_xlabel(\"Time (ns)\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 10,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Time delay ref ant -- emitter (ns): 9434.617346998737\n",
|
||
|
"T_threshold Emitter (ns): 123.0\n",
|
||
|
"T_threshold Antenna (ns): 9680.617346998737\n",
|
||
|
"Diff thresholds (ns): 9557.617346998737\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAD4CAYAAAD//dEpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deZhcZ3Xn8e+ptReprdbmRZYt2dgGGxMZNw6GYV9iyASbkElMZoggYTzJxEkICcEMM5AhZOKQmUAWSOIQExMSMCEhKIkdYpslC95kEF4xlmWBZclSS62tt1rP/HHvra7uqltV3VXdVWX/Ps/TT1fduvfWq1JXnTrved/3mrsjIiLSTKLbDRARkf6ggCEiIi1RwBARkZYoYIiISEsUMEREpCWpbjdgKdavX+9btmzpdjNERPrKfffdd9jdNyz1+L4MGFu2bGHnzp3dboaISF8xs++1c7y6pEREpCUKGCIi0hIFDBERaYkChoiItEQBQ0REWtKRgGFmN5rZITN7MOZxM7PfN7PdZna/mb2w6rHtZvZY+LO9E+0REZHO61SG8efAFQ0efwNwXvhzDfBHAGa2Fvgg8IPAZcAHzWy0Q20SEZEO6kjAcPd/ASYa7HIl8GkP3AWsMbPTgR8CbnP3CXc/CtxG48Ajfeqh/ce58d+eoFzWcvoi/WqlJu5tAp6sur8v3Ba3vYaZXUOQnXDWWWctTytl2fziZ7/F4+NTXHr2KD+weU23myMiS7BSRW+rs80bbK/d6H6Du4+5+9iGDUue2S5d8vj4FACPHjzZ5ZaIyFKtVMDY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+TiJu6FAaPZ0NqpXJGhbLJyzCmDaY5
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Determine time from signal thresholds for emitter and reference receiver\n",
|
||
|
"######################################\n",
|
||
|
"\n",
|
||
|
"threshold = 0.8\n",
|
||
|
"\n",
|
||
|
"if True:\n",
|
||
|
" mysignal = analog_signal\n",
|
||
|
"else:\n",
|
||
|
" mysignal = emitted\n",
|
||
|
" \n",
|
||
|
"received = ref_ant.recv(mysignal)\n",
|
||
|
"#received.periodic=True\n",
|
||
|
"\n",
|
||
|
"## Recover signal time from signal\n",
|
||
|
"signal_time = util.sampled_time(sample_rate=mysignal.sample_rate, start=0, end=mysignal.time_length)\n",
|
||
|
"\n",
|
||
|
"## Find time offset and recover approximate signal time at antenna\n",
|
||
|
"# Note: no idea where 2 comes from right now\n",
|
||
|
"time_offset = -2 * analog_signal.total_time_offset(x_f = ref_ant.x, x_0 = emitter.x, velocity = None)\n",
|
||
|
"ref_ant_signal_time = 2*signal_time + time_offset\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"# Find t_threshold for emitter\n",
|
||
|
"raw_emit = mysignal(signal_time)\n",
|
||
|
"t_thres_emit_idx = util.detect_edges(threshold, raw_emit, rising=True, falling=False)\n",
|
||
|
"\n",
|
||
|
"if t_thres_emit_idx:\n",
|
||
|
" t_thres_emit = signal_time[t_thres_emit_idx[0]]\n",
|
||
|
"else:\n",
|
||
|
" t_thres_emit = None\n",
|
||
|
"del t_thres_emit_idx\n",
|
||
|
" \n",
|
||
|
" \n",
|
||
|
"# Find t_threshold for receiver\n",
|
||
|
"raw_ant = received(ref_ant_signal_time)\n",
|
||
|
"t_thres_ant_idx = util.detect_edges(threshold, raw_emit, rising=True, falling=False)\n",
|
||
|
"\n",
|
||
|
"if t_thres_ant_idx:\n",
|
||
|
" t_thres_ant = ref_ant_signal_time[t_thres_ant_idx[0]]\n",
|
||
|
"else:\n",
|
||
|
" t_thres_ant = None\n",
|
||
|
"del t_thres_ant_idx\n",
|
||
|
"\n",
|
||
|
"print(\"Time delay ref ant -- emitter (ns):\", time_offset*ns)\n",
|
||
|
"print(\"T_threshold Emitter (ns):\", t_thres_emit*ns)\n",
|
||
|
"print(\"T_threshold Antenna (ns):\", t_thres_ant*ns)\n",
|
||
|
"print(\"Diff thresholds (ns):\", (t_thres_ant - t_thres_emit)*ns)\n",
|
||
|
"\n",
|
||
|
"## Make another plot\n",
|
||
|
"fig, ax = plt.subplots()\n",
|
||
|
"axs[i].set_xlabel(\"Time (ns)\")\n",
|
||
|
"# Emitter\n",
|
||
|
"if not True:\n",
|
||
|
" ax.plot(signal_time *ns, raw_emit, label='Emitter')\n",
|
||
|
" ax.plot(t_thres_emit*ns, mysignal(t_thres_emit), '*')\n",
|
||
|
" ax.annotate(\"t_1\", xy=(t_thres_emit*ns, mysignal(t_thres_emit)))\n",
|
||
|
"\n",
|
||
|
"# Antenna\n",
|
||
|
"if True:\n",
|
||
|
" ax.plot(ref_ant_signal_time*ns, raw_ant, label=\"Reference Antenna\")\n",
|
||
|
" ax.plot(t_thres_ant*ns, received(t_thres_ant), '*')\n",
|
||
|
" ax.annotate(\"t_2\", xy=(t_thres_ant*ns, received(t_thres_ant)))\n",
|
||
|
"\n",
|
||
|
"plt.show();"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"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.10.2"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 4
|
||
|
}
|