ZH: bc_* remove true_phase part

This commit is contained in:
Eric Teunis de Boone 2022-11-22 18:07:02 +01:00
parent f905dfb2f3
commit eeca9f91bc

View file

@ -19,46 +19,9 @@ if __name__ == "__main__":
fname_dir = path.dirname(fname) fname_dir = path.dirname(fname)
antennas_fname = path.join(fname_dir, beacon.antennas_fname) antennas_fname = path.join(fname_dir, beacon.antennas_fname)
if not path.isfile(antennas_fname):
print("Antenna file cannot be found, did you try generating a beacon?")
sys.exit(1)
# Read in antennas from file # Read in antennas from file
f_beacon, tx, antennas = beacon.read_beacon_hdf5(antennas_fname) f_beacon, tx, antennas = beacon.read_beacon_hdf5(antennas_fname)
if True and 'beacon_phase_true' in antennas[0].attrs:
true_phases = np.array([a.attrs['beacon_phase_true'] for a in antennas])
else:
true_phases = np.empty( (len(antennas)) )
for i, ant in enumerate(antennas):
measured_phase = ant.attrs['beacon_phase_measured']
geom_time = lib.geometry_time(tx, ant, c_light=3e8*1e-9)
geom_phase = geom_time * 2*np.pi*f_beacon
true_phases[i] = lib.phase_mod(measured_phase) - lib.phase_mod(geom_phase)
ant.attrs['beacon_phase_true'] = true_phases[i]
# Plot True Phases
if True:
fig, ax = plt.subplots()
spatial_unit=None
fig.suptitle('f= {:2.0f}MHz'.format(f_beacon*1e3))
antenna_locs = list(zip(*[(ant.x, ant.y) for ant in antennas]))
ax.set_xlabel('x' if spatial_unit is None else 'x [{}]'.format(spatial_unit))
ax.set_ylabel('y' if spatial_unit is None else 'y [{}]'.format(spatial_unit))
scatter_kwargs = {}
scatter_kwargs['cmap'] = 'Spectral_r'
scatter_kwargs['vmin'] = -np.pi
scatter_kwargs['vmax'] = +np.pi
color_label='$\\varphi$'
sc = ax.scatter(*antenna_locs, c=true_phases, **scatter_kwargs)
fig.colorbar(sc, ax=ax, label=color_label)
# run over all baselines # run over all baselines
if True: if True:
baselines = list(combinations(antennas,2)) baselines = list(combinations(antennas,2))