ZH: k-find: only correlate against strongest signal

The summing of the first antennas can bias the k's for later antennas.
Since the set of k's is limited to -3,-2,..,3 this influences the amount of 'correct' k's to try.
It is better to use the strongest signal only to keep the same reference point
This commit is contained in:
Eric Teunis de Boone 2023-05-01 17:21:56 +02:00
parent 092c9344f3
commit 278d029f8e
1 changed files with 4 additions and 2 deletions

View File

@ -68,6 +68,7 @@ def find_best_period_shifts_summing_at_location(test_loc, antennas, allowed_ks,
t_sum = np.arange(t_min+max_neg_shift, t_max+max_pos_shift, dt)
a_sum = np.zeros(len(t_sum))
a_first = np.zeros(len(t_sum))
best_period_shifts = np.zeros( (len(antennas)) ,dtype=int)
for i, (t_r, E_) in enumerate(zip(t_, a_)):
@ -75,6 +76,7 @@ def find_best_period_shifts_summing_at_location(test_loc, antennas, allowed_ks,
if i == 0:
a_sum += f(t_sum)
a_first = a_sum
best_period_shifts[i] = period_shift_first_trace
continue
@ -94,14 +96,14 @@ def find_best_period_shifts_summing_at_location(test_loc, antennas, allowed_ks,
ax2.set_title("Maxima at {}; i={i}/{tot}".format(title_location, i=i, tot=N_ant))
ax2.set_xlabel("$k$th Period")
ax2.set_ylabel("Summed Amplitude")
ax2.plot(0, np.max(a_sum), marker='*', label='trace_sum', ls='none', ms=20)
ax2.plot(0, np.max(a_first), marker='*', label='strongest trace', ls='none', ms=20)
# find the maxima for each period shift k
shift_maxima = np.zeros( len(allowed_ks) )
for j, k in enumerate(allowed_ks):
augmented_a = f(t_sum + k*period)
shift_maxima[j] = np.max(augmented_a + a_sum)
shift_maxima[j] = np.max(augmented_a + a_first)
if i in plot_iteration_with_shifted_trace and abs(k) <= 3:
ax.plot(t_sum, augmented_a, alpha=0.7, ls='dashed', label=f'{k:g}')