mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 03:23:34 +01:00
ZH: repair cases: on axis overlapping traces
This commit is contained in:
parent
5243f09edc
commit
c08e2ae73c
1 changed files with 26 additions and 10 deletions
|
@ -18,17 +18,21 @@ import aa_generate_beacon as beacon
|
||||||
import lib
|
import lib
|
||||||
from lib import rit
|
from lib import rit
|
||||||
|
|
||||||
def save_overlapping_traces_figure(test_location, ev, N_plot = 30, wx=200, title_extra=None, fname_distinguish='', fig_dir=None, **fig_kwargs):
|
def save_overlapping_traces_figure(test_location, ev, N_plot = 30, wx=200, title_extra=None, fname_distinguish='', fig_dir=None, location_in_plot_text_loc=(0.02, 0.95), location_text=None, **fig_kwargs):
|
||||||
P, t_, a_, a_sum, t_sum = rit.pow_and_time(test_location, ev, dt=1)
|
P, t_, a_, a_sum, t_sum = rit.pow_and_time(test_location, ev, dt=1)
|
||||||
|
|
||||||
fig, axs = plt.subplots(**fig_kwargs)
|
fig, axs = plt.subplots(**fig_kwargs)
|
||||||
axs.set_title("Antenna traces" + (("\n" + title_extra) if title_extra is not None else '') )
|
axs.set_title("Antenna traces" + (("\n" + title_extra) if title_extra is not None else '') )
|
||||||
axs.set_xlabel("Time [ns]")
|
axs.set_xlabel("Time [ns]")
|
||||||
axs.set_ylabel("Amplitude [$\\mu V/m$]")
|
axs.set_ylabel("Amplitude [$\\mu V/m$]")
|
||||||
if True:
|
if location_in_plot_text_loc:
|
||||||
text_loc = (0.02, 0.95)
|
text_loc = location_in_plot_text_loc
|
||||||
shower_plane_location = rit.location_to_shower_plane(test_location, ev=ev)
|
|
||||||
axs.text(*text_loc, '[' + ', '.join(['{:.1g}'.format(x) for x in shower_plane_location]) + ']', ha='left', transform=axs.transAxes)
|
if not location_text:
|
||||||
|
shower_plane_location = rit.location_to_shower_plane(test_location, ev=ev)
|
||||||
|
location_text = '(' + ', '.join(['{:.1g}'.format(x) for x in shower_plane_location]) + ')'
|
||||||
|
|
||||||
|
axs.text(*text_loc, location_text, ha='left', transform=axs.transAxes)
|
||||||
|
|
||||||
a_max = [ np.amax(ant.E_AxB) for ant in ev.antennas ]
|
a_max = [ np.amax(ant.E_AxB) for ant in ev.antennas ]
|
||||||
power_sort_idx = np.argsort(a_max)
|
power_sort_idx = np.argsort(a_max)
|
||||||
|
@ -161,10 +165,10 @@ if __name__ == "__main__":
|
||||||
trace_zoom_wx = 100
|
trace_zoom_wx = 100
|
||||||
|
|
||||||
plot_titling = {
|
plot_titling = {
|
||||||
'no_offset': "no clock offset",
|
'no_offset': "no clock offsets",
|
||||||
'repair_none': "unrepaired clock offset",
|
'repair_none': "randomised clock offsets",
|
||||||
'repair_phases': "phase resolved clock offsets repaired",
|
'repair_phases': "phase clock offsets",
|
||||||
'repair_full': "final measured clock offsets repaired"
|
'repair_full': "phase + period clock offsets"
|
||||||
}
|
}
|
||||||
|
|
||||||
# For now only implement using one freq_name
|
# For now only implement using one freq_name
|
||||||
|
@ -253,6 +257,7 @@ if __name__ == "__main__":
|
||||||
transl_mode = transl_modes[case]
|
transl_mode = transl_modes[case]
|
||||||
measured_offsets = beacon.read_antenna_clock_repair_offsets(antennas, mode=transl_mode, freq_name=freq_name)
|
measured_offsets = beacon.read_antenna_clock_repair_offsets(antennas, mode=transl_mode, freq_name=freq_name)
|
||||||
else:
|
else:
|
||||||
|
print(f"Warning: unknown repair case requested '{case}', defaulting to none.")
|
||||||
measured_offsets = [0]*len(ev.antennas)
|
measured_offsets = [0]*len(ev.antennas)
|
||||||
|
|
||||||
for i, ant in enumerate(ev.antennas):
|
for i, ant in enumerate(ev.antennas):
|
||||||
|
@ -269,7 +274,18 @@ if __name__ == "__main__":
|
||||||
#
|
#
|
||||||
# Plot overlapping traces at 0,0,0
|
# Plot overlapping traces at 0,0,0
|
||||||
#
|
#
|
||||||
fig = save_overlapping_traces_figure([0,0,0], ev, N_plot=N_plot, wx=trace_zoom_wx, title_extra = plot_titling[case], fname_distinguish=f'{case}.0', fig_dir=fig_dir, figsize=figsize)
|
loc = (0,0,0)
|
||||||
|
fig = save_overlapping_traces_figure(loc, ev, N_plot=N_plot, wx=trace_zoom_wx, title_extra = plot_titling[case], fname_distinguish=f'{case}.0', fig_dir=fig_dir, figsize=figsize)
|
||||||
|
plt.close(fig)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Plot overlapping traces at simulation shower axis
|
||||||
|
#
|
||||||
|
dX = atm.distance_to_slant_depth(np.deg2rad(ev.zenith), X, zgr)
|
||||||
|
loc = (0)*ev.uAxB + (0)*ev.uAxAxB + dX * ev.uA
|
||||||
|
loc[0:1] = 0
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in a new issue