diff --git a/simulations/airshower_beacon_simulation/ac_show_signal_to_noise.py b/simulations/airshower_beacon_simulation/ac_show_signal_to_noise.py index 6b9fc0a..e8b67d3 100755 --- a/simulations/airshower_beacon_simulation/ac_show_signal_to_noise.py +++ b/simulations/airshower_beacon_simulation/ac_show_signal_to_noise.py @@ -79,8 +79,6 @@ if __name__ == "__main__": if os.name == 'posix' and "DISPLAY" not in os.environ: matplotlib.use('Agg') - f_beacon_band = (49e-3,55e-3) #GHz - fname = "ZH_airshower/mysim.sry" fig_dir = "./figures/" @@ -89,31 +87,32 @@ if __name__ == "__main__": #### fname_dir = path.dirname(fname) 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) # create fig_dir if fig_dir: os.makedirs(fig_dir, exist_ok=True) # Read in antennas from file - _, tx, antennas = beacon.read_beacon_hdf5(antennas_fname) - # Read original REvent - ev = REvent(fname) + f_beacon, tx, antennas = beacon.read_beacon_hdf5(antennas_fname) + _, __, txdata = beacon.read_tx_file(tx_fname) # general properties dt = antennas[0].t[1] - antennas[0].t[0] # ns pb = passband(30e-3, 80e-3) # GHz - beacon_pb = passband(50e-3, 55e-3) # GHz + beacon_pb = passband(f_beacon-1e-3, f_beacon+1e-3) # GHz + + beacon_amp = np.max(txdata['amplitudes'])# mu V/m ## ## Beacon vs Noise SNR ## if True: - beacon_snrs = [ signal_to_noise(ant.beacon, ant.noise, samplerate=1/dt, signal_band=beacon_pb) for ant in antennas ] + beacon_snrs = [ signal_to_noise(beacon_amp*ant.beacon, ant.noise, samplerate=1/dt, signal_band=beacon_pb) for ant in antennas ] fig, ax = plt.subplots() - ax.set_title("Beacon SNR") - ax.set_xlabel("Antenna") + ax.set_title("Maximum Beacon SNR") + ax.set_xlabel("Antenna no.") ax.set_ylabel("SNR") ax.plot([ int(ant.name) for ant in antennas], beacon_snrs, 'o', ls='none') @@ -127,13 +126,13 @@ if __name__ == "__main__": shower_snrs = [ signal_to_noise(ant.E_AxB, ant.noise, samplerate=1/dt, signal_band=pb) for ant in antennas ] fig, ax = plt.subplots() - ax.set_title("Shower SNR") - ax.set_xlabel("Antenna") + ax.set_title("Total (Signal+Beacon+Noise) SNR") + ax.set_xlabel("Antenna no.") ax.set_ylabel("SNR") ax.plot([ int(ant.name) for ant in antennas], shower_snrs, 'o', ls='none') if fig_dir: - fig.savefig(path.join(fig_dir, path.basename(__file__) + f".shower_snr.pdf")) + fig.savefig(path.join(fig_dir, path.basename(__file__) + f".total_snr.pdf")) if show_plots: plt.show()