mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 11:33:32 +01:00
ZH: period_from_shower sort by maxima
Start by correlating the strongest signals
This commit is contained in:
parent
f96d3adb15
commit
ecc79a8c91
1 changed files with 12 additions and 0 deletions
|
@ -28,6 +28,7 @@ def find_best_sample_shifts_summing_at_location(test_loc, antennas, allowed_samp
|
|||
t_ = []
|
||||
t_min = 1e9
|
||||
t_max = -1e9
|
||||
a_maxima = []
|
||||
|
||||
if dt is None:
|
||||
dt = antennas[0].t_AxB[1] - antennas[0].t_AxB[0]
|
||||
|
@ -41,12 +42,18 @@ def find_best_sample_shifts_summing_at_location(test_loc, antennas, allowed_samp
|
|||
t__ = np.subtract(ant.t_AxB, delta)
|
||||
t_.append(t__)
|
||||
a_.append(ant.E_AxB)
|
||||
a_maxima.append(max(ant.E_AxB))
|
||||
|
||||
if t__[0] < t_min:
|
||||
t_min = t__[0]
|
||||
if t__[-1] > t_max:
|
||||
t_max = t__[-1]
|
||||
|
||||
# sort traces with descending maxima
|
||||
sort_idx = np.argsort(a_maxima)[::-1]
|
||||
t_ = [ t_[i] for i in sort_idx ]
|
||||
a_ = [ a_[i] for i in sort_idx ]
|
||||
|
||||
# Interpolate and find best sample shift
|
||||
max_neg_shift = 0 #np.min(allowed_sample_shifts) * dt
|
||||
max_pos_shift = 0 #np.max(allowed_sample_shifts) * dt
|
||||
|
@ -92,6 +99,11 @@ def find_best_sample_shifts_summing_at_location(test_loc, antennas, allowed_samp
|
|||
fig.savefig(path.join(fig_dir, __file__ + '.loc{:.1f}-{:.1f}-{:.1f}'.format(*test_loc) + f'.i{i}{fig_distinguish}.pdf'))
|
||||
plt.close(fig)
|
||||
|
||||
# sort by antenna (undo sorting by maximum)
|
||||
undo_sort_idx = np.argsort(sort_idx)
|
||||
|
||||
best_sample_shifts = best_sample_shifts[undo_sort_idx]
|
||||
|
||||
# Return ks
|
||||
return best_sample_shifts, np.max(a_sum)
|
||||
|
||||
|
|
Loading…
Reference in a new issue