mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 11:33:32 +01:00
ZH: specify beacon_snr_fname
This commit is contained in:
parent
8dc2d3b7f0
commit
aabdca4f98
10 changed files with 27 additions and 27 deletions
|
@ -18,7 +18,7 @@ import lib
|
|||
# {{{ vim marker
|
||||
tx_fname = 'tx.json'
|
||||
antennas_fname = 'antennas.hdf5'
|
||||
snr_fname = 'snr.json'
|
||||
beacon_snr_fname = 'snr.json'
|
||||
c_light = lib.c_light
|
||||
|
||||
def read_antenna_clock_repair_offsets(antennas, mode='all', freq_name=None):
|
||||
|
|
|
@ -42,7 +42,7 @@ if __name__ == "__main__":
|
|||
fname_dir = args.data_dir
|
||||
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||
tx_fname = path.join(fname_dir, beacon.tx_fname)
|
||||
snr_fname = path.join(fname_dir, beacon.snr_fname)
|
||||
beacon_snr_fname = path.join(fname_dir, beacon.beacon_snr_fname)
|
||||
|
||||
# create fig_dir
|
||||
if fig_dir:
|
||||
|
@ -96,7 +96,7 @@ if __name__ == "__main__":
|
|||
beacon_snrs = [ lib.signal_to_noise(myfilter(beacon_amp*ant.beacon), myfilter(ant.noise), samplerate=1/dt, signal_band=beacon_pb, noise_band=noise_pb) for i, ant in enumerate(antennas) ]
|
||||
|
||||
# write mean and std to file
|
||||
beacon.write_snr_file(snr_fname, beacon_snrs)
|
||||
beacon.write_snr_file(beacon_snr_fname, beacon_snrs)
|
||||
|
||||
fig, ax = plt.subplots(figsize=figsize)
|
||||
ax.set_title(f"Maximum Beacon/Noise SNR (N_samples:{N_samples:.1e})")
|
||||
|
|
|
@ -51,7 +51,7 @@ if __name__ == "__main__":
|
|||
####
|
||||
fname_dir = args.data_dir
|
||||
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||
snr_fname = path.join(fname_dir, beacon.snr_fname)
|
||||
beacon_snr_fname = path.join(fname_dir, beacon.beacon_snr_fname)
|
||||
|
||||
fig_dir = args.fig_dir # set None to disable saving
|
||||
|
||||
|
@ -59,8 +59,8 @@ if __name__ == "__main__":
|
|||
print("Antenna file cannot be found, did you try generating a beacon?")
|
||||
sys.exit(1)
|
||||
|
||||
snrs = beacon.read_snr_file(snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {snrs['mean']: .1e}"
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
|
||||
# read in antennas
|
||||
with h5py.File(antennas_fname, 'a') as fp:
|
||||
|
|
|
@ -33,7 +33,7 @@ if __name__ == "__main__":
|
|||
####
|
||||
fname_dir = args.data_dir
|
||||
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||
snr_fname = path.join(fname_dir, beacon.snr_fname)
|
||||
beacon_snr_fname = path.join(fname_dir, beacon.beacon_snr_fname)
|
||||
|
||||
fig_dir = args.fig_dir # set None to disable saving
|
||||
|
||||
|
@ -157,8 +157,8 @@ if __name__ == "__main__":
|
|||
##
|
||||
## Histogram
|
||||
##
|
||||
snrs = beacon.read_snr_file(snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {snrs['mean']: .1e}"
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
|
||||
fig = figlib.phase_comparison_figure(
|
||||
loc_c,
|
||||
|
|
|
@ -34,7 +34,7 @@ if __name__ == "__main__":
|
|||
fname_dir = args.data_dir
|
||||
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||
time_diffs_fname = 'time_diffs.hdf5' if False else antennas_fname
|
||||
snr_fname = path.join(fname_dir, beacon.snr_fname)
|
||||
beacon_snr_fname = path.join(fname_dir, beacon.beacon_snr_fname)
|
||||
|
||||
fig_dir = args.fig_dir # set None to disable saving
|
||||
|
||||
|
@ -93,8 +93,8 @@ if __name__ == "__main__":
|
|||
##############################
|
||||
# Compare actual time shifts #
|
||||
##############################
|
||||
snrs = beacon.read_snr_file(snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {snrs['mean']: .1e}"
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
|
||||
actual_antenna_clock_phases = { a.name: -2*np.pi*a.attrs['clock_offset']*f_beacon for a in sorted(antennas, key=lambda a: int(a.name)) }
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ if __name__ == "__main__":
|
|||
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||
time_diffs_fname = 'time_diffs.hdf5' if False else antennas_fname
|
||||
fig_dir = args.fig_dir # set None to disable saving
|
||||
snr_fname = path.join(fname_dir, beacon.snr_fname)
|
||||
beacon_snr_fname = path.join(fname_dir, beacon.beacon_snr_fname)
|
||||
|
||||
basenames, time_diffs, f_beacons, clock_phase_diffs, k_periods = beacon.read_baseline_time_diffs_hdf5(time_diffs_fname)
|
||||
|
||||
|
@ -175,8 +175,8 @@ if __name__ == "__main__":
|
|||
##############################
|
||||
# Compare actual time shifts #
|
||||
##############################
|
||||
snrs = beacon.read_snr_file(snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {snrs['mean']: .1e}"
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
|
||||
actual_antenna_time_shifts = { a.name: a.attrs['clock_offset'] for a in sorted(antennas, key=lambda a: int(a.name)) }
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ if __name__ == "__main__":
|
|||
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||
time_diffs_fname = 'time_diffs.hdf5' if not True else antennas_fname
|
||||
tx_fname = path.join(fname_dir, beacon.tx_fname)
|
||||
snr_fname = path.join(fname_dir, beacon.snr_fname)
|
||||
beacon_snr_fname = path.join(fname_dir, beacon.beacon_snr_fname)
|
||||
|
||||
## This is a file indicating whether the k-finding algorithm was
|
||||
## stopped early. This happens when the ks do not change between
|
||||
|
@ -211,8 +211,8 @@ if __name__ == "__main__":
|
|||
# .. patch in our antennas
|
||||
ev.antennas = antennas
|
||||
# read in snr information
|
||||
snrs = beacon.read_snr_file(snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {snrs['mean']: .1e}"
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
|
||||
# For now only implement using one freq_name
|
||||
freq_names = antennas[0].beacon_info.keys()
|
||||
|
|
|
@ -32,7 +32,7 @@ if __name__ == "__main__":
|
|||
fname_dir = args.data_dir
|
||||
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||
time_diffs_fname = 'time_diffs.hdf5' if not True else antennas_fname
|
||||
snr_fname = path.join(fname_dir, beacon.snr_fname)
|
||||
beacon_snr_fname = path.join(fname_dir, beacon.beacon_snr_fname)
|
||||
|
||||
# create fig_dir
|
||||
if fig_dir:
|
||||
|
@ -42,8 +42,8 @@ if __name__ == "__main__":
|
|||
_, tx, antennas = beacon.read_beacon_hdf5(antennas_fname)
|
||||
|
||||
# Read in snr info
|
||||
snrs = beacon.read_snr_file(snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {snrs['mean']: .1e}"
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
|
||||
# For now only implement using one freq_name
|
||||
freq_names = antennas[0].beacon_info.keys()
|
||||
|
|
|
@ -54,7 +54,7 @@ if __name__ == "__main__":
|
|||
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||
pickle_fname = path.join(fname_dir, 'res.pkl')
|
||||
tx_fname = path.join(fname_dir, beacon.tx_fname)
|
||||
snr_fname = path.join(fname_dir, beacon.snr_fname)
|
||||
beacon_snr_fname = path.join(fname_dir, beacon.beacon_snr_fname)
|
||||
|
||||
# create fig_dir
|
||||
if fig_dir:
|
||||
|
@ -70,8 +70,8 @@ if __name__ == "__main__":
|
|||
# .. patch in our antennas
|
||||
ev.antennas = antennas
|
||||
# Read in snr info
|
||||
snrs = beacon.read_snr_file(snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {snrs['mean']: .1e}"
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
|
||||
# For now only implement using one freq_name
|
||||
freq_names = antennas[0].beacon_info.keys()
|
||||
|
|
|
@ -123,7 +123,7 @@ if __name__ == "__main__":
|
|||
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||
pickle_fname = path.join(fname_dir, 'res.pkl')
|
||||
tx_fname = path.join(fname_dir, beacon.tx_fname)
|
||||
snr_fname = path.join(fname_dir, beacon.snr_fname)
|
||||
beacon_snr_fname = path.join(fname_dir, beacon.beacon_snr_fname)
|
||||
|
||||
# create fig_dir
|
||||
if fig_dir:
|
||||
|
@ -138,8 +138,8 @@ if __name__ == "__main__":
|
|||
# .. patch in our antennas
|
||||
ev.antennas = antennas
|
||||
# Read in snr info
|
||||
snrs = beacon.read_snr_file(snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {snrs['mean']: .1e}"
|
||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
||||
|
||||
##
|
||||
## Setup grid
|
||||
|
|
Loading…
Reference in a new issue