From 8dc2d3b7f0a134d6f1412009fee3fa9f4547bd5b Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 13 Apr 2023 12:40:01 +0200 Subject: [PATCH] ZH: matrix: improve SNR vs time res plot --- .../matrix_base/bin/time_res_vs_snr.py | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/airshower_beacon_simulation/matrix_base/bin/time_res_vs_snr.py b/airshower_beacon_simulation/matrix_base/bin/time_res_vs_snr.py index c230163..b2bf020 100755 --- a/airshower_beacon_simulation/matrix_base/bin/time_res_vs_snr.py +++ b/airshower_beacon_simulation/matrix_base/bin/time_res_vs_snr.py @@ -126,6 +126,7 @@ if __name__ == "__main__": ax.set_ylabel('Time Accuracy $\\sigma(t)$ [ns]') # group per directories per N + dirkeys = [] if True: import re @@ -140,18 +141,23 @@ if __name__ == "__main__": dirdict[m].append(d) - + dirkeys = list(dirdict.keys()) dirlist = dirdict.values() # plot data directories as one group else: dirlist = [args.data_directories] - for dirlist in dirlist: + for i, dirlist in enumerate(dirlist): f_beacon, snrs, time_residuals = read_snr_directories(dirlist) + if dirkeys: + label = "N = " + dirkeys[i] + else: + label = None + # plot data - ax.plot(snrs*np.sqrt(np.pi/2), phase2time(time_residuals[:,1]), ls='none', marker='o') + ax.plot(snrs*np.sqrt(np.pi/2), phase2time(time_residuals[:,1]), ls='none', marker='o', label=label) # Add secondary axis if True: @@ -182,11 +188,11 @@ if __name__ == "__main__": else: #linear _snrs = np.linspace(_snr_min, _snr_max) - # Phasor Rice + # Random Phasor Sum phasor_pdfs = np.array([phase_distribution(thetas, sigma, s) for s in _snrs ]) phasor_sigma = np.sqrt(np.array([variance(thetas, pdf) for pdf in phasor_pdfs])) - ax.plot(_snrs, phase2time(phasor_sigma), label='Rice') + ax.plot(_snrs, phase2time(phasor_sigma), label='Random Phasor Sum') if True: # plot a pdf fig2, ax2 = plt.subplots() @@ -207,6 +213,13 @@ if __name__ == "__main__": if not True or ax.get_xscale() != 'log': ax.set_xlim(0, 100) + # Set horizontal line at 1 ns + if True: + ax.axhline(1, ls='--', alpha=0.8, color='g') + + if True: + ax.grid() + if args.fig_dir: fig.tight_layout() fig.savefig(path.join(args.fig_dir, "time_res_vs_snr.pdf"))