ZH: move true_phase_diff function to lib

This commit is contained in:
Eric-Teunis de Boone 2022-12-15 12:28:43 +01:00
parent 14a9fdb957
commit ae66d4ff1d
2 changed files with 32 additions and 30 deletions

View file

@ -53,6 +53,32 @@ 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):
"""
Determine true phases from the antenna phases.
This removes the geometrical phase from the antenna phase.
"""
if not hasattr(antennas, '__len__'):
single_ant = True
antennas = [antennas]
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']
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) )
return true_phases
""" Fourier """
def ft_corr_vectors(freqs, time):
"""