ZH: Note SNRs in legends of the plots

This commit is contained in:
Eric-Teunis de Boone 2023-04-12 22:42:59 +02:00
parent 83811bbd1a
commit b20e2f0f03
8 changed files with 67 additions and 22 deletions

View file

@ -190,6 +190,7 @@ if __name__ == "__main__":
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
time_diffs_fname = 'time_diffs.hdf5' if not True else antennas_fname
tx_fname = path.join(fname_dir, beacon.tx_fname)
snr_fname = path.join(fname_dir, beacon.snr_fname)
## This is a file indicating whether the k-finding algorithm was
## stopped early. This happens when the ks do not change between
@ -209,6 +210,9 @@ if __name__ == "__main__":
ev = REvent(args.input_fname)
# .. patch in our antennas
ev.antennas = antennas
# read in snr information
snrs = beacon.read_snr_file(snr_fname)
snr_str = f"$\\langle SNR \\rangle$ = {snrs['mean']: .1e}"
# For now only implement using one freq_name
freq_names = antennas[0].beacon_info.keys()
@ -300,7 +304,7 @@ if __name__ == "__main__":
ax.plot(ant.t_AxB, calc_beacon, alpha=0.6, ls='dashed', label='Calc Beacon')
ax.plot(ant.t_AxB, ant.E_AxB, alpha=0.6, label="Signal - Calc Beacon")
ax.legend()
ax.legend(title=snr_str)
# save
if fig_dir:
@ -431,6 +435,8 @@ if __name__ == "__main__":
sc = axs.scatter(xx/1e3, yy/1e3, c=maxima_per_loc, cmap='Spectral_r', alpha=0.6)
fig.colorbar(sc, ax=axs, label='Max Amplitude [$\\mu V/m$]')
axs.legend(title=snr_str)
# indicate maximum value
idx = np.argmax(maxima_per_loc)
axs.plot(xx[idx]/1e3, yy[idx]/1e3, 'bx', ms=30)
@ -497,6 +503,7 @@ if __name__ == "__main__":
sc = axs.scatter(xx/1e3, yy/1e3, c=maxima, cmap='Spectral_r', alpha=0.6)
fig.colorbar(sc, ax=axs, label='Max Amplitude [$\\mu V/m$]')
axs.legend(title=snr_str)
if fig_dir:
if power_reconstruction: