From 2e227d17657f2a0db66b032ca15d6c43c95ecbee Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 15 Dec 2022 12:56:20 +0100 Subject: [PATCH] ZH: rename true_phase_diff --- .../bb_measure_true_phase.py | 8 +++++++- .../airshower_beacon_simulation/lib/lib.py | 18 +++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/simulations/airshower_beacon_simulation/bb_measure_true_phase.py b/simulations/airshower_beacon_simulation/bb_measure_true_phase.py index 3fae81a..e9e04b5 100755 --- a/simulations/airshower_beacon_simulation/bb_measure_true_phase.py +++ b/simulations/airshower_beacon_simulation/bb_measure_true_phase.py @@ -47,7 +47,13 @@ if __name__ == "__main__": N_beacon_freqs = len(antennas[0].beacon_info) for freq_name in antennas[0].beacon_info.keys(): - true_phases = lib.antenna_true_phase_diff(tx, antennas, freq_name, c_light=c_light) + measured_phases = np.empty( (len(antennas)) ) + for i, ant in enumerate(antennas): + measured_phases[i] = ant.beacon_info[freq_name]['phase'] + + f_beacon = antennas[0].beacon_info[freq_name]['freq'] + + true_phases = lib.remove_antenna_geometry_phase(tx, antennas, f_beacon, measured_phases, c_light=c_light) # Remove the phase from one antenna # this is a free parameter diff --git a/simulations/airshower_beacon_simulation/lib/lib.py b/simulations/airshower_beacon_simulation/lib/lib.py index e6ed9d4..85ddfd5 100644 --- a/simulations/airshower_beacon_simulation/lib/lib.py +++ b/simulations/airshower_beacon_simulation/lib/lib.py @@ -53,28 +53,24 @@ def beacon_from(tx, rx, f, t=0, t0=0, c_light=3e8, radiate_rsq=True, amplitude=1 return sine_beacon(f, t, t0=t0, amplitude=amplitude,**kwargs) -def antenna_true_phase_diff(tx, antennas, freq_name, c_light=3e8): +def remove_antenna_geometry_phase(tx, antennas, f_beacon, measured_phases=None, c_light=3e8): """ - Determine true phases from the antenna phases. - - This removes the geometrical phase from the antenna phase. + Remove the geometrical phase from the measured antenna phase. """ if not hasattr(antennas, '__len__'): - single_ant = True antennas = [antennas] + if not hasattr(measured_phases, '__len__'): + measured_phases = [measured_phases] + true_phases = np.empty( (len(antennas)) ) for i, ant in enumerate(antennas): - beacon_info = ant.beacon_info[freq_name] - measured_phase = beacon_info['phase'] - f_beacon = beacon_info['freq'] + measured_phase = measured_phases[i] geom_time = geometry_time(tx, ant, c_light=c_light) geom_phase = geom_time * 2*np.pi*f_beacon - print(ant.name, measured_phase, geom_phase, phase_mod(geom_phase)) - - true_phases[i] = phase_mod(phase_mod(measured_phase) - phase_mod(geom_phase) ) + true_phases[i] = phase_mod(measured_phase - geom_phase) return true_phases