ZH: SNR: airshower to noise + show SNR on debug plot

This commit is contained in:
Eric Teunis de Boone 2023-04-13 12:25:04 +02:00
parent b20e2f0f03
commit ee13fe91f9

View file

@ -76,10 +76,12 @@ if __name__ == "__main__":
ant = antennas[0]
fig, ax = plt.subplots(figsize=figsize)
_ = lib.signal_to_noise(myfilter(beacon_amp*ant.beacon), myfilter(ant.noise), samplerate=1/dt, signal_band=beacon_pb, noise_band=noise_pb, debug_ax=ax)
_debug_snrs = lib.signal_to_noise(myfilter(beacon_amp*ant.beacon), myfilter(ant.noise), samplerate=1/dt, signal_band=beacon_pb, noise_band=noise_pb, debug_ax=ax)
ax.legend(title="$\\langle SNR \\rangle$ = {: .1e}".format(np.mean(_debug_snrs)))
ax.set_title("Spectra and passband")
ax.set_xlabel("Frequency")
ax.set_xlabel("Frequency [GHz]")
ax.set_ylabel("Amplitude")
low_x, high_x = min(beacon_pb[0], noise_pb[0]), max(beacon_pb[1] or 0, noise_pb[1])
ax.set_xlim(low_x, high_x)
@ -119,6 +121,22 @@ if __name__ == "__main__":
if fig_dir:
fig.savefig(path.join(fig_dir, path.basename(__file__) + f".beacon_vs_total_snr.pdf"))
##
## Signal vs Noise SNR
##
if True:
beacon_snrs = [ lib.signal_to_noise(myfilter(ant.E_AxB - beacon_amp*ant.beacon), myfilter(ant.noise), samplerate=1/dt, signal_band=beacon_pb, noise_band=pb) for ant in antennas ]
fig, ax = plt.subplots(figsize=figsize)
ax.set_title("Maximum Airshower/Noise SNR")
ax.set_xlabel("Antenna no.")
ax.set_ylabel("SNR")
ax.plot([ int(ant.name) for ant in antennas], beacon_snrs, 'o', ls='none')
if fig_dir:
fig.savefig(path.join(fig_dir, path.basename(__file__) + f".airshower_vs_noise_snr.pdf"))
##
## Airshower signal vs Noise SNR
##