ZH: rename true_phase_diff

This commit is contained in:
Eric Teunis de Boone 2022-12-15 12:56:20 +01:00
parent ae66d4ff1d
commit 2e227d1765
2 changed files with 14 additions and 12 deletions

View file

@ -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

View file

@ -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