mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-11-14 02:23:32 +01:00
ZH: make a plot of a single antenna after beaconing
This commit is contained in:
parent
9f16aced49
commit
82ad45730e
2 changed files with 51 additions and 22 deletions
|
@ -10,6 +10,7 @@ beacon:
|
||||||
./aa_generate_beacon.py | tee figures/aa.log
|
./aa_generate_beacon.py | tee figures/aa.log
|
||||||
./ab_modify_clocks.py 0 | tee figures/ab.log
|
./ab_modify_clocks.py 0 | tee figures/ab.log
|
||||||
./ac_show_signal_to_noise.py --no-show-plots --fig-dir=${FIG_DIR}
|
./ac_show_signal_to_noise.py --no-show-plots --fig-dir=${FIG_DIR}
|
||||||
|
./view_beaconed_antenna.py 72 -p x -p y -p z -p AxB --no-show-plots --fig-dir=${FIG_DIR}
|
||||||
|
|
||||||
clocks:
|
clocks:
|
||||||
./ab_modify_clocks.py 15 --gaussian
|
./ab_modify_clocks.py 15 --gaussian
|
||||||
|
|
|
@ -11,12 +11,32 @@ from earsim import Antenna
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import os.path as path
|
from os import path
|
||||||
|
import sys
|
||||||
|
import matplotlib
|
||||||
|
import os
|
||||||
|
if os.name == 'posix' and "DISPLAY" not in os.environ:
|
||||||
|
matplotlib.use('Agg')
|
||||||
|
|
||||||
|
from scriptlib import MyArgumentParser
|
||||||
|
parser = MyArgumentParser()
|
||||||
|
parser.add_argument('ant_idx', default=[72], nargs='*', help='Antenna Indices')
|
||||||
|
parser.add_argument('-p', '--polarisations', choices=['x', 'y', 'z', 'b', 'AxB'], action='append', help='Default: x,y,z')
|
||||||
|
parser.add_argument('--geom', action='store_true', help='Make a figure containg the geometry from tx to antenna(s)')
|
||||||
|
parser.add_argument('--ft', action='store_true', help='Add FT strenghts of antenna traces')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
fname = "ZH_airshower/mysim.sry"
|
fname = "ZH_airshower/mysim.sry"
|
||||||
|
|
||||||
plot_ft_amplitude = True
|
plot_ft_amplitude = args.ft
|
||||||
plot_geometry = True
|
plot_geometry = args.geom
|
||||||
|
|
||||||
|
fig_dir = args.fig_dir
|
||||||
|
show_plots = args.show_plots
|
||||||
|
|
||||||
|
if not args.polarisations:
|
||||||
|
args.polarisations = ['x','y', 'z']
|
||||||
|
|
||||||
####
|
####
|
||||||
fname_dir = path.dirname(fname)
|
fname_dir = path.dirname(fname)
|
||||||
|
@ -24,17 +44,18 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
f_beacon, tx, antennas = beacon.read_beacon_hdf5(antennas_fname)
|
f_beacon, tx, antennas = beacon.read_beacon_hdf5(antennas_fname)
|
||||||
|
|
||||||
if not True:
|
idx = args.ant_idx
|
||||||
idx = [0, 1, len(antennas)//2, len(antennas)//2+1, -2, -1]
|
|
||||||
elif not True:
|
|
||||||
idx = np.arange(1, 20, 2, dtype=int)
|
|
||||||
elif True:
|
|
||||||
# center 6 antennas
|
|
||||||
names = [55, 56, 57, 65, 66, 45, 46]
|
|
||||||
|
|
||||||
idx = [ i for i, ant in enumerate(antennas) if int(ant.name) in names ]
|
if not idx:
|
||||||
|
if not True:
|
||||||
|
idx = [0, 1, len(antennas)//2, len(antennas)//2+1, -2, -1]
|
||||||
|
elif not True:
|
||||||
|
idx = np.arange(1, 20, 2, dtype=int)
|
||||||
|
elif True:
|
||||||
|
# center 6 antennas
|
||||||
|
names = [55, 56, 57, 65, 66, 45, 46]
|
||||||
|
|
||||||
[ print(antennas[i].name) for i in names ]
|
idx = [ i for i, ant in enumerate(antennas) if int(ant.name) in names ]
|
||||||
|
|
||||||
fig1, axs = plt.subplots(1+plot_ft_amplitude*2)
|
fig1, axs = plt.subplots(1+plot_ft_amplitude*2)
|
||||||
if not plot_ft_amplitude:
|
if not plot_ft_amplitude:
|
||||||
|
@ -58,15 +79,18 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
axs[0].axvline(ant.t[0], color='k', alpha=0.5)
|
axs[0].axvline(ant.t[0], color='k', alpha=0.5)
|
||||||
|
|
||||||
if True: # total E field
|
mydict = {}
|
||||||
mydict = dict(AxB=ant.E_AxB)
|
for p in args.polarisations:
|
||||||
elif False: # polarisations
|
pattr = 'E'+str(p)
|
||||||
mydict = dict(x=ant.Ex, y=ant.Ex, z=ant.Ez)
|
if p == 'b':
|
||||||
else: # beacon
|
pattr = 'beacon'
|
||||||
mydict = dict(b=ant.beacon)
|
elif p == 'AxB':
|
||||||
|
pattr = 'E_AxB'
|
||||||
|
|
||||||
|
mydict[p] = getattr(ant, pattr)
|
||||||
|
|
||||||
for j, (direction, trace) in enumerate(mydict.items()):
|
for j, (direction, trace) in enumerate(mydict.items()):
|
||||||
l = axs[0].plot(ant.t, trace, label=f"$E_{{{direction}}}$ {ant.name}", alpha=0.8)
|
l = axs[0].plot(ant.t, trace, label=f"$E_{{{direction}}}$ {ant.name}", alpha=0.7)
|
||||||
|
|
||||||
#if False and j == 0 and 't0' in ant.attrs:
|
#if False and j == 0 and 't0' in ant.attrs:
|
||||||
# axs[0].axvline(ant.attrs['t0'], color=l[0].get_color(), alpha=0.5)
|
# axs[0].axvline(ant.attrs['t0'], color=l[0].get_color(), alpha=0.5)
|
||||||
|
@ -95,7 +119,9 @@ if __name__ == "__main__":
|
||||||
if plot_ft_amplitude:
|
if plot_ft_amplitude:
|
||||||
fig1.legend(loc='center right', ncol=min(2, len(idx)))
|
fig1.legend(loc='center right', ncol=min(2, len(idx)))
|
||||||
else:
|
else:
|
||||||
fig1.legend(loc='upper right', ncol=min(3, len(idx)))
|
axs[0].legend(loc='upper right', ncol=min(3, len(idx)))
|
||||||
|
if fig_dir:
|
||||||
|
fig1.savefig(path.join(fig_dir, path.basename(__file__) + f".trace.pdf"))
|
||||||
|
|
||||||
if plot_geometry:
|
if plot_geometry:
|
||||||
if len(mydict) == 1:
|
if len(mydict) == 1:
|
||||||
|
@ -110,6 +136,8 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
axs2.plot(tx.x, tx.y, marker='X', color='k')
|
axs2.plot(tx.x, tx.y, marker='X', color='k')
|
||||||
axs2.set_title("Geometry with selected antennas")
|
axs2.set_title("Geometry with selected antennas")
|
||||||
|
if fig_dir:
|
||||||
|
fig2.savefig(path.join(fig_dir, path.basename(__file__) + f".geom.pdf"))
|
||||||
|
|
||||||
#fig1.savefig('./fig1.png')
|
if show_plots:
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
Loading…
Reference in a new issue