From 22ccf7e3e325f337226ed40b99ee1302d4bff81d Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Fri, 25 Nov 2022 11:31:19 +0100 Subject: [PATCH] ZH: allow to modify tracelengths in beacon_phases --- .../ba_beacon_phases.py | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/simulations/airshower_beacon_simulation/ba_beacon_phases.py b/simulations/airshower_beacon_simulation/ba_beacon_phases.py index 555e3e6..7a3571c 100755 --- a/simulations/airshower_beacon_simulation/ba_beacon_phases.py +++ b/simulations/airshower_beacon_simulation/ba_beacon_phases.py @@ -99,6 +99,14 @@ if __name__ == "__main__": test_traces = traces[1:] orients = ['Ex', 'Ey', 'Ez', 'B'] + # modify the length of the traces + if False: + t_trace = t_trace[:len(t_trace)//2] + half_traces = [] + for trace in test_traces: + half_traces.append( trace[:len(trace)//2]) + test_traces = half_traces + # Do Fourier Transforms # to find phases and amplitudes if True: @@ -132,11 +140,13 @@ if __name__ == "__main__": if show_plots and (i == 60 or i == 72): fig, ax = plt.subplots() - trace_amp = max(traces[-1]) - min(traces[-1]) + ax.set_xlabel("t [ns]") + ax.set_ylabel("Amplitude") - myt = np.linspace(min(traces[0]), max(traces[0]), 10*len(traces[0])) - ax.plot(t_trace, traces[-1], marker='.', label='trace') - ax.plot(myt, lib.sine_beacon(frequency, myt, amplitude=amplitude, phase=phase), ls='dashed', label='simulated') + myt = np.linspace(min(t_trace), max(t_trace), 10*len(t_trace)) + for i, trace in enumerate(test_traces): + ax.plot(t_trace, test_traces[i], marker='.', label='trace '+orients[i]) + ax.plot(myt, lib.sine_beacon(frequency, myt, amplitude=amplitude, phase=phase), ls='dashed', label='simulated beacon') ax.set_title(f"Beacon at antenna {h5ant.attrs['name']}\nF:{frequency:.2e}, P:{phase:.4f}, A:{amplitude:.1e}") ax.legend() @@ -178,4 +188,4 @@ if __name__ == "__main__": ax.set_ylabel("Counts") ax.hist(found_data[:,2], bins='sqrt', density=False) - plt.show() + plt.show()