diff --git a/simulations/airshower_beacon_simulation/ba_beacon_phases.py b/simulations/airshower_beacon_simulation/ba_beacon_phases.py index f4a168e..0988e59 100755 --- a/simulations/airshower_beacon_simulation/ba_beacon_phases.py +++ b/simulations/airshower_beacon_simulation/ba_beacon_phases.py @@ -62,21 +62,37 @@ if __name__ == "__main__": for i, name in enumerate(group.keys()): ant_group = group[name] - if 'traces' not in ant_group.keys(): - print(f"Antenna file corrupted? no 'traces' in {name}") - sys.exit(1) + # use E_AxB only instead of polarisations + if True: + if 'E_AxB' not in ant_group.keys(): + print(f"Antenna does not have 'E_AxB' in {name}") + sys.exit(1) - traces = ant_group['traces'] - t_trace = traces[0] + traces = ant_group['E_AxB'] - if not True: - # only take the Beacon trace - test_traces = [traces[4]] - orients = ['B'] + t_trace = traces[0] + test_traces = [ traces[1] ] + orients = ['E_AxB'] + + # use separate polarisations else: - test_traces = traces[1:] - orients = ['Ex', 'Ey', 'Ez', 'B'] + if 'traces' not in ant_group.keys(): + print(f"Antenna file corrupted? no 'traces' in {name}") + sys.exit(1) + traces = ant_group['traces'] + t_trace = traces[0] + + if True: + # only take the Beacon trace + test_traces = [traces[4]] + orients = ['B'] + else: + test_traces = traces[1:] + orients = ['Ex', 'Ey', 'Ez', 'B'] + + # Do Fourier Transforms + # to find phases and amplitudes if True: freqs, phases, amps = lib.find_beacon_in_traces( test_traces, t_trace, @@ -93,8 +109,10 @@ if __name__ == "__main__": amps = [ 3e-7 ] # choose highest amp - #idx = np.argmax(amps, axis=1) idx = 0 + if False and len(phases) > 1: + #idx = np.argmax(amplitudes, axis=-1) + raise NotImplementedError frequency = freqs[idx] phase = phases[idx]