ZH: always calculate orig_t maximum power for grid power figure

This commit is contained in:
Eric Teunis de Boone 2023-05-31 18:38:05 +02:00
parent e9f459b8fa
commit 1fee731ec3

View file

@ -254,8 +254,10 @@ if __name__ == "__main__":
fig = save_overlapping_traces_figure([0,0,0], ev, N_plot=1, wx=trace_zoom_wx, title_extra = plot_titling[case], fname_distinguish=f'single', fig_dir=fig_dir, figsize=figsize) fig = save_overlapping_traces_figure([0,0,0], ev, N_plot=1, wx=trace_zoom_wx, title_extra = plot_titling[case], fname_distinguish=f'single', fig_dir=fig_dir, figsize=figsize)
plt.close(fig) plt.close(fig)
no_offset_maximum_power = None # set in below loop
with joblib.parallel_backend("loky"): with joblib.parallel_backend("loky"):
for case in wanted_cases: # always force no_offset first to determine the reference vmax in the colorbar
for case in ['no_offset'] + [c for c in wanted_cases if c != 'no_offset']:
print(f"Starting {case} figure") print(f"Starting {case} figure")
# Repair clock offsets with the measured offsets # Repair clock offsets with the measured offsets
transl_modes = {'no_offset':'orig', 'repair_phases':'phases', 'repair_full':'full'} transl_modes = {'no_offset':'orig', 'repair_phases':'phases', 'repair_full':'full'}
@ -278,6 +280,19 @@ if __name__ == "__main__":
print("backup time, time with measured_offset, true clock offset, measured clock offset") print("backup time, time with measured_offset, true clock offset, measured clock offset")
print(bak_ants[i].t[0], ev.antennas[i].t[0], ev.antennas[i].attrs['clock_offset'], measured_offsets[i]) print(bak_ants[i].t[0], ev.antennas[i].t[0], ev.antennas[i].attrs['clock_offset'], measured_offsets[i])
#
# determine the maximum power for the true timing
#
if case == 'no_offset':
xx, yy, p, maxp_loc = rit.shower_plane_slice(ev, X=X, Nx=1, Ny=1, wx=0, wy=0, zgr=zgr)
no_offset_maximum_power = p
# we forced no_offset for determing the reference vmax
# simply continue with the rest
if case not in wanted_cases:
continue
# #
# Plot overlapping traces at 0,0,0 # Plot overlapping traces at 0,0,0
# #
@ -295,15 +310,18 @@ if __name__ == "__main__":
fig = save_overlapping_traces_figure(loc, ev, N_plot=N_plot, wx=trace_zoom_wx, title_extra = plot_titling[case], fname_distinguish=f'{case}.axis', location_text=f"on simulation axis, $X={X}$", fig_dir=fig_dir, figsize=figsize) fig = save_overlapping_traces_figure(loc, ev, N_plot=N_plot, wx=trace_zoom_wx, title_extra = plot_titling[case], fname_distinguish=f'{case}.axis', location_text=f"on simulation axis, $X={X}$", fig_dir=fig_dir, figsize=figsize)
plt.close(fig) plt.close(fig)
#
# Measure power on grid # Measure power on grid
# and plot overlapping traces at position with highest power # and plot overlapping traces at position with highest power
#
for scalename, scale in scales.items(): for scalename, scale in scales.items():
wx, wy = scale, scale wx, wy = scale, scale
print(f"Starting grid measurement for figure {case} with {scalename}") print(f"Starting grid measurement for figure {case} with {scalename}")
xx, yy, p, maxp_loc = rit.shower_plane_slice(ev, X=X, Nx=Nx, Ny=Nx, wx=wx, wy=wy, zgr=zgr) xx, yy, p, maxp_loc = rit.shower_plane_slice(ev, X=X, Nx=Nx, Ny=Nx, wx=wx, wy=wy, zgr=zgr)
fig, axs = rit.slice_figure(ev, X, xx, yy, p, mode='sp', scatter_kwargs=dict( fig, axs = rit.slice_figure(ev, X, xx, yy, p, mode='sp', scatter_kwargs=dict(
vmax=1e5, vmax=no_offset_maximum_power,
vmin=0, vmin=0,
s=250, s=250,
cmap='inferno', cmap='inferno',