ZH: window traces for k finding

related to 7008e9e
This commit is contained in:
Eric Teunis de Boone 2023-01-30 10:18:16 +01:00
parent 7a43fb15d4
commit c6bd4d6ab0

View file

@ -166,6 +166,7 @@ if __name__ == "__main__":
N_runs = 3 N_runs = 3
remove_beacon_from_trace = True remove_beacon_from_trace = True
apply_signal_window_from_max = True
#### ####
fname_dir = path.dirname(fname) fname_dir = path.dirname(fname)
@ -201,13 +202,34 @@ if __name__ == "__main__":
# Prepare polarisation and passbands # Prepare polarisation and passbands
rit.set_pol_and_bp(ev, low=0.03, high=0.08) rit.set_pol_and_bp(ev, low=0.03, high=0.08)
# Remove time due to true phase ##
# and optionally remove the beacon ## Manipulate time and traces of each antenna
##
### Remove time due to true phase
### and optionally remove the beacon
measured_repair_offsets = beacon.read_antenna_clock_repair_offsets(ev.antennas, mode='phases', freq_name=freq_name) measured_repair_offsets = beacon.read_antenna_clock_repair_offsets(ev.antennas, mode='phases', freq_name=freq_name)
for i, ant in enumerate(ev.antennas): for i, ant in enumerate(ev.antennas):
ev.antennas[i].orig_t = ev.antennas[i].t_AxB ev.antennas[i].orig_t = ev.antennas[i].t_AxB
ev.antennas[i].t_AxB += measured_repair_offsets[i] ev.antennas[i].t_AxB += measured_repair_offsets[i]
if apply_signal_window_from_max:
N_pre, N_post = 250, 250
max_idx = np.argmax(ant.E_AxB)
low_idx = max(0, max_idx-N_pre)
high_idx = min(len(ant.t), max_idx+N_post)
ev.antennas[i].orig_t = ant.orig_t[low_idx:high_idx]
ev.antennas[i].t = ant.t[low_idx:high_idx]
ev.antennas[i].t_AxB = ant.t_AxB[low_idx:high_idx]
ev.antennas[i].Ex = ant.Ex[low_idx:high_idx]
ev.antennas[i].Ey = ant.Ey[low_idx:high_idx]
ev.antennas[i].Ez = ant.Ez[low_idx:high_idx]
ev.antennas[i].E_AxB = ant.E_AxB[low_idx:high_idx]
if remove_beacon_from_trace: if remove_beacon_from_trace:
clock_phase = measured_repair_offsets[i]*2*np.pi*f_beacon clock_phase = measured_repair_offsets[i]*2*np.pi*f_beacon