mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 03:23:34 +01:00
ZH: findks: introduce snr into period shift figures
This commit is contained in:
parent
3bc5504c2b
commit
5abed24ecf
1 changed files with 6 additions and 5 deletions
|
@ -20,7 +20,7 @@ import aa_generate_beacon as beacon
|
||||||
import lib
|
import lib
|
||||||
from lib import rit
|
from lib import rit
|
||||||
|
|
||||||
def find_best_period_shifts_summing_at_location(test_loc, antennas, allowed_ks, period=1, dt=None, period_shift_first_trace=0, plot_iteration_with_shifted_trace=None, fig_dir=None, fig_distinguish=None):
|
def find_best_period_shifts_summing_at_location(test_loc, antennas, allowed_ks, period=1, dt=None, period_shift_first_trace=0, plot_iteration_with_shifted_trace=None, fig_dir=None, fig_distinguish=None,snr_str=None):
|
||||||
"""
|
"""
|
||||||
Find the best sample_shift for each antenna by summing the antenna traces
|
Find the best sample_shift for each antenna by summing the antenna traces
|
||||||
and seeing how to get the best alignment.
|
and seeing how to get the best alignment.
|
||||||
|
@ -81,7 +81,7 @@ def find_best_period_shifts_summing_at_location(test_loc, antennas, allowed_ks,
|
||||||
# init figure
|
# init figure
|
||||||
if i in plot_iteration_with_shifted_trace:
|
if i in plot_iteration_with_shifted_trace:
|
||||||
fig, ax = plt.subplots(figsize=figsize)
|
fig, ax = plt.subplots(figsize=figsize)
|
||||||
ax.set_title("Traces at ({:.1f},{:.1f},{:.1f}) i={i}/{tot}".format(*test_loc, i=i, tot=N_ant))
|
ax.set_title("Traces at ({:.1g},{:.1g},{:.1g}); i={i}/{tot}".format(*test_loc, i=i, tot=N_ant))
|
||||||
ax.set_xlabel("Time [ns]")
|
ax.set_xlabel("Time [ns]")
|
||||||
ax.set_ylabel("Amplitude")
|
ax.set_ylabel("Amplitude")
|
||||||
ax.plot(t_sum, a_sum)
|
ax.plot(t_sum, a_sum)
|
||||||
|
@ -108,7 +108,7 @@ def find_best_period_shifts_summing_at_location(test_loc, antennas, allowed_ks,
|
||||||
if True: # plot best k again
|
if True: # plot best k again
|
||||||
ax.plot(t_sum, best_augmented_a, alpha=0.8, label=f'best $k$={best_period_shifts[i]:g}', lw=2)
|
ax.plot(t_sum, best_augmented_a, alpha=0.8, label=f'best $k$={best_period_shifts[i]:g}', lw=2)
|
||||||
|
|
||||||
ax.legend( ncol=5 )
|
ax.legend(title='period shift $k$; '+snr_str, ncol=5 )
|
||||||
if fig_dir:
|
if fig_dir:
|
||||||
fig.tight_layout()
|
fig.tight_layout()
|
||||||
fname = path.join(fig_dir, path.basename(__file__) + f'.{fig_distinguish}i{i}' + '.loc{:.1f}-{:.1f}-{:.1f}'.format(*test_loc))
|
fname = path.join(fig_dir, path.basename(__file__) + f'.{fig_distinguish}i{i}' + '.loc{:.1f}-{:.1f}-{:.1f}'.format(*test_loc))
|
||||||
|
@ -212,7 +212,7 @@ if __name__ == "__main__":
|
||||||
ev.antennas = antennas
|
ev.antennas = antennas
|
||||||
# read in snr information
|
# read in snr information
|
||||||
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
beacon_snrs = beacon.read_snr_file(beacon_snr_fname)
|
||||||
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1e}"
|
snr_str = f"$\\langle SNR \\rangle$ = {beacon_snrs['mean']: .1g}"
|
||||||
|
|
||||||
# For now only implement using one freq_name
|
# For now only implement using one freq_name
|
||||||
freq_names = antennas[0].beacon_info.keys()
|
freq_names = antennas[0].beacon_info.keys()
|
||||||
|
@ -412,7 +412,8 @@ if __name__ == "__main__":
|
||||||
# Find best k for each antenna
|
# Find best k for each antenna
|
||||||
ks_per_loc[i], maxima_per_loc[i] = find_best_period_shifts_summing_at_location(test_loc, ev.antennas, allowed_ks, period=1/f_beacon, dt=dt,
|
ks_per_loc[i], maxima_per_loc[i] = find_best_period_shifts_summing_at_location(test_loc, ev.antennas, allowed_ks, period=1/f_beacon, dt=dt,
|
||||||
plot_iteration_with_shifted_trace=[ 5, len(ev.antennas)-1],
|
plot_iteration_with_shifted_trace=[ 5, len(ev.antennas)-1],
|
||||||
fig_dir=tmp_fig_subdir, fig_distinguish=f"run{r}.")
|
fig_dir=tmp_fig_subdir, fig_distinguish=f"run{r}.",
|
||||||
|
snr_str=snr_str)
|
||||||
|
|
||||||
xx = np.array(xx)
|
xx = np.array(xx)
|
||||||
yy = np.array(yy)
|
yy = np.array(yy)
|
||||||
|
|
Loading…
Reference in a new issue