ZH: phase sigma plot tweak

This commit is contained in:
Eric Teunis de Boone 2022-12-05 17:57:23 +01:00
parent 31392f4fa0
commit 2c1fb0976b

View file

@ -56,7 +56,7 @@ if __name__ == "__main__":
# Get phase difference per baseline # Get phase difference per baseline
phase_diffs = np.empty( (len(baselines), 2) ) phase_diffs = np.empty( (len(baselines), 2) )
for i, base in enumerate(baselines): for i, base in enumerate(baselines):
if i%100==0: if i%1000==0:
print(i, "out of", len(baselines)) print(i, "out of", len(baselines))
# read f_beacon from the first antenna # read f_beacon from the first antenna
@ -65,7 +65,7 @@ if __name__ == "__main__":
# Get true phase diffs # Get true phase diffs
try: 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])) true_phases_diff = lib.phase_mod(lib.phase_mod(true_phases[1]) - lib.phase_mod(true_phases[0]))
except IndexError: except IndexError:
# true_phase not determined yet # true_phase not determined yet
@ -99,20 +99,22 @@ if __name__ == "__main__":
fig, axs = plt.subplots(2, 1, sharex=True) fig, axs = plt.subplots(2, 1, sharex=True)
axs[0].set_title("Measured phase difference - Actual phase difference") 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: if True:
forward = lambda x: x/(2*np.pi*f_beacon) forward = lambda x: x/(2*np.pi*f_beacon)
inverse = lambda x: 2*np.pi*x*f_beacon inverse = lambda x: 2*np.pi*x*f_beacon
secax = axs[0].secondary_xaxis('top', functions=(forward, inverse)) 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 i=0
axs[i].set_ylabel("#") axs[i].set_ylabel("#")
axs[i].hist(phase_residuals, bins='sqrt', density=False) axs[i].hist(phase_residuals, bins='sqrt', density=False)
i=1 i=1
axs[i].set_ylabel("Baseline combination #") axs[i].set_ylabel("Baseline\n combination #")
if not True: if not True:
axs[i].plot(my_phase_diffs, np.arange(N_base), ls='none', marker='+', label='actual time shifts') 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') 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: else:
axs[i].plot(phase_residuals, np.arange(N_base), ls='none', marker='x') axs[i].plot(phase_residuals, np.arange(N_base), ls='none', marker='x')
fig.tight_layout()
if fig_dir: if fig_dir:
fig.savefig(path.join(fig_dir, __file__ + f".F{freq_name}.pdf")) fig.savefig(path.join(fig_dir, __file__ + f".F{freq_name}.pdf"))