mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 11:33:32 +01:00
ZH: extra flags for beacon generating
This commit is contained in:
parent
88b0b3d1d1
commit
67c152fffe
4 changed files with 18 additions and 7 deletions
|
@ -303,9 +303,14 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
# make beacon per antenna
|
# make beacon per antenna
|
||||||
for i, antenna in enumerate(ev.antennas):
|
for i, antenna in enumerate(ev.antennas):
|
||||||
|
if False:
|
||||||
t0 = lib.distance(tx, antenna)/3e8 * 1e9 # ns
|
t0 = lib.distance(tx, antenna)/3e8 * 1e9 # ns
|
||||||
|
c_light = np.inf
|
||||||
|
else:
|
||||||
|
t0 = 0
|
||||||
|
c_light = 3e8*1e-9 # m/ns
|
||||||
|
|
||||||
beacon = lib.beacon_from(tx, antenna, f_beacon, antenna.t, t0=t0, c_light=np.inf, radiate_rsq=beacon_radiate_rsq)
|
beacon = lib.beacon_from(tx, antenna, f_beacon, antenna.t, t0=t0, c_light=c_light, radiate_rsq=beacon_radiate_rsq)
|
||||||
|
|
||||||
traces = np.array([antenna.Ex, antenna.Ey, antenna.Ez, beacon])
|
traces = np.array([antenna.Ex, antenna.Ey, antenna.Ez, beacon])
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,10 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
N_antennas = len(group.keys())
|
N_antennas = len(group.keys())
|
||||||
|
|
||||||
|
if True: # uniform
|
||||||
clock_offsets = max_clock_offset * (2*rng.uniform(size=N_antennas) - 1)
|
clock_offsets = max_clock_offset * (2*rng.uniform(size=N_antennas) - 1)
|
||||||
|
else: # normal
|
||||||
|
clock_offsets = max_clock_offset * rng.normal(0, 1, size=N_antennas)
|
||||||
|
|
||||||
# modify time values of each antenna
|
# modify time values of each antenna
|
||||||
for i, name in enumerate(group.keys()):
|
for i, name in enumerate(group.keys()):
|
||||||
|
|
|
@ -29,6 +29,8 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
fname = "ZH_airshower/mysim.sry"
|
fname = "ZH_airshower/mysim.sry"
|
||||||
|
|
||||||
|
print("use_AxB_trace:", use_AxB_trace, "use_beacon_trace:",use_beacon_trace)
|
||||||
|
|
||||||
####
|
####
|
||||||
fname_dir = path.dirname(fname)
|
fname_dir = path.dirname(fname)
|
||||||
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||||
|
@ -140,14 +142,16 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
if show_plots and (i == 60 or i == 72):
|
if show_plots and (i == 60 or i == 72):
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
|
ax.set_title(f"Beacon at antenna {h5ant.attrs['name']}\nF:{frequency:.2e}, P:{phase:.4f}, A:{amplitude:.1e}")
|
||||||
ax.set_xlabel("t [ns]")
|
ax.set_xlabel("t [ns]")
|
||||||
ax.set_ylabel("Amplitude")
|
ax.set_ylabel("Amplitude")
|
||||||
|
|
||||||
myt = np.linspace(min(t_trace), max(t_trace), 10*len(t_trace))
|
|
||||||
for i, trace in enumerate(test_traces):
|
for i, trace in enumerate(test_traces):
|
||||||
ax.plot(t_trace, test_traces[i], marker='.', label='trace '+orients[i])
|
ax.plot(t_trace, test_traces[i], marker='.', label='trace '+orients[i])
|
||||||
|
|
||||||
|
myt = np.linspace(min(t_trace), max(t_trace), 10*len(t_trace))
|
||||||
ax.plot(myt, lib.sine_beacon(frequency, myt, amplitude=amplitude, phase=phase), ls='dashed', label='simulated beacon')
|
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()
|
ax.legend()
|
||||||
|
|
||||||
# save to file
|
# save to file
|
||||||
|
|
|
@ -38,7 +38,7 @@ if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
fname = "ZH_airshower/mysim.sry"
|
fname = "ZH_airshower/mysim.sry"
|
||||||
c_light = 3e8*1e-9
|
c_light = 3e8*1e-9 # m/ns
|
||||||
show_plots = True
|
show_plots = True
|
||||||
|
|
||||||
remove_absolute_phase_offset_first_antenna = True # takes precedence
|
remove_absolute_phase_offset_first_antenna = True # takes precedence
|
||||||
|
@ -66,7 +66,6 @@ if __name__ == "__main__":
|
||||||
for freq_name in antennas[0].beacon_info.keys():
|
for freq_name in antennas[0].beacon_info.keys():
|
||||||
true_phases = antenna_true_phases(tx, antennas, freq_name, c_light=c_light)
|
true_phases = antenna_true_phases(tx, antennas, freq_name, c_light=c_light)
|
||||||
|
|
||||||
|
|
||||||
# Remove the phase from one antenna
|
# Remove the phase from one antenna
|
||||||
# this is a free parameter
|
# this is a free parameter
|
||||||
# (only required for absolute timing)
|
# (only required for absolute timing)
|
||||||
|
|
Loading…
Reference in a new issue