From 2c1fb0976b5e0aa99e1e74364a0f3c0413509675 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Mon, 5 Dec 2022 17:57:23 +0100 Subject: [PATCH] ZH: phase sigma plot tweak --- .../airshower_beacon_simulation/bc_phase_sigmas.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/simulations/airshower_beacon_simulation/bc_phase_sigmas.py b/simulations/airshower_beacon_simulation/bc_phase_sigmas.py index 48b803e..3b277ca 100755 --- a/simulations/airshower_beacon_simulation/bc_phase_sigmas.py +++ b/simulations/airshower_beacon_simulation/bc_phase_sigmas.py @@ -56,7 +56,7 @@ if __name__ == "__main__": # Get phase difference per baseline phase_diffs = np.empty( (len(baselines), 2) ) for i, base in enumerate(baselines): - if i%100==0: + if i%1000==0: print(i, "out of", len(baselines)) # read f_beacon from the first antenna @@ -65,7 +65,7 @@ if __name__ == "__main__": # Get true phase diffs try: - true_phases = np.array([ant.beacon_info[freq_name]['phase'] for ant in base]) + true_phases = np.array([ant.beacon_info[freq_name]['true_phase'] for ant in base]) true_phases_diff = lib.phase_mod(lib.phase_mod(true_phases[1]) - lib.phase_mod(true_phases[0])) except IndexError: # true_phase not determined yet @@ -99,20 +99,22 @@ if __name__ == "__main__": fig, axs = plt.subplots(2, 1, sharex=True) axs[0].set_title("Measured phase difference - Actual phase difference") - axs[0].set_xlabel("Phase residuals $\\varphi$") + axs[0].set_xlabel("Phase $\\Delta\\varphi = \\varphi_{meas} - \\varphi_{true}$") + axs[0].tick_params(bottom=True, labelbottom=True) + #axs[1].tick_params(top=True, labeltop=True, bottom=False, labelbottom=False) if True: forward = lambda x: x/(2*np.pi*f_beacon) inverse = lambda x: 2*np.pi*x*f_beacon secax = axs[0].secondary_xaxis('top', functions=(forward, inverse)) - secax.set_xlabel('$\\varphi/(2\\pi f_{beacon})$ [ns]') + secax.set_xlabel('Time $\\Delta\\varphi/(2\\pi f_{beac})$ [ns]') i=0 axs[i].set_ylabel("#") axs[i].hist(phase_residuals, bins='sqrt', density=False) i=1 - axs[i].set_ylabel("Baseline combination #") + axs[i].set_ylabel("Baseline\n combination #") if not True: axs[i].plot(my_phase_diffs, np.arange(N_base), ls='none', marker='+', label='actual time shifts') l = axs[i].plot(phase_diffs[:,1], np.arange(N_base), ls='none', marker='x', label='calculated') @@ -121,6 +123,7 @@ if __name__ == "__main__": else: axs[i].plot(phase_residuals, np.arange(N_base), ls='none', marker='x') + fig.tight_layout() if fig_dir: fig.savefig(path.join(fig_dir, __file__ + f".F{freq_name}.pdf"))