diff --git a/simulations/airshower_beacon_simulation/aa_generate_beacon.py b/simulations/airshower_beacon_simulation/aa_generate_beacon.py index 3551e51..bf58e45 100755 --- a/simulations/airshower_beacon_simulation/aa_generate_beacon.py +++ b/simulations/airshower_beacon_simulation/aa_generate_beacon.py @@ -321,6 +321,7 @@ if __name__ == "__main__": # Noise properties noise_sigma = args.noise_sigma # mu V/m set to None to ignore + unique_noise_realisations = True # a new noise realisation per antenna vs. single noise realisation shared across antennas # Beacon properties beacon_amplitudes = np.array(args.beacon_amplitudes) # mu V/m @@ -381,6 +382,7 @@ if __name__ == "__main__": init_antenna_hdf5(antennas_fname, tx, f_beacon) # make beacon per antenna + noise_realisation = np.array([0]) for i, antenna in enumerate(ev.antennas): #TODO: allow to change the samplerate (2, 4, 8 ns) @@ -409,9 +411,9 @@ if __name__ == "__main__": beacon = 1e-6 * lib.beacon_from(tx, antenna, f_beacon, antenna.t, c_light=c_light, radiate_rsq=beacon_radiate_rsq) # mu V/m # noise realisation - noise_realisation = 0 - if noise_sigma is not None: - noise_realisation = 1e-6 * rng.normal(0, noise_sigma, size=len(beacon)) # mu V/m + if unique_noise_realisations or (noise_realisation == 0).all(): # either create one for every antenna, or generate a single one + print("Noise realisation!") + noise_realisation = 1e-6 * rng.normal(0, noise_sigma or 0, size=len(antenna.t)) # mu V/m # Collect all data to be saved (with the first 3 values the E fields) traces = np.array([antenna.Ex, antenna.Ey, antenna.Ez, beacon, noise_realisation])