ZH: allow to modify tracelengths in beacon_phases

This commit is contained in:
Eric Teunis de Boone 2022-11-25 11:31:19 +01:00
parent dd00aebe3b
commit 22ccf7e3e3

View file

@ -99,6 +99,14 @@ if __name__ == "__main__":
test_traces = traces[1:]
orients = ['Ex', 'Ey', 'Ez', 'B']
# modify the length of the traces
if False:
t_trace = t_trace[:len(t_trace)//2]
half_traces = []
for trace in test_traces:
half_traces.append( trace[:len(trace)//2])
test_traces = half_traces
# Do Fourier Transforms
# to find phases and amplitudes
if True:
@ -132,11 +140,13 @@ if __name__ == "__main__":
if show_plots and (i == 60 or i == 72):
fig, ax = plt.subplots()
trace_amp = max(traces[-1]) - min(traces[-1])
ax.set_xlabel("t [ns]")
ax.set_ylabel("Amplitude")
myt = np.linspace(min(traces[0]), max(traces[0]), 10*len(traces[0]))
ax.plot(t_trace, traces[-1], marker='.', label='trace')
ax.plot(myt, lib.sine_beacon(frequency, myt, amplitude=amplitude, phase=phase), ls='dashed', label='simulated')
myt = np.linspace(min(t_trace), max(t_trace), 10*len(t_trace))
for i, trace in enumerate(test_traces):
ax.plot(t_trace, test_traces[i], marker='.', label='trace '+orients[i])
ax.plot(myt, lib.sine_beacon(frequency, myt, amplitude=amplitude, phase=phase), ls='dashed', label='simulated beacon')
ax.set_title(f"Beacon at antenna {h5ant.attrs['name']}\nF:{frequency:.2e}, P:{phase:.4f}, A:{amplitude:.1e}")
ax.legend()
@ -178,4 +188,4 @@ if __name__ == "__main__":
ax.set_ylabel("Counts")
ax.hist(found_data[:,2], bins='sqrt', density=False)
plt.show()
plt.show()