ZH: improve temporary correlation figures

This commit is contained in:
Eric Teunis de Boone 2022-12-23 12:27:25 +01:00
parent 6eba992a3a
commit 0d8bce9953

View file

@ -93,18 +93,23 @@ def find_best_sample_shifts_summing_at_location(test_loc, antennas, allowed_samp
shift_maxima[j] = np.max(augmented_a + a_sum)
if i in plot_iteration_with_shifted_trace:
ax.plot(t_sum, augmented_a, alpha=0.8, label=f'{shift}')
ax.plot(t_sum, augmented_a, alpha=0.7, ls='dashed', label=f'{shift}')
# transform maximum into best_sample_shift
best_idx = np.argmax(shift_maxima)
best_sample_shifts[i] = allowed_sample_shifts[best_idx]
a_sum += np.roll(a_int, best_sample_shifts[i])
best_augmented_a = np.roll(a_int, best_sample_shifts[i])
a_sum += best_augmented_a
# cleanup figure
if i in plot_iteration_with_shifted_trace:
ax.legend( ncol=5)
if True: # plot best k again
ax.plot(t_sum, augmented_a, alpha=0.8, label=f'best k={best_sample_shifts[i]}', lw=2)
ax.legend( ncol=5 )
if fig_dir:
fig.tight_layout()
fname = path.join(fig_dir, __file__ + f'.{fig_distinguish}i{i}' + '.loc{:.1f}-{:.1f}-{:.1f}'.format(*test_loc))
if True:
old_xlim = ax.get_xlim()
@ -117,7 +122,7 @@ def find_best_sample_shifts_summing_at_location(test_loc, antennas, allowed_samp
if True: # zoomed on peak of this trace
x = t_r[np.argmax(E_)]
wx = 10 + max(best_sample_shifts) - min(best_sample_shifts)
wx = 50 + (max(best_sample_shifts) - min(best_sample_shifts))*dt
ax.set_xlim(x-wx, x+wx)
fig.savefig(fname + ".zoomed.peak.pdf")