mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-11-12 17:43:33 +01:00
ZH: introduce fixed clock error in test script
This commit is contained in:
parent
3fce4036f3
commit
3cbdadc5ba
1 changed files with 8 additions and 2 deletions
|
@ -18,6 +18,7 @@ dt = 1 # ns
|
|||
frequency = 45e-3 # GHz
|
||||
N = 5e2
|
||||
c_light = lib.c_light
|
||||
t_clock = 3/4 * 1/frequency
|
||||
|
||||
t = np.arange(0, 10*int(1e3), dt, dtype=float)
|
||||
rng = np.random.default_rng(seed)
|
||||
|
@ -48,16 +49,21 @@ for i in range(int(N)):
|
|||
blank_low, blank_high = 2*int(1e3), 4*int(1e3)
|
||||
beacon[blank_low:blank_high] = 0
|
||||
|
||||
# Introduce clock errors
|
||||
t += t_clock
|
||||
measured = lib.find_beacon_in_traces([beacon], t, frequency, frequency_fit=False)
|
||||
t -= t_clock
|
||||
|
||||
calculated_phase = lib.remove_antenna_geometry_phase(tx, rx, frequency, measured[1][0], c_light=c_light)
|
||||
|
||||
phase_res[i] = lib.phase_mod(calculated_phase - phase)
|
||||
|
||||
# Make the figure
|
||||
fig, ax = plt.subplots()
|
||||
ax.set_title("Measured phase at Antenna - geometrical phase")
|
||||
ax.set_xlabel("$\\varphi_{meas} - \\varphi_{true}$ [rad]")
|
||||
ax.set_ylabel("#")
|
||||
ax.hist(phase_res, bins='sqrt')
|
||||
ax.hist(phase_res, bins='sqrt', density=False)
|
||||
ax.axvline( -1*lib.phase_mod(t_clock*frequency*2*np.pi), color='red', lw=5, alpha=0.8, label='true t_clock')
|
||||
ax.legend()
|
||||
plt.show()
|
||||
|
||||
|
|
Loading…
Reference in a new issue