m-thesis-introduction/simulations/08_beacon_sync.ipynb

733 lines
291 KiB
Text
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Beacon Sync\n",
"\n",
"Synchronise two delta peaks, by using an intermediate beacon that was sent out together with it."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import scipy.signal as signal\n",
2022-08-04 17:22:54 +02:00
"\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",
"from lib.util import *\n",
2022-08-05 12:16:19 +02:00
"from lib.plotting import *\n",
"from lib.timing import *\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2022-08-01 15:17:24 +02:00
"Beacon period [ns]: 14.285714285714285\n",
"Beacon initial [ns]: 4.4\n",
"Beacon initial [phase]: 1.9352210746113125\n",
2022-08-05 14:26:40 +02:00
"Beacon initial [idx]: 2.2\n",
"Beacon difference [ns]: 8.571428571428571\n",
"Beacon difference [phase]: 3.7699111843077517\n",
2022-08-05 18:09:47 +02:00
"Impulse offsets [ns]: [ 64. 178.]\n",
"Time difference Impulses [ns]: 113.99999999999999\n",
"Time difference Impulses [T]: 7.9799999999999995\n"
]
}
],
"source": [
"us = 1e3 # ns\n",
"ns = 1/us # us\n",
"\n",
"\n",
"band = (30, 80) # MHz\n",
2022-08-05 14:26:40 +02:00
"samplerate = 500 # MHz\n",
"timelength = 0.2 # us\n",
"\n",
"time = np.arange(0, timelength, 1/samplerate)\n",
"\n",
"# generate beacons\n",
"if True: # in-band\n",
" f_beacon = 70 # MHz\n",
"else: # under band\n",
" f_beacon = 20 # MHz\n",
"\n",
"beacon_amplitude = 0.1\n",
"beacon_init_phase = time2phase(4.4*ns, f_beacon)\n",
"beacon_phase_offset = 1.2*np.pi\n",
"\n",
"beacons = np.array([\n",
" beacon_amplitude * sin_delay(f_beacon, time, t_delay=0, phase=-beacon_init_phase),\n",
" beacon_amplitude * sin_delay(f_beacon, time, t_delay=0, phase=-beacon_init_phase-beacon_phase_offset)\n",
"])\n",
"\n",
2022-08-01 15:17:24 +02:00
"\n",
"# generate impulses\n",
"impulses = []\n",
"impulses_offsets = []\n",
2022-08-01 15:17:24 +02:00
"impulses_def_offsets = [\n",
" (0.3*len(time),0.4*len(time)),\n",
2022-08-05 12:16:19 +02:00
" (0.5*len(time),0.9*len(time)),\n",
2022-08-01 15:17:24 +02:00
" ]# random offsets in interval\n",
2022-08-05 18:09:47 +02:00
"if True:\n",
2022-08-05 12:16:19 +02:00
" # freeze impulses\n",
" impulses_def_offsets = [\n",
2022-08-05 18:09:47 +02:00
" 0.064*samplerate,\n",
" 0.178*samplerate \n",
2022-08-05 12:16:19 +02:00
" ]\n",
"if not True:\n",
" # Equal offset to beacon and \n",
" impulses_def_offsets = [\n",
" 64*ns*samplerate,\n",
" (64*ns + (beacon_phase_offset % (2*np.pi))/(2*np.pi*f_beacon) + 6/f_beacon)*samplerate\n",
" ]\n",
" if True:\n",
" impulses_def_offsets = [impulses_def_offsets[0]]\n",
" \n",
2022-08-05 12:16:19 +02:00
" \n",
"for i in range(2):\n",
" offset = None\n",
" if impulses_def_offsets:\n",
" if len(impulses_def_offsets) == 1:\n",
" offset = impulses_def_offsets[0]\n",
" else:\n",
" offset = impulses_def_offsets[i]\n",
" orig_imp, imp_offset = deltapeak(timelength, samplerate, offset=offset, peaklength=1)\n",
"\n",
2022-08-05 18:09:47 +02:00
" orig_imp[imp_offset] = 0.1\n",
" ## Bandpass it\n",
" imp, _ = fft_bandpass(orig_imp, band, samplerate)\n",
" imp /= np.max(imp)\n",
" \n",
" impulses.append(imp)\n",
" impulses_offsets.append(imp_offset/samplerate)\n",
"\n",
"impulses = np.array(impulses)\n",
"impulses_offsets = np.array(impulses_offsets)\n",
2022-08-01 15:17:24 +02:00
"print(\"Beacon period [ns]:\", 1/f_beacon/ns)\n",
"print(\"Beacon initial [ns]:\", phase2time(beacon_init_phase, f_beacon) /ns)\n",
"print(\"Beacon initial [phase]:\", beacon_init_phase)\n",
"print(\"Beacon initial [idx]:\", phase2time(beacon_init_phase, f_beacon)*samplerate)\n",
"print(\"Beacon difference [ns]:\", phase2time(beacon_phase_offset, f_beacon)/ns)\n",
"print(\"Beacon difference [phase]:\", beacon_phase_offset)\n",
"print(\"Impulse offsets [ns]:\", impulses_offsets[:,0]/ns)\n",
2022-08-04 17:22:54 +02:00
"print(\"Time difference Impulses [ns]: {}\".format( (impulses_offsets[1,0]-impulses_offsets[0,0])/ns ))\n",
"print(\"Time difference Impulses [T]: {}\".format( (impulses_offsets[1,0]-impulses_offsets[0,0])*f_beacon ))"
]
},
{
"cell_type": "code",
2022-08-05 12:16:19 +02:00
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"full_signals = impulses + beacons"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArkAAAEGCAYAAABhKo2JAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAACKrElEQVR4nOzdd1hUV/7H8feZofcmiIKgInZFxa6JLabHVNMTd1M2vW422WQ3dTfZXzZ93fRkTUxiqmmaZmLsvSBYARugIALSpM7M+f1xh6aUQRnq9/U8PMowc+fD5c6533vuuecqrTVCCCGEEEJ0Jqa2DiCEEEIIIURLkyJXCCGEEEJ0OlLkCiGEEEKITkeKXCGEEEII0elIkSuEEEIIITodF2csNCQkREdHRztj0UIIB5WU7AHAy6t/GycRQgghnGfz5s05WutuJz7ulCI3OjqaTZs2OWPRLW7NmrEATJiwvo2TOCY5ORmA2NjYNk7iGMnrXI3l3bp1CgAjRixrxUSN60zrtz2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jnWfz2VAv5gGn7916xQARoxY1uhykzIKuHDuKl65Mo6LR5z6bA1CCCFEW1BKbdZax5/4uCOzK9wNHAGWAIvtX4taPGEbi46O5u2332bz5s1kZ2fz5JNPtnUkIep46qmnOHLkCCPvfpOL7n660QK3OQb38CPAy1XG5QohhOhUHJ1dob/WukvMPVFV7ArR3rz66qscKSxj7LO/cUNMy10hazIpJvYNYXVqTrudVUQIIYRoLkcGHqYDBc4O0lb
"text/plain": [
"<Figure size 864x288 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# Make a figure showing two signals with a beacon per signal\n",
"colors = ['y','g']\n",
"multiplier_name = ['m','n']\n",
"\n",
"\n",
"fig, axes = plt.subplots(3,1, sharex=True, figsize=(12,4), gridspec_kw=dict(hspace=0))\n",
"for i, ax in enumerate(axes):\n",
" #if i != 0:\n",
" # ax.spines['top'].set_visible(False)\n",
" #ax.spines['right'].set_visible(False)\n",
" #if i != len(axes)-1:\n",
" # ax.spines['bottom'].set_visible(False)\n",
" #ax.spines['left'].set_visible(False)\n",
" #ax.tick_params(left=False, bottom=False, labelleft=False, labelbottom=False)\n",
" pass\n",
"\n",
"axes[-1].set_xlabel(\"Time [ns]\")\n",
2022-08-01 15:17:24 +02:00
"axes[-1].set_yticks([],[])\n",
"for i in range(0, 2):\n",
2022-08-01 15:17:24 +02:00
" axes[i].set_yticks([],[])\n",
" axes[i].set_ylabel(\"Antenna {:d}\".format(i+1))\n",
" axes[i].plot(time/ns, impulses[i])\n",
" axes[i].plot(time/ns, beacons[i], marker='.')\n",
2022-08-01 15:17:24 +02:00
" if not True:\n",
" axes[i].plot(time/ns, full_signals[i])\n",
"\n",
"\n",
"# indicate timing of pulses\n",
"for i, impulse_offset in enumerate(impulses_offsets):\n",
" kwargs = dict(color=colors[i])\n",
" [ax.axvline(impulse_offset/ns, **kwargs) for ax in (axes[i], axes[-1])]\n",
"\n",
2022-08-01 15:17:24 +02:00
"\n",
"# indicate timing of the beacons\n",
2022-08-01 15:17:24 +02:00
"# and annotate ticks and impulse widths\n",
"tmp_beacon_phases = beacon_init_phase + np.arange(0,2)*beacon_phase_offset\n",
2022-08-05 12:16:19 +02:00
"if True: # mod phases\n",
" tmp_beacon_phases %= 2*np.pi\n",
"tmp_beacon_offsets = phase2time(tmp_beacon_phases, f_beacon)\n",
"\n",
"\n",
"A = np.empty(2)\n",
"B = np.empty(2)\n",
"for i in range(0,2):\n",
" kwargs = dict(color=colors[i], ls=(0, (3,2)))\n",
" tick_kwargs = dict(color='k', alpha=0.2)\n",
"\n",
" # indicate every period of the beacon\n",
" beacon_ticks = tmp_beacon_offsets[i] + [(n)*1/f_beacon for n in range(1+int((time[-1] - time[0]) * f_beacon))]\n",
"\n",
" [axes[i].axvline(tick/ns, **{**kwargs, **tick_kwargs}) for tick in beacon_ticks]\n",
"\n",
" # reference period in beacon\n",
2022-08-01 15:17:24 +02:00
" [ax.axvline(tmp_beacon_offsets[i]/ns, **kwargs) for ax in (axes[i], axes[-1])]\n",
"\n",
" # annotate width between impulse and closest beacon tick\n",
" # and closest beacon tick and reference tick\n",
" closest_beacon_tick_id = np.argmin(np.abs(beacon_ticks-impulses_offsets[i]))\n",
" if closest_beacon_tick_id != 0 and beacon_ticks[closest_beacon_tick_id] > impulses_offsets[i]:\n",
" closest_beacon_tick_id -= 1\n",
" closest_beacon_tick = beacon_ticks[closest_beacon_tick_id]\n",
"\n",
" annotate_width(axes[i], f\"$A_{i+1}$\", closest_beacon_tick/ns, impulses_offsets[i]/ns, 0.7)\n",
" annotate_width(axes[i], f\"$B_{i+1}={multiplier_name[i]}T$\", closest_beacon_tick/ns, tmp_beacon_offsets[i]/ns, 0.4)\n",
"\n",
" A[i] = closest_beacon_tick - impulses_offsets[i]\n",
" B[i] = closest_beacon_tick - tmp_beacon_offsets[i]\n",
2022-08-01 15:17:24 +02:00
"\n",
"# annotate width between beacon reference periods\n",
"annotate_width(axes[-1], \"$\\Delta t_\\\\varphi$\", tmp_beacon_offsets[0]/ns, tmp_beacon_offsets[-1]/ns, 0.4)\n",
2022-08-01 15:17:24 +02:00
"\n",
"# annotate width between pulses\n",
"annotate_width(axes[-1], \"$\\Delta t$\", impulses_offsets[0]/ns, impulses_offsets[-1]/ns, 0.4)\n",
"\n",
"\n",
"fig.show()\n",
"if True:\n",
" fname = 'figures/08_beacon_sync_timing_outline'\n",
"\n",
" # Dump figure\n",
" fig.savefig(fname +'.pdf')\n",
" \n",
" # Dump information into accompanying file\n",
" with open(fname + '.dat', 'w+') as fp:\n",
" fp.write(\"f_beacon = {}MHz\\n\".format(f_beacon))\n",
" fp.write(\"samplerate = {}\\n\".format(samplerate))\n",
" fp.write(\"band = {}MHz\\n\".format(band))\n",
" fp.write(\"timelength = {}us\\n\".format(timelength))\n",
" \n",
" fp.write(\"-\"*8 + \"\\n\")\n",
" fp.write(\"\\Delta t = {}ns\\n\".format( (impulses_offsets[1][0] - impulses_offsets[0][0])/ns ))\n",
" fp.write(\"t_phi = {}ns\\n\".format( (tmp_beacon_offsets[1]-tmp_beacon_offsets[0])/ns ))\n",
" fp.write(\"\\Delta A = {}ns\\n\".format( (A[1] - A[0])/ns ))\n",
" fp.write(\"kT = {}ns = {}T\\n\".format( (B[1]-B[0])/ns, (B[1]-B[0])*f_beacon ))\n",
" \n",
" fp.write(\"-\"*8 + \"\\n\")\n",
" fp.write(\"A_1 = {}ns\\n\".format( (A[0])/ns ))\n",
" fp.write(\"A_2 = {}ns\\n\".format( (A[1])/ns ))\n",
" fp.write(\"B_1 = {}ns = {}T\\n\".format( (B[0])/ns, (B[0]*f_beacon) ))\n",
" fp.write(\"B_2 = {}ns = {}T\\n\".format( (B[1])/ns, (B[1]*f_beacon) ))"
]
},
{
"cell_type": "code",
2022-08-05 12:16:19 +02:00
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2022-08-05 18:09:47 +02:00
"\\Delta t = 113.99999999999999ns\n",
"\\Delta A = -5.428571428571415ns\n",
"t_phi = 8.571428571428573ns\n",
2022-08-05 18:09:47 +02:00
"B_1 = 57.14285714285714ns = 4.0T\n",
"B_2 = 157.14285714285714ns = 11.0T\n",
"kT = 100.0ns = 7.0T\n"
]
}
],
"source": [
"t_phi = (tmp_beacon_offsets[1]-tmp_beacon_offsets[0])\n",
"Delta_A = (A[1] - A[0])\n",
"\n",
"print(\"\\Delta t = {}ns\".format( (impulses_offsets[1][0] - impulses_offsets[0][0])/ns ))\n",
"print(\"\\Delta A = {}ns\".format( Delta_A/ns ))\n",
"print(\"t_phi = {}ns\".format( t_phi/ns ))\n",
"print(\"B_1 = {}ns = {}T\".format( (B[0])/ns, (B[0]*f_beacon) ))\n",
"print(\"B_2 = {}ns = {}T\".format( (B[1])/ns, (B[1]*f_beacon) ))\n",
"print(\"kT = {}ns = {}T\".format( (B[1]-B[0])/ns, (B[1]-B[0])*f_beacon ))\n",
"\n"
2022-08-01 15:17:24 +02:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$\n",
2022-08-01 15:17:24 +02:00
"\\Delta t = (A_2 + B_2) - (A_1 + B_1) + t_\\phi\\\\\n",
"\\quad = (A_2 - A_1) + (B_2 - B_1) + t_\\phi\\\\\n",
"\\quad = (A_2 - A_1) + (nT - mT) + t_\\phi\\\\\n",
2022-08-05 18:09:47 +02:00
"\\quad = \\Delta A + t_\\phi + (kT) \n",
"$\n",
"\n",
2022-08-04 17:22:54 +02:00
", where $\\Delta A < T$ and $k \\in \\mathbb{Z}$ and $t_\\phi$ is minimisable by synchronising the beacons.\n",
"\n",
"Then $\\Delta t$ can be determined by iteratively summing the signals, changing $k$, and finding the $k$ belonging to the maximum of the sums."
]
},
{
"cell_type": "code",
2022-08-05 12:16:19 +02:00
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2022-08-08 10:49:17 +02:00
"Best k: 7\n",
"Maximum: 2.0\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAA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ba93zjLXdcC/BzwAjwyozXvwjcBHwaR0TbwDNzbGMX8M4S9q1QKBQ1wbXSA1AoFIobDSFEAPgY8EbxuQZ8G0cwfhzoBF4QQnQDvcBvAXdKKa8IIboAXUr5i0KI+4H/S0r5whz7cRe3+0Xgg8B9wDNCiDuklO8XQuwHviKl/Kvi8jOf3zzbvucb71zjEkL8HwAp5W+UcYg+CXxJzt4NTU7715r2fCa7gK+UsS+FQqFYEVQkW6FQKCrH00KIODAJPAT8t+LrdwLNUso/kVIWpJQ9wP8LPIYjJL3ANiGEW0rZK6W8UOb+9gIh4L8Wt/si8CyOMC6HufY933hnRUr5G+UIbCHEOuB9wN/O8vY/Ay4C/wP494AH2DfLNsJAF3B0of0pFArFSqEi2QqFQlE5flpK+YIQQscRhz8SQmzDyYVeUxTgJXTgFSnleSHEp4E/BrYLIZ4HfkdKeaWM/a0BLksp7Wmv9QEd5Qx2rn3PN95ytrsAnwBelVJenGU8/39wCh+dp87zWbgNSOIIcoVCoViVqEi2QqFQVBgppSWl/CZOpPg+4DJwsVicV3rUSSk/XFz+76WU9+GIWwn8WWlTC+zqCrC2mN5RYh0wsIixzrbvecdbxrjm4xPMHsWePqa/kVLun2eRXcCxOdJNFAqFYlWgRLZCoVBUGOGwD6gHTgMHgclikaFfCKELIXYIIe4sele/v2g/l8Nx3bCKmxoGNs6zqzeBNPB7Qgh30fbuI8CTZY5zrn3POd4yxzXX/u7BibJ/Y6FlF2AXKlVEoVCscpTIVigUisrxbSFECicn+0+BT0opT0opLRzxuwsnxWEM+CsggpMT/V+Lrw0BLcC
"text/plain": [
"<Figure size 864x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# Make figure showing the sums depending on k\n",
"ref_impulse = impulses[0]\n",
"my_impulse = impulses[1]\n",
"\n",
"# remove 'already determined' offsets\n",
"if True:\n",
" # $t_\\phi$ offset\n",
" my_impulse = time_roll(my_impulse, samplerate, -t_phi)\n",
"\n",
2022-08-08 10:49:17 +02:00
"if True:\n",
" # $\\Delta A$ offset\n",
2022-08-04 17:22:54 +02:00
" my_impulse = time_roll(my_impulse, samplerate, +Delta_A)\n",
"\n",
2022-08-05 18:09:47 +02:00
"best_k, (ks, maxima) = beacon_integer_period(samplerate, f_beacon, ref_impulse, my_impulse)\n",
"print(\"Best k: {:0g}\".format(best_k))\n",
"print(\"Maximum: {}\".format(maxima[np.where(ks == best_k)][0]))\n",
"\n",
"\n",
"# Make figure\n",
"fig, axes = plt.subplots(1, 1, sharex=True,figsize=(12,4))\n",
"if not hasattr(axes, 'ndim'):\n",
" axes = [axes]\n",
"\n",
2022-08-05 18:09:47 +02:00
"axes[0].set_title(\"Coherent sum of impulses with $kT$ offsets.\\nBest offset: ${:.0f}*T$\".format(best_k))\n",
"axes[-1].set_xlabel(\"Time [ns]\")\n",
"\n",
"if not True:\n",
" i=0\n",
" axes[i].set_ylabel(\"Reference\")\n",
" axes[i].plot(time/ns, ref_impulse, label=\"reference\")\n",
" axes[i].plot(time/ns, my_impulse, label='impulse')\n",
" axes[i].legend()\n",
"\n",
2022-08-04 17:22:54 +02:00
"axes[-1].set_ylabel(\"Coherence Sum\")\n",
"\n",
"best_maximum = np.max(maxima)\n",
"axes[-1].axhline(best_maximum, alpha=0.7)\n",
"\n",
"for i, k in enumerate(ks, 0):\n",
" sample_offset = int(k*1/f_beacon*samplerate)\n",
" augmented_impulses = np.roll(my_impulse, sample_offset)\n",
" \n",
" summed_impulse = ref_impulse + augmented_impulses\n",
" if True or k%2 == 1:\n",
" axes[-1].plot(time/ns, summed_impulse, label='k={:.0f}'.format(k),\n",
2022-08-04 17:22:54 +02:00
" alpha=0.1 + 0.9*1/(1+2*abs(best_maximum-maxima[i]))\n",
" )\n",
" \n",
"axes[-1].legend()\n",
"fig.show()\n",
"\n",
"if True:\n",
" fname = 'figures/08_beacon_sync_coherent_sum'\n",
"\n",
" # Dump figure\n",
" fig.savefig(fname +'.pdf')\n",
"\n",
"del ref_impulse\n",
"del my_impulse"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2022-08-04 17:22:54 +02:00
"## 1. Solve it\n",
"\n",
" 1. Find $t_\\phi$\n",
2022-08-08 10:49:17 +02:00
" 2. Find $\\Delta A$\n",
" 3. Find $kT$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2022-08-04 17:22:54 +02:00
"##### 1.1 Beacon Phase Delay ($t_\\phi$)"
]
},
{
"cell_type": "code",
2022-08-05 18:09:47 +02:00
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2022-08-05 14:26:40 +02:00
"Beacon delays [ns] \\pm k*14.285714285714285ns: [0. 8.57142857]\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_1809896/665080263.py:1: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.\n",
" abs_beacon_time_delays_tmp = np.array([\n"
]
}
],
"source": [
2022-08-05 12:16:19 +02:00
"abs_beacon_time_delays_tmp = np.array([\n",
2022-08-05 14:26:40 +02:00
" beacon_time_delay(samplerate, beacons[0], beacon)\n",
" for beacon in beacons\n",
"])\n",
"\n",
2022-08-05 14:26:40 +02:00
"\n",
2022-08-05 12:16:19 +02:00
"abs_beacon_time_delays = abs_beacon_time_delays_tmp[:,0]\n",
2022-08-05 14:26:40 +02:00
"t_phi = np.array(abs_beacon_time_delays % (1/f_beacon), dtype=np.float64)\n",
2022-08-05 12:16:19 +02:00
"beacon_time_delays_err = abs_beacon_time_delays_tmp[:,1]\n",
"\n",
2022-08-05 14:26:40 +02:00
"print(\"Beacon delays [ns] \\pm k*{}ns: {}\".format(1/f_beacon/ns, t_phi/ns))"
]
},
{
"cell_type": "code",
2022-08-05 18:09:47 +02:00
"execution_count": 8,
"metadata": {},
2022-08-01 15:17:24 +02:00
"outputs": [
{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iHwUq2q7zKtVp3DcTIbIgujQAwhQemiTT8CXvQ8UWapnotgHYeIvCFdilV1a2/4KMJowKWU2tVl2Uaio960L2VOu9NX2dOb8aNMK/heqlWOL9MK1pRq9VtmQ3gxCsQQSiajy9ceg4h85G0n1aXiXw+tx4p/PZCCTmnflTp0edBI52O0ojsKlABr0en7e+MnwHB0LYsHgddFZETnSk+m4zPwr1ASwP8A/1ZKHextAxGJRRcAe0wptcOPcwiVzIYwYhSIIZRMwVMcpxMRyUTXPQg1DUBat2Vp6NoKEYv4UOa0O6rvsqd+lWn1yDGFPkq1Sg9lWn09h1DIbAg/RoEYQoLnJjKBLiMQEbkdbc+eJSL3e9n37R68cTrb2z6KsAuIEZFRXZZN5lgzSyQSSJnT7nQve+pvmVboo1SrSK9lWgM9BytkNoQZo0AMoSLR0xwAIjIVmA/8C/guugZ6ek87KqUu6OqN061d0NM+PfTRiH4C/rXo0r9zgUvRT8wRi+qjzGl3pI+yp9JLmVbPumBKtfZYptWXcwhGZkNkYRSIISR4buD3A9tEpAS4Av0UOgU9KulAVxAMJd9GK7FKdPndbymlvhiBeEY6PwuxDIFwBbo2ShWwG/1d/aBzZTe5Y9GuuFVo0+B3gcuUUjs9628GXlZK9WS6+wXaTfZO4Cue978AUEo1KaXKOxvaJNiilKoSkSHA7ehrWd5ldHiDj+cQjMyGCMLUAzGEBRH5C9oL5070DeMupdQii49hSVlbQ+QipuRwRGEUiCEsiMhktE27AD0P8k2lVJm9UhkMhmAwCsQQNkRkInCbUuq7dstiMBiCx8yBGML
2022-08-01 15:17:24 +02:00
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# Make a figure showing the corrected beacons\n",
"fig, ax = plt.subplots(1,1, sharex=True)\n",
"ax.set_xlabel(\"Time [ns]\")\n",
"ax.set_ylabel(\"Amplitude [au]\")\n",
2022-08-05 14:26:40 +02:00
"ax.set_title(\n",
" \"Beacon delays [ns] $\\pm$ $k*{}$\\n$t_{{\\phi}}$ = {}\"\n",
" .format(1/f_beacon/ns, t_phi/ns)\n",
")\n",
2022-08-05 12:16:19 +02:00
"\n",
"for i, _ in enumerate(beacons):\n",
" l = ax.plot(\n",
" time/ns, beacons[i],\n",
" label=\"ch {}\".format(i), \n",
" ls ='--', \n",
" alpha=0.5\n",
" )\n",
" \n",
" # indicate start of uncorrected beacons\n",
2022-08-05 12:16:19 +02:00
" ax.axvline(\n",
2022-08-05 14:26:40 +02:00
" t_phi[i]/ns,\n",
2022-08-05 12:16:19 +02:00
" color=l[0].get_color(),\n",
" ls = '--'\n",
" )\n",
" \n",
" ax.plot(\n",
2022-08-05 14:26:40 +02:00
" (time-t_phi[i])/ns,\n",
2022-08-05 12:16:19 +02:00
" beacons[i],\n",
" label='ch {} corrected'.format(i),\n",
" color=l[0].get_color(),\n",
" ls=(5*i+2, (20, 20))\n",
" )\n",
" \n",
"ax.legend(ncol=2)\n",
"ax.margins(y=0.3)\n",
"if True:\n",
2022-08-05 14:26:40 +02:00
" ax.set_xlim(time[0]/ns - 10, time[2*samplerate//f_beacon]/ns)\n",
"\n",
2022-08-05 14:26:40 +02:00
"fig.show()"
]
},
2022-08-08 10:49:17 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### 1.1.2 Beacon Synced traces"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArkAAAEWCAYAAABi/I8SAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAACDpklEQVR4nOzdd1hUV/7H8feZofcOigoqAnbs3agxppnEVJNN2WRTNhuzm7Itu9ndZDdlSzZ1TftlU002zTRNs0XssaMUAVFUrCBIrzNzfn/coSkgyMAAfl/Pw6Ncpny43Hvme88991yltU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jY2RFaRXI6xkUXXcRFF11Efn4+J0uqeOKrbZjXvs7Sr77k66+/JikpiUOHMsnIKOXvf/87f/jDHwC4Y3I0K9KO87elacwZEkGgt1un5O3q67NWd8kJ3Ser5HQsyelYkrPranaeXKXUXuBCrfWhJn6Wo7Xu29yLyjy5QnQvn2zN4bef7mTc4c/46tP/4ePjw1NPPcWkSZ8AZ97Wd1dOIVe9vIHn54/k6lF9nJBYCCGEMJzLPLkvAIHN/Oxfjgglzi+vv/46vXr1IiEhgZiYGObNm0d1ddOnxTvCG2+8QUJCAgkJCZhMprr/P/zww52Woav6bsdeDr8wn2+++IShQ4cSHh7OL3/5S66/fmuTjx8e6U+Ijzur0/M6OakQQgjROs0OV9Bav9zCz/7TMXF6pqyshQDExNzv5CQty8/PBzrulMbu3bt5+umnueOOO7DZbMTGxrJ7927Gjj3j4KtF55rz7rvv5u677+bIkSNMnjyZpKSkNj2
2022-08-08 10:49:17 +02:00
"text/plain": [
"<Figure size 864x288 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, axes = beacon_sync_figure(\n",
" time, impulses, beacons,\n",
" delta_t = t_phi,\n",
" beacon_offsets = phase2time(beacon_init_phase, f_beacon) + t_phi,\n",
" impulse_offsets = impulses_offsets,\n",
" f_beacon = f_beacon,\n",
" show_annotations = True\n",
")\n",
"axes[0].set_title(\"Beacons synchronised\")\n",
"fig.show()\n",
"\n",
"if True:\n",
" fname = 'figures/08_beacon_sync_synchronised_outline'\n",
"\n",
" # Dump figure\n",
" fig.savefig(fname +'.pdf')"
2022-08-08 10:49:17 +02:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2022-08-05 14:26:40 +02:00
"##### 1.2 Impulse delays ($\\Delta A, kT$)\n",
"\n",
2022-08-08 10:49:17 +02:00
"###### 1.2.1 $\\Delta A$\n",
"Find the delay within a single beacon period"
]
},
{
"cell_type": "code",
2022-08-08 10:49:17 +02:00
"execution_count": 10,
"metadata": {},
2022-08-08 10:49:17 +02:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0. 7.]\n"
]
}
],
"source": [
2022-08-05 14:26:40 +02:00
"impulse_max_time = np.argmax(impulses, axis=1) /samplerate\n",
"impulse_time_in_periods = np.array((impulse_max_time - t_phi)*f_beacon)\n",
2022-08-08 10:49:17 +02:00
"someB, A = np.divmod(impulse_time_in_periods, 1)\n",
2022-08-05 14:26:40 +02:00
"\n",
"# subtract the reference beacon's value to obtain time differences\n",
"A -= A[0]\n",
2022-08-08 10:49:17 +02:00
"someB -= someB[0]\n",
"\n",
"Delta_A = A[1:] - A[0]\n",
"print(someB)"
]
},
{
2022-08-05 14:26:40 +02:00
"cell_type": "markdown",
"metadata": {},
"source": [
2022-08-08 10:49:17 +02:00
"###### 1.2.2 $kT$\n",
"Find integer number of periods"
]
},
{
"cell_type": "code",
2022-08-08 10:49:17 +02:00
"execution_count": 11,
"metadata": {},
2022-08-05 14:26:40 +02:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2022-08-08 10:49:17 +02:00
"Best k: 8\n",
"Maximum: 2.0\n"
2022-08-05 14:26:40 +02:00
]
}
],
"source": [
2022-08-08 10:49:17 +02:00
"ref_impulse = impulses[0]\n",
"my_impulse = impulses[1]\n",
"\n",
2022-08-08 10:49:17 +02:00
"# remove 'already determined' offsets\n",
"if True:\n",
" # $t_\\phi$ offset\n",
" my_impulse = time_roll(my_impulse, samplerate, -t_phi)\n",
"\n",
2022-08-08 10:49:17 +02:00
"if True:\n",
" # $\\Delta A$ offset\n",
" my_impulse = time_roll(my_impulse, samplerate, +Delta_A)\n",
"\n",
2022-08-08 10:49:17 +02:00
"best_k, (ks, maxima) = beacon_integer_period(samplerate, f_beacon, ref_impulse, my_impulse)\n",
"print(\"Best k: {:0g}\".format(best_k))\n",
"print(\"Maximum: {}\".format(maxima[np.where(ks == best_k)][0]))\n",
"B = np.array([ 0, best_k])\n"
]
},
2022-08-05 18:09:47 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
2022-08-08 10:49:17 +02:00
"#### 1.3 Total Time delay"
2022-08-05 18:09:47 +02:00
]
},
{
"cell_type": "code",
2022-08-08 10:49:17 +02:00
"execution_count": 12,
"metadata": {},
2022-08-05 18:09:47 +02:00
"outputs": [
{
2022-08-08 10:49:17 +02:00
"name": "stdout",
"output_type": "stream",
"text": [
"Δ𝐴 = [0. 5.42857143]\n",
"B = kT = [0 8]T\n",
"𝑡𝜙 = [0. 8.57142857]\n",
"Δt = 0.12828571428571425\n",
"Preset Δt = 0.11399999999999999\n"
]
2022-08-05 18:09:47 +02:00
}
],
"source": [
2022-08-08 10:49:17 +02:00
"print(\"Δ𝐴 = {}\".format(A /f_beacon/ns))\n",
"print(\"B = kT = {}T\".format(B))\n",
"print(\"𝑡𝜙 = {}\".format(t_phi/ns))\n",
"\n",
"\n",
"delta_t = A/f_beacon + B/f_beacon + t_phi\n",
"\n",
"print(\"Δt = {}\".format(delta_t[1]))\n",
"\n",
"print(\"Preset Δt = {}\".format(impulses_offsets[1,0]-impulses_offsets[0,0]))"
2022-08-05 18:09:47 +02:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### 1.3.2 Beacon Synced and Period Alignment"
]
},
{
"cell_type": "code",
2022-08-08 10:49:17 +02:00
"execution_count": 13,
2022-08-05 18:09:47 +02:00
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArkAAAEWCAYAAABi/I8SAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAB0DUlEQVR4nO3dd3hUVfrA8e+ZmfSEkgIkEBIgBAgtFGkChmIXxV5B1LWtrmvb1VVXXduqP3XtvaCIWLGBYqH3HgIJEAIEAkkIKSQE0mbm/P64k0rKBJIZGN7P88yTyZ1773vumTt33jn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9V/cXQZ3cfwAGofRmtsRoxvO924tlBDipCEtuUKIk5ZSKh3jAqTJWuuNbi6OOMk4LmhbDPTG6OM8F6NbTJFbCyaEOClIkiuEEEIIITyOXHgmhBBCCCE8Tqv0yQ0NDdXR0dGtsWohhAcrLt4KQGBgnybmPHGlpaUA+Pr6SqwWjHX06HYA/P171btMS8drLRJLYkmsU8f69etztdZhdae3SpIbHR3NunXrWmPVQggPtmKFMZTtqFGrWz1WamoqALGxsRKrBWNt3JgAwKBBi1wSr7VILIklsU4dSqk99U2X0RWEEEK0mJIKG+VWu7uLIYQQ0idXCCHE8XvqqaeIijKGpdVas/NgMduzD5NzuNTNJRNCnO5aZXSFoUOHaumuIIQQnm337t1MmjSJvLw8UlNT2Z5XwboNZwFwNPBb7j+n5fvlCiFEXUqp9VrroXWnS0uuEEKI4/LEE0/w2GOPERcXR3JyMh8u3Y3ZZKKtnxefr95LaUWL311XCCGcJkmuEEK
2022-08-05 18:09:47 +02:00
"text/plain": [
"<Figure size 864x288 with 3 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig, axes = beacon_sync_figure(\n",
" time, impulses, beacons,\n",
" delta_t = (B + [0,-0])/f_beacon + t_phi,\n",
" beacon_offsets = phase2time(beacon_init_phase, f_beacon) + t_phi,\n",
" impulse_offsets = impulses_offsets,\n",
" f_beacon = f_beacon,\n",
" show_annotations = True\n",
")\n",
2022-08-08 10:49:17 +02:00
"axes[0].set_title(\"Beacons synchronised, Period alignment\")\n",
"fig.show()\n",
"if True:\n",
" fname = 'figures/08_beacon_sync_synchronised_period_alignment'\n",
"\n",
" # Dump figure\n",
" fig.savefig(fname +'.pdf')"
2022-08-05 18:09:47 +02:00
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.9.12"
}
},
"nbformat": 4,
"nbformat_minor": 4
}