mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 03:23:34 +01:00
ZH: matrix: improve SNR vs time res plot
This commit is contained in:
parent
68e272a5dc
commit
8dc2d3b7f0
1 changed files with 18 additions and 5 deletions
|
@ -126,6 +126,7 @@ if __name__ == "__main__":
|
||||||
ax.set_ylabel('Time Accuracy $\\sigma(t)$ [ns]')
|
ax.set_ylabel('Time Accuracy $\\sigma(t)$ [ns]')
|
||||||
|
|
||||||
# group per directories per N
|
# group per directories per N
|
||||||
|
dirkeys = []
|
||||||
if True:
|
if True:
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -140,18 +141,23 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
dirdict[m].append(d)
|
dirdict[m].append(d)
|
||||||
|
|
||||||
|
dirkeys = list(dirdict.keys())
|
||||||
dirlist = dirdict.values()
|
dirlist = dirdict.values()
|
||||||
|
|
||||||
# plot data directories as one group
|
# plot data directories as one group
|
||||||
else:
|
else:
|
||||||
dirlist = [args.data_directories]
|
dirlist = [args.data_directories]
|
||||||
|
|
||||||
for dirlist in dirlist:
|
for i, dirlist in enumerate(dirlist):
|
||||||
f_beacon, snrs, time_residuals = read_snr_directories(dirlist)
|
f_beacon, snrs, time_residuals = read_snr_directories(dirlist)
|
||||||
|
|
||||||
|
if dirkeys:
|
||||||
|
label = "N = " + dirkeys[i]
|
||||||
|
else:
|
||||||
|
label = None
|
||||||
|
|
||||||
# plot data
|
# plot data
|
||||||
ax.plot(snrs*np.sqrt(np.pi/2), phase2time(time_residuals[:,1]), ls='none', marker='o')
|
ax.plot(snrs*np.sqrt(np.pi/2), phase2time(time_residuals[:,1]), ls='none', marker='o', label=label)
|
||||||
|
|
||||||
# Add secondary axis
|
# Add secondary axis
|
||||||
if True:
|
if True:
|
||||||
|
@ -182,11 +188,11 @@ if __name__ == "__main__":
|
||||||
else: #linear
|
else: #linear
|
||||||
_snrs = np.linspace(_snr_min, _snr_max)
|
_snrs = np.linspace(_snr_min, _snr_max)
|
||||||
|
|
||||||
# Phasor Rice
|
# Random Phasor Sum
|
||||||
phasor_pdfs = np.array([phase_distribution(thetas, sigma, s) for s in _snrs ])
|
phasor_pdfs = np.array([phase_distribution(thetas, sigma, s) for s in _snrs ])
|
||||||
phasor_sigma = np.sqrt(np.array([variance(thetas, pdf) for pdf in phasor_pdfs]))
|
phasor_sigma = np.sqrt(np.array([variance(thetas, pdf) for pdf in phasor_pdfs]))
|
||||||
|
|
||||||
ax.plot(_snrs, phase2time(phasor_sigma), label='Rice')
|
ax.plot(_snrs, phase2time(phasor_sigma), label='Random Phasor Sum')
|
||||||
|
|
||||||
if True: # plot a pdf
|
if True: # plot a pdf
|
||||||
fig2, ax2 = plt.subplots()
|
fig2, ax2 = plt.subplots()
|
||||||
|
@ -207,6 +213,13 @@ if __name__ == "__main__":
|
||||||
if not True or ax.get_xscale() != 'log':
|
if not True or ax.get_xscale() != 'log':
|
||||||
ax.set_xlim(0, 100)
|
ax.set_xlim(0, 100)
|
||||||
|
|
||||||
|
# Set horizontal line at 1 ns
|
||||||
|
if True:
|
||||||
|
ax.axhline(1, ls='--', alpha=0.8, color='g')
|
||||||
|
|
||||||
|
if True:
|
||||||
|
ax.grid()
|
||||||
|
|
||||||
if args.fig_dir:
|
if args.fig_dir:
|
||||||
fig.tight_layout()
|
fig.tight_layout()
|
||||||
fig.savefig(path.join(args.fig_dir, "time_res_vs_snr.pdf"))
|
fig.savefig(path.join(args.fig_dir, "time_res_vs_snr.pdf"))
|
||||||
|
|
Loading…
Reference in a new issue