From cbf17ca83033437cc1bc611faec510a930fc539a Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Wed, 5 Oct 2022 18:13:10 +0200 Subject: [PATCH 01/10] figure: antenna_setup optional annotate t_d --- figures/beacon/src/four_antenna_setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/figures/beacon/src/four_antenna_setup.py b/figures/beacon/src/four_antenna_setup.py index 0d22719..a889b0f 100755 --- a/figures/beacon/src/four_antenna_setup.py +++ b/figures/beacon/src/four_antenna_setup.py @@ -63,7 +63,7 @@ def antenna_baselines(antennas): return combinations(antennas, 2) -def plot_four_antenna_geometry(tx, ants, extra_ant=None, ax=None, line_kwargs={}, scatter_kwargs={}, scatter_zorder=5): +def plot_four_antenna_geometry(tx, ants, extra_ant=None, ax=None, line_kwargs={}, scatter_kwargs={}, scatter_zorder=5, annotate_td=True): default_line_kwargs = dict( color='grey', lw=3, alpha=0.7) default_scatter_kwargs = dict( color='grey', s=200) @@ -88,9 +88,19 @@ def plot_four_antenna_geometry(tx, ants, extra_ant=None, ax=None, line_kwargs={} # Lines connecting Tx and ants tmp_line_kwargs = line_kwargs + tmp_line_kwargs['linestyle'] = '--' for ant in ants: ax.plot([tx.x, ant.x], [tx.y, ant.y], **tmp_line_kwargs) + if annotate_td: + annot_kwargs = dict(va='bottom', ha='center') + dx, dy = 0, 0.1 + x = (tx.x + ant.x)/2 + dx + y = (tx.y + ant.y)/2 + dy + + + ax.annotate(f'$t_{{d{ant.name}}}$', (x,y), **annot_kwargs) + # Lines due to all Antennas (including extra_ant) if extra_ant is not None: line_offset = 0.08*np.array([1,1]) @@ -111,6 +121,7 @@ def plot_four_antenna_geometry(tx, ants, extra_ant=None, ax=None, line_kwargs={} # Lines internal to ants triangle tmp_line_kwargs = line_kwargs tmp_line_kwargs['color'] = 'green' + tmp_line_kwargs['linestyle'] = '-' tmp_line_kwargs['alpha'] = 0.7 for j, ant_pair in enumerate(combinations(ants,2)): a, b = ant_pair[0], ant_pair[1] From 500e9fb32345958611a165b3f0393d6e98b11a76 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Wed, 5 Oct 2022 18:24:58 +0200 Subject: [PATCH 02/10] make: rename field figures --- figures/beacon/Makefile | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/figures/beacon/Makefile b/figures/beacon/Makefile index a9305d7..ada0eb6 100644 --- a/figures/beacon/Makefile +++ b/figures/beacon/Makefile @@ -4,20 +4,20 @@ all: dist dist: \ sine_beacon.pdf sine_beacon.png \ ttl_beacon.pdf ttl_beacon.png \ - field_singleleft_time.pdf field_singleleft_time.png \ - field_singleleft_phase.pdf field_singleleft_phase.png \ - field_singlecenter_time.pdf field_singlecenter_time.png \ - field_singlecenter_phase.pdf field_singlecenter_phase.png \ + field_single_left_time.pdf field_single_left_time.png \ + field_single_left_phase.pdf field_single_left_phase.png \ + field_single_center_time.pdf field_single_center_time.png \ + field_single_center_phase.pdf field_single_center_phase.png \ antenna_setup_four.pdf antenna_setup_four.png \ antenna_setup_three.pdf antenna_setup_three.png dist-clean: rm -v sine_beacon.* rm -v ttl_beacon.* - rm -v field_singleleft_time.* - rm -v field_singleleft_phase.* - rm -v field_singlecenter_time.* - rm -v field_singlecenter_phase.* + rm -v field_single_left_time.* + rm -v field_single_left_phase.* + rm -v field_single_center_time.* + rm -v field_single_center_phase.* beacon_spatial_time_difference_setup.pdf: src/beacon_spatial_time_difference_setup.py $< $@ @@ -28,14 +28,15 @@ sine_beacon.%: src/single_beacon.py ttl_beacon.%: src/single_beacon.py $< --periods 2 --no-grid --with-rates ttl $@ -field_singleleft_time.%: src/beacon_field.py + +field_single_left_time.%: src/beacon_field.py $< --time $@ single-left -field_singleleft_phase.%: src/beacon_field.py +field_single_left_phase.%: src/beacon_field.py $< --phase $@ single-left -field_singlecenter_time.%: src/beacon_field.py +field_single_center_time.%: src/beacon_field.py $< --time $@ single-center -field_singlecenter_phase.%: src/beacon_field.py +field_single_center_phase.%: src/beacon_field.py $< --phase $@ single-center antenna_setup_four.%: src/four_antenna_setup.py From fdae3fd66528fefbedeff1985150f058c45d404b Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Wed, 5 Oct 2022 18:59:35 +0200 Subject: [PATCH 03/10] figure: fix beacon_field for phase --- figures/beacon/src/beacon_field.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/figures/beacon/src/beacon_field.py b/figures/beacon/src/beacon_field.py index d09c7ed..523bbc1 100755 --- a/figures/beacon/src/beacon_field.py +++ b/figures/beacon/src/beacon_field.py @@ -53,6 +53,9 @@ def grid_plot(grid, ax=None, **plot_kwargs): if ax is None: ax = plt.gca() + if not grid: + return + x = [a.x for a in grid] y = [a.y for a in grid] l = [a.name for a in grid] @@ -127,7 +130,9 @@ def plot_field( scatter_kwargs = {**default_scatter_kwargs, **scatter_kwargs} - grid_plot([tx] + ants, ax=ax) + if tx or ants: + grid_plot([tx] + ants, ax=ax) + if ref_ant is not None: ax.set_title("Single baseline\n reference antenna={}, f={}MHz".format(ref_ant.name, f_beacon/1e6)) else: From a0ecca113b816e4aefe465b7bb2fc53772deb6d8 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Wed, 5 Oct 2022 19:05:19 +0200 Subject: [PATCH 04/10] figure: fix beacon_field for ref_ant --- figures/beacon/src/beacon_field.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/figures/beacon/src/beacon_field.py b/figures/beacon/src/beacon_field.py index 523bbc1..1970f22 100755 --- a/figures/beacon/src/beacon_field.py +++ b/figures/beacon/src/beacon_field.py @@ -184,7 +184,7 @@ if __name__ == "__main__": command_group.add_argument('--time', help='Use the time difference for the field', action='store_false') command_group.add_argument('--phase', help='Use wrapped phase for the field', action='store_true') - parser.add_argument('--ref', dest='ref_ant', metavar='ref_antenna', help='Number of antenna to use as reference') + parser.add_argument('--ref', dest='ref_ant', metavar='ref_antenna', type=int, help='Number of antenna to use as reference') args = parser.parse_args() @@ -248,7 +248,10 @@ if __name__ == "__main__": ### Options ### plot_phase = args.plot_phase - ref_ant = args.ref_ant + if args.ref_ant: + ref_ant = ants[args.ref_ant] + else: + ref_ant = None ant_combi = antenna_combinations(ants, ref_ant=ref_ant) From d73d007164443f9a237744baa4b34caf0486c6b7 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Wed, 5 Oct 2022 19:27:27 +0200 Subject: [PATCH 05/10] make: reorganised beacon makefile --- figures/beacon/Makefile | 50 ++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/figures/beacon/Makefile b/figures/beacon/Makefile index ada0eb6..7401f75 100644 --- a/figures/beacon/Makefile +++ b/figures/beacon/Makefile @@ -2,14 +2,11 @@ all: dist dist: \ - sine_beacon.pdf sine_beacon.png \ - ttl_beacon.pdf ttl_beacon.png \ - field_single_left_time.pdf field_single_left_time.png \ - field_single_left_phase.pdf field_single_left_phase.png \ - field_single_center_time.pdf field_single_center_time.png \ - field_single_center_phase.pdf field_single_center_phase.png \ - antenna_setup_four.pdf antenna_setup_four.png \ - antenna_setup_three.pdf antenna_setup_three.png + single_beacon \ + field_single \ + field_square \ + antenna_setup \ + # dist-clean: rm -v sine_beacon.* @@ -18,10 +15,18 @@ dist-clean: rm -v field_single_left_phase.* rm -v field_single_center_time.* rm -v field_single_center_phase.* + rm -v field_square_all_time.* + rm -v field_square_all_phase.* + rm -v field_square_ref0_time.* + rm -v field_square_ref0_phase.* beacon_spatial_time_difference_setup.pdf: src/beacon_spatial_time_difference_setup.py $< $@ +single_beacon: \ + sine_beacon.pdf sine_beacon.png \ + ttl_beacon.pdf ttl_beacon.png + sine_beacon.%: src/single_beacon.py $< --periods 2 --no-grid --with-rates sine $@ @@ -29,6 +34,13 @@ ttl_beacon.%: src/single_beacon.py $< --periods 2 --no-grid --with-rates ttl $@ +field_single: \ + field_single_left_time.pdf field_single_left_time.png \ + field_single_left_phase.pdf field_single_left_phase.png \ + field_single_center_time.pdf field_single_center_time.png \ + field_single_center_phase.pdf field_single_center_phase.png \ + # + field_single_left_time.%: src/beacon_field.py $< --time $@ single-left field_single_left_phase.%: src/beacon_field.py @@ -39,6 +51,28 @@ field_single_center_time.%: src/beacon_field.py field_single_center_phase.%: src/beacon_field.py $< --phase $@ single-center + +field_square: \ + field_square_all_time.pdf field_square_all_time.png \ + field_square_all_phase.pdf field_square_all_phase.png \ + field_square_ref0_time.pdf field_square_ref0_time.png \ + field_square_ref0_phase.pdf field_square_ref0_phase.png \ + # + +field_square_ref0_time.%: src/beacon_field.py + $< --time $@ square --ref 0 +field_square_ref0_phase.%: src/beacon_field.py + $< --phase $@ square --ref 0 +field_square_all_time.%: src/beacon_field.py + $< --time $@ square +field_square_all_phase.%: src/beacon_field.py + $< --phase $@ square + +antenna_setup: \ + antenna_setup_four.pdf antenna_setup_four.png \ + antenna_setup_three.pdf antenna_setup_three.png \ + # + antenna_setup_four.%: src/four_antenna_setup.py $< $@ From 6a2513f3135f4f089013a21995ea2d9ee1deb29e Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Wed, 5 Oct 2022 18:49:14 +0200 Subject: [PATCH 06/10] CRHEP presentation on beacons --- .../2022-10-06_CRHEP.tex | 195 ++++++++++++++++++ .../2022-10-06_group_meeting/Makefile | 24 +++ .../2022-10-06_group_meeting/README.md | 8 + .../2022-10-06_group_meeting/config.mk | 1 + 4 files changed, 228 insertions(+) create mode 100644 presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex create mode 100644 presentations/2022-10-06_group_meeting/Makefile create mode 100644 presentations/2022-10-06_group_meeting/README.md create mode 100644 presentations/2022-10-06_group_meeting/config.mk diff --git a/presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex b/presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex new file mode 100644 index 0000000..8145292 --- /dev/null +++ b/presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex @@ -0,0 +1,195 @@ +\documentclass[showdate=false]{beamer} + +\usepackage[british]{babel} +\usepackage{amsmath} +\usepackage{hyperref} +\usepackage[backend=bibtex,style=trad-plain]{biblatex} +\usepackage{graphicx} +\graphicspath{{.}{../../figures/}} +\usepackage{todo} + +\addbibresource{../../../bibliotheca/bibliography.bib} + +% Disable Captions +\setbeamertemplate{caption}{\raggedright\small\insertcaption\par} + +% Show Section overview at beginning of section +%\AtBeginSection[] +%{ +% \begin{frame}{Table of Contents} +% \tableofcontents[currentsection, currentsubsection, sectionstyle=show/shaded, subsectionstyle=hide] +% \end{frame} +%} + +% no to navigation, yes to frame numbering +\beamertemplatenavigationsymbolsempty +\setbeamerfont{page number in head/foot}{size=\normalsize} +\setbeamertemplate{footline}[frame number] + +\title[Beacon Timing]{Enhancing Timing Accuracy using Beacons} +\date{Oct 06, 2022} +\author{E.T. de Boone} + +\begin{document} +\frame{\titlepage} + +\begin{frame}{Enhancing time accuracy} + \begin{block}{} + Goal: $\sigma_t < 1\mathrm{ns}$ + (enabling Radio Interferometry) + \end{block} + + \begin{block}{Strategy} + \begin{itemize} + \item Simulating beacons + \item Characterising GNSS (GRAND) + \end{itemize} + \end{block} + + \begin{block}{Current Timing Methods} + \begin{itemize} + \item GNSS (online) (GPS: $\sigma_t \leq 30 \mathrm{ns}$ $@95\%$ of the time) + \item Beacon (online/offline) + \end{itemize} + \end{block} +\end{frame} + +% Antenna Setup +\section{Beacon} + +\begin{frame}{Antenna Setup} + \begin{block}{} + Local time $i$ due to time delay $t_{\mathrm{d}i}$ and clock skew $\sigma_i$\\ + \end{block} + \begin{figure} + \includegraphics<1>[width=0.8\textwidth]{beacon/antenna_setup_three.pdf} + \includegraphics<2->[width=0.8\textwidth]{beacon/antenna_setup_four.pdf} + \vspace{-2cm} + \end{figure} + \begin{equation*} + \Delta t'_{12} = t'_1 - t'_2 = \Delta t_{\mathrm{d}12} + \sigma_{12} + \end{equation*} + \begin{equation*} + \sigma_{12} + \sigma_{23} + \sigma_{31} = 0 + \end{equation*} +\end{frame} + +\begin{frame}{Beacon properties} + %\Todo{Pulse vs Sine and why choose one over the other} + %Pulse: + % online only + % direct measurement of \sigma_i + + %Sine: + % online and offline + % measurement of phase + % removable if f appropriate + + %\begin{table} + % \centering + % \begin{tabular}{r|l|l} + % & Pulse & Sine \\ + % \hline \\ + % on/offline & online & online + offline \\ + % measurement & $t'_i (= t_i + \sigma_i)$ & $\varphi'_i (= 2\pi (\frac{t'_i}{T}\mod 1))$ \\ + % resolving & requires high sampling rate & tracelength dependent \\ + % removable from trace & unsure & if $f$ appropriate \\ + % \end{tabular} + %\end{table} + + \begin{columns}[t] + \begin{column}{.45\textwidth} + \begin{block}{Pulse} + \begin{itemize} + \item online + \item $t'_i$ {\small $(= t_i + \sigma_i)$} + \item resolving requires high sampling rate + \end{itemize} + \end{block} + \end{column} + \hfill + \begin{column}{.45\textwidth} + \begin{block}{Sine} + \begin{itemize} + \item online + offline + \item $\varphi'_i$ {\small $(= 2\pi (ft'_i\mod 1))$} + \item resolving is tracelength dependent + \item removable from physics if $f$ appropriate + \end{itemize} + \end{block} + \end{column} + \end{columns} +\end{frame} + +\subsection{Pulse} +\begin{frame}{Beacon: Pulse (single baseline)} + \begin{figure} + \includegraphics<1>[width=\textwidth]{beacon/field_single_center_time.pdf} + \includegraphics<2>[width=\textwidth]{beacon/field_single_left_time.pdf} + \end{figure} +\end{frame} +\begin{frame}{Beacon: Pulse (3 baselines)} + \begin{figure} + \includegraphics<1>[width=\textwidth]{beacon/field_three_center_time.pdf} + \includegraphics<2>[width=\textwidth]{beacon/field_three_left_time.pdf} + \end{figure} +\end{frame} + +\begin{frame}{Beacon: Pulse (multi baseline)} + \begin{figure} + \includegraphics<1>[width=\textwidth]{beacon/field_square_ref0_time.pdf} + \includegraphics<2>[width=\textwidth]{beacon/field_square_all_time.pdf} + \end{figure} +\end{frame} + +\subsection{Sine} +\begin{frame}{Beacon: Sine (single baseline)} + \begin{figure} + \includegraphics<1>[width=\textwidth]{beacon/field_single_center_phase.pdf} + \includegraphics<2>[width=\textwidth]{beacon/field_single_left_phase.pdf} + \end{figure} +\end{frame} +\begin{frame}{Beacon: Sine (3 baseline)} + \begin{figure} + \includegraphics<1>[width=\textwidth]{beacon/field_three_center_phase.pdf} + \includegraphics<2>[width=\textwidth]{beacon/field_three_left_phase.pdf} + \end{figure} +\end{frame} + +\begin{frame}{Beacon: Sine (multi baseline)} + \begin{figure} + \includegraphics<1>[width=\textwidth]{beacon/field_square_ref0_phase.pdf} + \includegraphics<2>[width=\textwidth]{beacon/field_square_all_phase.pdf} + \end{figure} +\end{frame} + +\begin{frame}{Beacon: Sine: Two traces} + \begin{equation*} + t'_i = [t_i + \sigma_i] \mod T + n_i T = (\frac{\varphi'_i}{2\pi} + n_i)T = A_i + B_i + \end{equation*} + \begin{figure} + \includegraphics[width=1\textwidth]{beacon/08_beacon_sync_timing_outline.pdf} + \end{figure} + \begin{align*} + \Delta t_{ij} &= (A_j + B_j) - (A_i + B_i) + \Delta t_\varphi \\ + &= \Delta A_{ij} + t_\varphi + k_{ij}T\\ + \end{align*} +\end{frame} + +\begin{frame}{Beacon: Sine: Two traces: Discrete solutions} + \begin{figure} + \includegraphics<1>[width=1\textwidth]{beacon/08_beacon_sync_timing_outline.pdf} + \includegraphics<2-3>[width=1\textwidth]{beacon/08_beacon_sync_synchronised_period_alignment.pdf} + \end{figure} + \alt<1-2> + { + \begin{figure} + \includegraphics[width=1\textwidth]{beacon/08_beacon_sync_coherent_sum.pdf} + \end{figure} + }{ + \begin{block}{Work in Progress} + Simulated airshower + sine beacon and determining the relative offsets between the antennas... + \end{block} + } +\end{frame} +\end{document} diff --git a/presentations/2022-10-06_group_meeting/Makefile b/presentations/2022-10-06_group_meeting/Makefile new file mode 100644 index 0000000..449c34a --- /dev/null +++ b/presentations/2022-10-06_group_meeting/Makefile @@ -0,0 +1,24 @@ +# vim:ft=make +-include config.mk + +.PHONY: all clean dist-clean + +### Variables +MAIN_SRC ?= main.tex +TEXENGINE ?= latexmk --pdf + +MAIN_TARGET = $(patsubst %.tex,%.pdf,$(MAIN_SRC)) + +### Targets +all: $(MAIN_TARGET) + +dist: all clean + +$(MAIN_TARGET): $(MAIN_SRC) + $(TEXENGINE) $^ + +dist-clean: clean + @rm -vf *.pdf *.eps *.dvi *.ps + +clean: + @rm -vf *.dat *.log *.out *.aux *.nav *.snm *.toc *.vrb *~ *.fls *.fdb_latexmk *-blx.bib *.bbl *.blg *.run.xml diff --git a/presentations/2022-10-06_group_meeting/README.md b/presentations/2022-10-06_group_meeting/README.md new file mode 100644 index 0000000..1651da3 --- /dev/null +++ b/presentations/2022-10-06_group_meeting/README.md @@ -0,0 +1,8 @@ +# Short Presentation on current status (Beacon) + +Mostly to show what I've been doing uptil now. + +### Outline + * Timing Mechanisms (GNSS, Beacon) + + * Geometry of testing Tx and Antennas diff --git a/presentations/2022-10-06_group_meeting/config.mk b/presentations/2022-10-06_group_meeting/config.mk new file mode 100644 index 0000000..53e4f12 --- /dev/null +++ b/presentations/2022-10-06_group_meeting/config.mk @@ -0,0 +1 @@ +MAIN_SRC=2022-10-06_CRHEP.tex From 8ac7306f23c1f74e299d9419b7030b5621a813ac Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 6 Oct 2022 09:20:14 +0200 Subject: [PATCH 07/10] figure beacon_field: three antenna setup + zoom on tx + variable vmax --- figures/beacon/Makefile | 35 +++++++++ figures/beacon/src/beacon_field.py | 109 ++++++++++++++++++++++------- 2 files changed, 120 insertions(+), 24 deletions(-) diff --git a/figures/beacon/Makefile b/figures/beacon/Makefile index 7401f75..7bf6c17 100644 --- a/figures/beacon/Makefile +++ b/figures/beacon/Makefile @@ -4,6 +4,7 @@ all: dist dist: \ single_beacon \ field_single \ + field_three \ field_square \ antenna_setup \ # @@ -15,6 +16,10 @@ dist-clean: rm -v field_single_left_phase.* rm -v field_single_center_time.* rm -v field_single_center_phase.* + rm -v field_three_left_time.* + rm -v field_three_left_phase.* + rm -v field_three_center_time.* + rm -v field_three_center_phase.* rm -v field_square_all_time.* rm -v field_square_all_phase.* rm -v field_square_ref0_time.* @@ -51,12 +56,33 @@ field_single_center_time.%: src/beacon_field.py field_single_center_phase.%: src/beacon_field.py $< --phase $@ single-center +field_three: \ + field_three_left_time.pdf field_three_left_time.png \ + field_three_left_phase.pdf field_three_left_phase.png \ + field_three_center_time.pdf field_three_center_time.png \ + field_three_center_phase.pdf field_three_center_phase.png \ + # + +field_three_left_time.%: src/beacon_field.py + $< --time $@ three-left +field_three_left_phase.%: src/beacon_field.py + $< --phase $@ three-left + +field_three_center_time.%: src/beacon_field.py + $< --time $@ three-center +field_three_center_phase.%: src/beacon_field.py + $< --phase $@ three-center + field_square: \ field_square_all_time.pdf field_square_all_time.png \ field_square_all_phase.pdf field_square_all_phase.png \ field_square_ref0_time.pdf field_square_ref0_time.png \ field_square_ref0_phase.pdf field_square_ref0_phase.png \ + field_square_all_time_zoomtx.pdf field_square_all_time_zoomtx.png \ + field_square_all_phase_zoomtx.pdf field_square_all_phase_zoomtx.png \ + field_square_ref0_time_zoomtx.pdf field_square_ref0_time_zoomtx.png \ + field_square_ref0_phase_zoomtx.pdf field_square_ref0_phase_zoomtx.png \ # field_square_ref0_time.%: src/beacon_field.py @@ -68,6 +94,15 @@ field_square_all_time.%: src/beacon_field.py field_square_all_phase.%: src/beacon_field.py $< --phase $@ square +field_square_ref0_time_zoomtx.%: src/beacon_field.py + $< --time $@ square --ref 0 --zoom tx +field_square_ref0_phase_zoomtx.%: src/beacon_field.py + $< --phase $@ square --ref 0 --zoom tx +field_square_all_time_zoomtx.%: src/beacon_field.py + $< --time $@ square --zoom tx +field_square_all_phase_zoomtx.%: src/beacon_field.py + $< --phase $@ square --zoom tx + antenna_setup: \ antenna_setup_four.pdf antenna_setup_four.png \ antenna_setup_three.pdf antenna_setup_three.png \ diff --git a/figures/beacon/src/beacon_field.py b/figures/beacon/src/beacon_field.py index 1970f22..79ce15e 100755 --- a/figures/beacon/src/beacon_field.py +++ b/figures/beacon/src/beacon_field.py @@ -49,19 +49,24 @@ def phase(a,b,f=f_beacon,wrap=False): return phase -def grid_plot(grid, ax=None, **plot_kwargs): +def grid_plot(grid, text_dx=(0,0), ax=None, plot_kwargs={}, annot_kwargs={}): if ax is None: ax = plt.gca() if not grid: return + default_plot_kwargs=dict(color='k', marker='x', markersize=10, linestyle='None') + plot_kwargs = {**default_plot_kwargs, **plot_kwargs} + x = [a.x for a in grid] y = [a.y for a in grid] l = [a.name for a in grid] - ax.plot(x,y,'kx', **plot_kwargs) - for x_,y_,l_ in zip(x,y,l): - ax.annotate(l_,(x_,y_)) + ax.plot(x, y, **plot_kwargs) + + if annot_kwargs is not None: + for x_,y_,l_ in zip(x,y,l): + ax.annotate(l_,(x_,y_), xytext=(x_+text_dx[0], y_+text_dx[0]), **annot_kwargs) def antenna_combinations(ants, ref_ant=None): if ref_ant is not None: # use only one reference antenna for the baselines @@ -111,10 +116,13 @@ def plot_field( ref_ant=None, plot_phase=None, mask=None, color_label='$\\left( t - \\tau \\right)^2$', ax=None, bin_type='square', colorbar=True, + grid_kwargs={}, **scatter_kwargs ): if ax is None: ax = plt.gca() + ax.set_xlabel('x') + ax.set_ylabel('y') default_scatter_kwargs = {} default_scatter_kwargs['cmap'] = 'Spectral_r' @@ -131,12 +139,48 @@ def plot_field( scatter_kwargs = {**default_scatter_kwargs, **scatter_kwargs} if tx or ants: - grid_plot([tx] + ants, ax=ax) + grid_plot_kwargs = dict(marker='X', color='w', alpha=0.8, markeredgecolor='k', markeredgewidth=1) + grid_text_kwargs = dict( + fontsize='large', + color='k', + bbox=dict(boxstyle='Round', alpha=0.5, facecolor='w') + ) - if ref_ant is not None: - ax.set_title("Single baseline\n reference antenna={}, f={}MHz".format(ref_ant.name, f_beacon/1e6)) + if 'plot_kwargs' in grid_kwargs: + grid_plot_kwargs = {**grid_plot_kwargs, **grid_kwargs['plot_kwargs']} + if 'text_kwargs' in grid_kwargs: + grid_text_kwargs = {**grid_text_kwargs, **grid_kwargs['text_kwargs']} + + if tx: + grid_plot([tx], text_dx=(20, 0), ax=ax, plot_kwargs=grid_plot_kwargs, annot_kwargs=grid_text_kwargs) + + if len(ants) > 3: + grid_text_kwargs = None + + grid_plot(ants, text_dx=(20, 0), ax=ax, plot_kwargs=grid_plot_kwargs, annot_kwargs=grid_text_kwargs) + + title = '' + if len(ants) == 1: + title += "Single Antenna\n" + elif len(ants) == 2: + title += "Single Baseline\n" else: - ax.set_title("All baselines\n f={} MHz".format(f_beacon/1e6)) + if len(ants) == 3: + title += "Three Baseline" + else: + if ref_ant is not None: + title += "MultiBaseline" + else: + title += "All Baselines" + + if ref_ant is not None: + title += " with Reference antenna={}".format(ref_ant.name) + + title += "\n" + + title += "f=${}$MHz".format(f_beacon/1e6) + + ax.set_title(title) if bin_type == 'hex': # hexbin sc = ax.hexbin(xx, yy, C=val, **scatter_kwargs) @@ -175,27 +219,28 @@ if __name__ == "__main__": parser = ArgumentParser(description=__doc__) parser.add_argument("fname", metavar="path/to/figure[/]", nargs="?", help="Location for generated figure, will append __file__ if a directory. If not supplied, figure is shown.") - - - parser.add_argument("type", choices=['single-left', 'single-center', 'square', 'tri', 'preset']) - + parser.add_argument("type", choices=['single-left', 'single-center','three-left', 'three-center', 'square', 'tri', 'preset']) command_group = parser.add_mutually_exclusive_group(required=True) command_group.add_argument('--time', help='Use the time difference for the field', action='store_false') command_group.add_argument('--phase', help='Use wrapped phase for the field', action='store_true') parser.add_argument('--ref', dest='ref_ant', metavar='ref_antenna', type=int, help='Number of antenna to use as reference') + parser.add_argument('--max-rms', dest='max_rms', metavar='max_rms', type=float, help='Maximum rms to show in colorbar', default=True) + parser.add_argument('--zoom', choices=['none', 'tx'], help='Zoom to object', default='none') args = parser.parse_args() if args.fname is not None and path.isdir(args.fname): - args.fname = path.join(args.fname, path.splitext(path.basename(__file__))[0] + ".pdf") + args.fname = path.join(args.fname, path.splitext(path.basename(__file__))[0]) # leave off extension + + if not path.splitext(args.fname)[1]: + args.fname = [ args.fname+ext for ext in ['.pdf', '.png'] ] args.plot_phase = args.phase or args.time del args.time, args.phase - - if 'single' in args.type: # single baseline + if 'single' in args.type or 'three' in args.type: # single baseline ### Field x_low, x_high, N_x = -300, 300, 151 y_low, y_high, N_y = -300, 300, 151 @@ -206,7 +251,10 @@ if __name__ == "__main__": Antenna(x=50,y=0,z=0,name="b"), ] - if args.type == 'single-center': + if 'three' in args.type: + ants.append(Antenna(x=0, y=-50,z=0, name='c')) + + if 'center' in args.type: tx = Antenna(x=-000,y=200,z=0,name="tx") else: tx = Antenna(x=-200,y=200,z=0,name="tx") @@ -218,7 +266,7 @@ if __name__ == "__main__": ### Geometry tx = Antenna(x=-800,y=300,z=0,name="tx") - x_start, dx, ant_N_x = 0, 50, 2 + x_start, dx, ant_N_x = 0, 50, 3 y_start, dy, ant_N_y = 0, dx, ant_N_x if args.type == 'square': # square grid @@ -244,11 +292,18 @@ if __name__ == "__main__": Antenna(x=125,y=180,z=0,name="d"), ] + if args.zoom != 'none': # tx zoom + if args.zoom == 'tx': + x_low, x_high, N_x = tx.x - 40, tx.x + 40, 81 + y_low, y_high, N_y = -x_low, x_high, N_x + else: + raise NotImplementedError# args.zoom + ### ### Options ### plot_phase = args.plot_phase - if args.ref_ant: + if args.ref_ant is not None: ref_ant = ants[args.ref_ant] else: ref_ant = None @@ -265,21 +320,23 @@ if __name__ == "__main__": kwargs = {} mask = None if plot_phase: - color_label='$\\sqrt{ \\sum \\left(\\varphi(x) - \\Delta \\varphi\\right)^2}$' + color_label='$\\sqrt{ \\sum_{(i,j)} \\left(\\Delta\\varphi_{ij}(x) - \\Delta \\varphi_{ij}\\right)^2}$' mask = abs(val) > np.pi else: - color_label='$\\sqrt{ \\sum \\left(t(x) - \\Delta t\\right)^2}$ [ns]' + color_label='$\\sqrt{ \\sum_{(i,j)} \\left(\Delta t_{ij}(x) - \\Delta t_{ij}\\right)^2}$ [ns]' val *= 1e9 - kwargs['vmax'] = 100 + if args.max_rms: + kwargs['vmax'] = 100 if args.max_rms is True else args.max_rms + if not True: mask = abs(val) > 1.1*kwargs['vmax'] if mask is not None: - ax = plot_field([], [], xx, yy, val, cmap='Greys', colorbar=False) + ax = plot_field([], [], xx, yy, val, cmap='Greys', colorbar=False, alpha=0.5) ax = plot_field(tx, ants, xx, yy, val, ref_ant=ref_ant, mask=mask, color_label=color_label, **kwargs) - + # if plot_phase: # N_lowest = np.min(len(ant_combi)-1, 10) # lowest_idx = np.argpartition(val, N_lowest)[:N_lowest] @@ -289,6 +346,10 @@ if __name__ == "__main__": # print( list(zip(np.array(xx)[lowest_idx], np.array(yy)[lowest_idx])) ) if args.fname is not None: - plt.savefig(args.fname) + if isinstance(args.fname, str): + args.fname = [args.fname] + + for fname in args.fname: + plt.savefig(fname) else: plt.show() From 978278f80d0b5714993ff87bada33ddca77f9894 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 6 Oct 2022 09:20:45 +0200 Subject: [PATCH 08/10] CRHEP presentation as planned to give --- .../2022-10-06_CRHEP.tex | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex b/presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex index 8145292..7712d8a 100644 --- a/presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex +++ b/presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex @@ -156,40 +156,52 @@ \end{figure} \end{frame} -\begin{frame}{Beacon: Sine (multi baseline)} +\begin{frame}{Beacon: Sine (multi baseline reference antenna)} \begin{figure} \includegraphics<1>[width=\textwidth]{beacon/field_square_ref0_phase.pdf} - \includegraphics<2>[width=\textwidth]{beacon/field_square_all_phase.pdf} + \includegraphics<2>[width=\textwidth]{beacon/field_square_ref0_phase_zoomtx.pdf} \end{figure} \end{frame} + +\begin{frame}{Beacon: Sine (all baselines)} + \begin{figure} + \includegraphics<1>[width=\textwidth]{beacon/field_square_all_phase.pdf} + \includegraphics<2>[width=\textwidth]{beacon/field_square_all_phase_zoomtx.pdf} + \end{figure} +\end{frame} + +\subsection{Solving Sine Beacon} \begin{frame}{Beacon: Sine: Two traces} \begin{equation*} - t'_i = [t_i + \sigma_i] \mod T + n_i T = (\frac{\varphi'_i}{2\pi} + n_i)T = A_i + B_i + t'_i = (\frac{\varphi'_i}{2\pi} + n_i)T = A_i + B_i \end{equation*} \begin{figure} \includegraphics[width=1\textwidth]{beacon/08_beacon_sync_timing_outline.pdf} \end{figure} \begin{align*} \Delta t_{ij} &= (A_j + B_j) - (A_i + B_i) + \Delta t_\varphi \\ - &= \Delta A_{ij} + t_\varphi + k_{ij}T\\ + &= \Delta A_{ij} + \Delta t_\varphi + k_{ij}T\\ \end{align*} \end{frame} \begin{frame}{Beacon: Sine: Two traces: Discrete solutions} \begin{figure} \includegraphics<1>[width=1\textwidth]{beacon/08_beacon_sync_timing_outline.pdf} - \includegraphics<2-3>[width=1\textwidth]{beacon/08_beacon_sync_synchronised_period_alignment.pdf} + \includegraphics<2>[width=1\textwidth]{beacon/08_beacon_sync_synchronised_period_alignment.pdf} \end{figure} - \alt<1-2> - { \begin{figure} \includegraphics[width=1\textwidth]{beacon/08_beacon_sync_coherent_sum.pdf} \end{figure} - }{ - \begin{block}{Work in Progress} - Simulated airshower + sine beacon and determining the relative offsets between the antennas... - \end{block} - } +\end{frame} + +\begin{frame}{Work in Progress} + \begin{block}{Repeat analysis on simulated airshower (without noise)} + \begin{enumerate} + \item Add beacon to each antenna + \item Assign clock offsets + \end{enumerate} + then determine the relative offsets between the antennas + \end{block} \end{frame} \end{document} From 5257be011251df2d2cf7f4a7636f770680814be2 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 6 Oct 2022 11:11:02 +0200 Subject: [PATCH 09/10] figure: antenna setup for two antennas --- figures/beacon/Makefile | 3 +++ figures/beacon/src/four_antenna_setup.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/figures/beacon/Makefile b/figures/beacon/Makefile index 7bf6c17..7af0524 100644 --- a/figures/beacon/Makefile +++ b/figures/beacon/Makefile @@ -113,3 +113,6 @@ antenna_setup_four.%: src/four_antenna_setup.py antenna_setup_three.%: src/four_antenna_setup.py $< --no-extra $@ + +antenna_setup_two.%: src/four_antenna_setup.py + $< --no-extra $@ 2 diff --git a/figures/beacon/src/four_antenna_setup.py b/figures/beacon/src/four_antenna_setup.py index a889b0f..53509aa 100755 --- a/figures/beacon/src/four_antenna_setup.py +++ b/figures/beacon/src/four_antenna_setup.py @@ -140,6 +140,7 @@ if __name__ == "__main__": parser = ArgumentParser(description=__doc__) parser.add_argument("fname", metavar="path/to/figure[/]", nargs="?", help="Location for generated figure, will append __file__ if a directory. If not supplied, figure is shown.") + parser.add_argument('num_ant', help='Number of antennas to show 2, 3', default=3, type=int) parser.add_argument("--no-extra", dest='extra', action='store_false', help='Disable the extra (fourth) antenna') args = parser.parse_args() @@ -155,6 +156,9 @@ if __name__ == "__main__": Antenna(name='3', x=1, y= 3, t0=10 ), ] + if args.num_ant < 3: + ants = [ants[0], ants[1]] + if args.extra: extra_ant = Antenna(name='4', x=4, y=-1, t0=-6) all_ants = ants + [extra_ant] From dd342b109015848478497e4a2b8b6e4d9fe48ccb Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 6 Oct 2022 11:11:30 +0200 Subject: [PATCH 10/10] CRHEP presenetation as given --- .../2022-10-06_group_meeting/2022-10-06_CRHEP.tex | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex b/presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex index 7712d8a..39906f7 100644 --- a/presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex +++ b/presentations/2022-10-06_group_meeting/2022-10-06_CRHEP.tex @@ -62,14 +62,15 @@ Local time $i$ due to time delay $t_{\mathrm{d}i}$ and clock skew $\sigma_i$\\ \end{block} \begin{figure} - \includegraphics<1>[width=0.8\textwidth]{beacon/antenna_setup_three.pdf} - \includegraphics<2->[width=0.8\textwidth]{beacon/antenna_setup_four.pdf} + \includegraphics<1>[width=0.8\textwidth]{beacon/antenna_setup_two.pdf} + \includegraphics<2>[width=0.8\textwidth]{beacon/antenna_setup_three.pdf} + \includegraphics<3->[width=0.8\textwidth]{beacon/antenna_setup_four.pdf} \vspace{-2cm} \end{figure} \begin{equation*} \Delta t'_{12} = t'_1 - t'_2 = \Delta t_{\mathrm{d}12} + \sigma_{12} \end{equation*} - \begin{equation*} + \onslide<2->\begin{equation*} \sigma_{12} + \sigma_{23} + \sigma_{31} = 0 \end{equation*} \end{frame}