diff --git a/airshower_beacon_simulation/ac_show_signal_to_noise.py b/airshower_beacon_simulation/ac_show_signal_to_noise.py index d813a9d..d2eca22 100755 --- a/airshower_beacon_simulation/ac_show_signal_to_noise.py +++ b/airshower_beacon_simulation/ac_show_signal_to_noise.py @@ -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 ##