From 1130f2c679943a8e8d84a89ae3b453ad8af47474 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 13 Apr 2023 12:28:04 +0200 Subject: [PATCH] ZH: plotting improvements --- airshower_beacon_simulation/ba_measure_beacon_phase.py | 2 +- airshower_beacon_simulation/bc_baseline_phase_deltas.py | 6 ++++-- .../cb_report_measured_antenna_time_offsets.py | 2 +- airshower_beacon_simulation/dc_grid_power_time_fixes.py | 9 ++++++--- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/airshower_beacon_simulation/ba_measure_beacon_phase.py b/airshower_beacon_simulation/ba_measure_beacon_phase.py index 6e17de9..7cba9ed 100755 --- a/airshower_beacon_simulation/ba_measure_beacon_phase.py +++ b/airshower_beacon_simulation/ba_measure_beacon_phase.py @@ -211,7 +211,7 @@ if __name__ == "__main__": p2t = lambda phase: phase/(2*np.pi*f_beacon) fig, ax = plt.subplots(figsize=figsize) - ax.set_title(f"Beacon at antenna {h5ant.attrs['name']}\nF:{frequency:.2e}, P:{beacon_phase:.4f}, A:{amplitude:.1e}") + ax.set_title(f"Beacon at antenna {h5ant.attrs['name']}\nF:{frequency:.2e}GHz, $\\varphi$:{beacon_phase:.4f}rad") ax.set_xlabel("t [ns]") ax.set_ylabel("Amplitude") diff --git a/airshower_beacon_simulation/bc_baseline_phase_deltas.py b/airshower_beacon_simulation/bc_baseline_phase_deltas.py index cf4a817..85189d7 100755 --- a/airshower_beacon_simulation/bc_baseline_phase_deltas.py +++ b/airshower_beacon_simulation/bc_baseline_phase_deltas.py @@ -137,10 +137,10 @@ if __name__ == "__main__": axs[0].legend(title=snr_str) if plot_residuals: - fig.suptitle("Difference between Measured and Actual phase difference\n for Baselines (i,j" + (')' if not ref_ant_id else '='+str([ int(a.name) for a in ref_ants])+')')) + axs[0].set_title("Difference between Measured and Actual phase difference\n for Baselines (i,j" + (')' if not ref_ant_id else '='+str([ int(a.name) for a in ref_ants])+')')) axs[-1].set_xlabel("Baseline Phase Residual $\\Delta\\varphi_{ij_{meas}} - \\Delta\\varphi_{ij_{true}}$ [rad]") else: - fig.suptitle("Comparison Measured and Actual phase difference\n for Baselines (i,j" + (')' if not ref_ant_id else '='+str([ int(a.name) for a in ref_ants])+')')) + axs[0].set_title("Comparison Measured and Actual phase difference\n for Baselines (i,j" + (')' if not ref_ant_id else '='+str([ int(a.name) for a in ref_ants])+')')) axs[-1].set_xlabel("Baseline Phase $\\Delta\\varphi_{ij}$ [rad]") # @@ -152,6 +152,8 @@ if __name__ == "__main__": i=1 axs[i].set_ylabel("Baseline no.") + fig.tight_layout() + if fig_dir: extra_name = "measured" if plot_residuals: diff --git a/airshower_beacon_simulation/cb_report_measured_antenna_time_offsets.py b/airshower_beacon_simulation/cb_report_measured_antenna_time_offsets.py index a3fb0e5..cd3f3a5 100755 --- a/airshower_beacon_simulation/cb_report_measured_antenna_time_offsets.py +++ b/airshower_beacon_simulation/cb_report_measured_antenna_time_offsets.py @@ -105,7 +105,7 @@ if __name__ == "__main__": axs = fig.get_axes() - axs.legend(title=snr_str) + axs[0].legend(title=snr_str) if plot_residuals: fig.suptitle("Difference between Measured and Actual clock offsets") diff --git a/airshower_beacon_simulation/dc_grid_power_time_fixes.py b/airshower_beacon_simulation/dc_grid_power_time_fixes.py index eb748bf..e462030 100755 --- a/airshower_beacon_simulation/dc_grid_power_time_fixes.py +++ b/airshower_beacon_simulation/dc_grid_power_time_fixes.py @@ -283,17 +283,20 @@ if __name__ == "__main__": fig, axs = rit.slice_figure(ev, X, xx, yy, p, mode='sp', scatter_kwargs=dict( vmax=1e5, vmin=0, - s=150, + s=250, cmap='inferno', # edgecolor='black', )) suptitle = fig._suptitle.get_text() fig.suptitle("") - axs.set_title(suptitle +"\n" +plot_titling[case]) - #axs.set_aspect('equal', 'datalim') + axs.set_title("Shower plane slice\n" + plot_titling[case] + "\n" + suptitle) + axs.set_aspect('equal', 'datalim') axs.legend(title=snr_str) + axs.set_xlim(1.1*min(xx)/1e3, 1.1*max(xx)/1e3) + axs.set_ylim(1.1*min(yy)/1e3, 1.1*max(yy)/1e3) + if fig_dir: fig.tight_layout() fig.savefig(path.join(fig_dir, path.basename(__file__) + f'.X{X}.{case}.{scalename}.pdf'))