diff --git a/simulations/airshower_beacon_simulation/aa_generate_beacon.py b/simulations/airshower_beacon_simulation/aa_generate_beacon.py index eaaba93..bb05fec 100755 --- a/simulations/airshower_beacon_simulation/aa_generate_beacon.py +++ b/simulations/airshower_beacon_simulation/aa_generate_beacon.py @@ -303,9 +303,14 @@ if __name__ == "__main__": # make beacon per antenna for i, antenna in enumerate(ev.antennas): - t0 = lib.distance(tx, antenna)/3e8 * 1e9 # ns + if False: + t0 = lib.distance(tx, antenna)/3e8 * 1e9 # ns + c_light = np.inf + else: + t0 = 0 + c_light = 3e8*1e-9 # m/ns - beacon = lib.beacon_from(tx, antenna, f_beacon, antenna.t, t0=t0, c_light=np.inf, radiate_rsq=beacon_radiate_rsq) + beacon = lib.beacon_from(tx, antenna, f_beacon, antenna.t, t0=t0, c_light=c_light, radiate_rsq=beacon_radiate_rsq) traces = np.array([antenna.Ex, antenna.Ey, antenna.Ez, beacon]) diff --git a/simulations/airshower_beacon_simulation/ab_modify_clocks.py b/simulations/airshower_beacon_simulation/ab_modify_clocks.py index 5de3b44..61f7acd 100755 --- a/simulations/airshower_beacon_simulation/ab_modify_clocks.py +++ b/simulations/airshower_beacon_simulation/ab_modify_clocks.py @@ -53,7 +53,10 @@ if __name__ == "__main__": N_antennas = len(group.keys()) - clock_offsets = max_clock_offset * (2*rng.uniform(size=N_antennas) - 1) + if True: # uniform + clock_offsets = max_clock_offset * (2*rng.uniform(size=N_antennas) - 1) + else: # normal + clock_offsets = max_clock_offset * rng.normal(0, 1, size=N_antennas) # modify time values of each antenna for i, name in enumerate(group.keys()): diff --git a/simulations/airshower_beacon_simulation/ba_beacon_phases.py b/simulations/airshower_beacon_simulation/ba_beacon_phases.py index 85f42b1..b4fffac 100755 --- a/simulations/airshower_beacon_simulation/ba_beacon_phases.py +++ b/simulations/airshower_beacon_simulation/ba_beacon_phases.py @@ -29,6 +29,8 @@ if __name__ == "__main__": fname = "ZH_airshower/mysim.sry" + print("use_AxB_trace:", use_AxB_trace, "use_beacon_trace:",use_beacon_trace) + #### fname_dir = path.dirname(fname) antennas_fname = path.join(fname_dir, beacon.antennas_fname) @@ -140,14 +142,16 @@ if __name__ == "__main__": if show_plots and (i == 60 or i == 72): fig, ax = plt.subplots() + ax.set_title(f"Beacon at antenna {h5ant.attrs['name']}\nF:{frequency:.2e}, P:{phase:.4f}, A:{amplitude:.1e}") ax.set_xlabel("t [ns]") ax.set_ylabel("Amplitude") - 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]) + + myt = np.linspace(min(t_trace), max(t_trace), 10*len(t_trace)) 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() # save to file diff --git a/simulations/airshower_beacon_simulation/bb_beacon_true_phases.py b/simulations/airshower_beacon_simulation/bb_beacon_true_phases.py index 71a4676..1eadd84 100755 --- a/simulations/airshower_beacon_simulation/bb_beacon_true_phases.py +++ b/simulations/airshower_beacon_simulation/bb_beacon_true_phases.py @@ -38,7 +38,7 @@ if __name__ == "__main__": import sys fname = "ZH_airshower/mysim.sry" - c_light = 3e8*1e-9 + c_light = 3e8*1e-9 # m/ns show_plots = True remove_absolute_phase_offset_first_antenna = True # takes precedence @@ -66,7 +66,6 @@ if __name__ == "__main__": for freq_name in antennas[0].beacon_info.keys(): true_phases = antenna_true_phases(tx, antennas, freq_name, c_light=c_light) - # Remove the phase from one antenna # this is a free parameter # (only required for absolute timing)