Pulse timing: trace_resamplers paramater change

This commit is contained in:
Eric Teunis de Boone 2023-04-24 13:12:53 +02:00
parent bca924cdc2
commit 354ec93a79

View file

@ -106,7 +106,7 @@ def my_correlation(in1, template, lags=None):
return corrs, (in1, template, lags) return corrs, (in1, template, lags)
def trace_upsampler(template_signal, trace, template_t, trace_t): def trace_upsampler(trace, template_t, trace_t):
template_dt = template.t[1] - template.t[0] template_dt = template.t[1] - template.t[0]
trace_dt = trace_t[1] - trace_t[0] trace_dt = trace_t[1] - trace_t[0]
@ -125,7 +125,7 @@ def trace_upsampler(template_signal, trace, template_t, trace_t):
return upsampled_trace, upsampled_t return upsampled_trace, upsampled_t
def template_downsampler(template_signal, trace, template_t, trace_t, offset): def trace_downsampler(trace, template_t, trace_t, offset):
pass pass
@ -138,7 +138,7 @@ if __name__ == "__main__":
bp_freq = (30e-3, 80e-3) # GHz bp_freq = (30e-3, 80e-3) # GHz
template_dt = 5e-2 # ns template_dt = 5e-2 # ns
template_length = 100 # ns template_length = 500 # ns
noise_sigma_factor = 1e0 # keep between 10 and 0.1 noise_sigma_factor = 1e0 # keep between 10 and 0.1
N_residuals = 50*3 if len(sys.argv) < 2 else int(sys.argv[1]) N_residuals = 50*3 if len(sys.argv) < 2 else int(sys.argv[1])
@ -236,7 +236,7 @@ if __name__ == "__main__":
axs2 = None axs2 = None
if True: # upsampled trace if True: # upsampled trace
upsampled_trace, upsampled_t = trace_upsampler(template.signal, antenna.signal, template.t, antenna.t) upsampled_trace, upsampled_t = trace_upsampler(antenna.signal, template.t, antenna.t)
if do_plots: # Show upsampled traces if do_plots: # Show upsampled traces
fig2, axs2 = plt.subplots(1, sharex=True) fig2, axs2 = plt.subplots(1, sharex=True)
@ -337,14 +337,15 @@ if __name__ == "__main__":
plt.close(fig) plt.close(fig)
# Make a plot of the time residuals # Make a plot of the time residuals
fig, ax = plt.subplots() if len(time_residuals) > 1:
ax.set_title("Template Correlation Lag finding") fig, ax = plt.subplots()
ax.set_xlabel("Time Residual [ns]") ax.set_title("Template Correlation Lag finding")
ax.set_ylabel("#") ax.set_xlabel("Time Residual [ns]")
ax.hist(time_residuals, bins='sqrt', density=False) ax.set_ylabel("#")
ax.hist(time_residuals, bins='sqrt', density=False)
ax.legend(title=f"template dt: {template.dt: .1e}ns\nantenna dt: {antenna.dt: .1e}ns") ax.legend(title=f"template dt: {template.dt: .1e}ns\nantenna dt: {antenna.dt: .1e}ns")
fig.savefig("figures/11_time_residual_hist.pdf") fig.savefig("figures/11_time_residual_hist.pdf")
plt.show() plt.show()