mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 11:33:32 +01:00
ZH: initial reporting for measured total clock offset per antenna
This commit is contained in:
parent
1d6f0d3b36
commit
ed1eb3f5cb
1 changed files with 80 additions and 0 deletions
|
@ -0,0 +1,80 @@
|
|||
#!/usr/bin/env python3
|
||||
# vim: fdm=indent ts=4
|
||||
|
||||
"""
|
||||
Report best time offset per frequency for each antenna
|
||||
"""
|
||||
|
||||
import h5py
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
from os import path
|
||||
from scipy.interpolate import interp1d
|
||||
|
||||
import aa_generate_beacon as beacon
|
||||
import lib
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
import os
|
||||
import matplotlib
|
||||
if os.name == 'posix' and "DISPLAY" not in os.environ:
|
||||
matplotlib.use('Agg')
|
||||
|
||||
fname = "ZH_airshower/mysim.sry"
|
||||
|
||||
fig_dir = "./figures/periods_from_shower_figures/"
|
||||
fig_subdir = path.join(fig_dir, 'shifts/')
|
||||
show_plots = False
|
||||
|
||||
####
|
||||
fname_dir = path.dirname(fname)
|
||||
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||
time_diffs_fname = 'time_diffs.hdf5' if not True else antennas_fname
|
||||
|
||||
# create fig_dir
|
||||
if fig_dir:
|
||||
os.makedirs(fig_dir, exist_ok=True)
|
||||
if fig_subdir:
|
||||
os.makedirs(fig_subdir, exist_ok=True)
|
||||
|
||||
# Read in antennas from file
|
||||
_, tx, antennas = beacon.read_beacon_hdf5(antennas_fname)
|
||||
|
||||
# For now only implement using one freq_name
|
||||
freq_names = antennas[0].beacon_info.keys()
|
||||
if len(freq_names) > 1:
|
||||
raise NotImplementedError
|
||||
|
||||
freq_name = next(iter(freq_names))
|
||||
f_beacon = antennas[0].beacon_info[freq_name]['freq']
|
||||
|
||||
|
||||
for i, ant in enumerate(antennas):
|
||||
clock_phase_time = ant.beacon_info[freq_name]['sigma_phase_mean']/(2*np.pi*f_beacon)
|
||||
|
||||
best_k_time = ant.beacon_info[freq_name]['best_k_time']
|
||||
best_k = ant.beacon_info[freq_name]['best_k_time']
|
||||
|
||||
total_clock_time = best_k_time + clock_phase_time
|
||||
|
||||
actual_clock_time = ant.attrs['clock_offset']
|
||||
|
||||
# filter k == 0
|
||||
if best_k == 0:
|
||||
continue
|
||||
|
||||
# Report to stdout
|
||||
print("Timing of antenna", ant.name)
|
||||
print(" + k:", best_k, ";(-)", best_k_time, 'ns')
|
||||
print(" + phase_time:", clock_phase_time, 'ns')
|
||||
print("==============================")
|
||||
print("Sum: (-) ", total_clock_time, 'ns')
|
||||
print("Actual:", actual_clock_time, 'ns')
|
||||
print("Diff (A - - S):", actual_clock_time - -total_clock_time, 'ns')
|
||||
print()
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue