diff --git a/simulations/airshower_beacon_simulation/ca_period_from_shower.py b/simulations/airshower_beacon_simulation/ca_period_from_shower.py index 008bda0..a76a733 100755 --- a/simulations/airshower_beacon_simulation/ca_period_from_shower.py +++ b/simulations/airshower_beacon_simulation/ca_period_from_shower.py @@ -166,6 +166,7 @@ if __name__ == "__main__": N_runs = 3 remove_beacon_from_trace = True + apply_signal_window_from_max = True #### fname_dir = path.dirname(fname) @@ -201,13 +202,34 @@ if __name__ == "__main__": # Prepare polarisation and passbands rit.set_pol_and_bp(ev, low=0.03, high=0.08) - # Remove time due to true phase - # and optionally remove the beacon + ## + ## Manipulate time and traces of each antenna + ## + ### Remove time due to true phase + ### and optionally remove the beacon measured_repair_offsets = beacon.read_antenna_clock_repair_offsets(ev.antennas, mode='phases', freq_name=freq_name) for i, ant in enumerate(ev.antennas): ev.antennas[i].orig_t = ev.antennas[i].t_AxB ev.antennas[i].t_AxB += measured_repair_offsets[i] + if apply_signal_window_from_max: + N_pre, N_post = 250, 250 + + max_idx = np.argmax(ant.E_AxB) + + low_idx = max(0, max_idx-N_pre) + high_idx = min(len(ant.t), max_idx+N_post) + + ev.antennas[i].orig_t = ant.orig_t[low_idx:high_idx] + ev.antennas[i].t = ant.t[low_idx:high_idx] + ev.antennas[i].t_AxB = ant.t_AxB[low_idx:high_idx] + + ev.antennas[i].Ex = ant.Ex[low_idx:high_idx] + ev.antennas[i].Ey = ant.Ey[low_idx:high_idx] + ev.antennas[i].Ez = ant.Ez[low_idx:high_idx] + ev.antennas[i].E_AxB = ant.E_AxB[low_idx:high_idx] + + if remove_beacon_from_trace: clock_phase = measured_repair_offsets[i]*2*np.pi*f_beacon