mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-11-13 10:03:32 +01:00
ZH: Prefix simu scripts with alpabetical order
This commit is contained in:
parent
bca152c9cd
commit
205b67f691
5 changed files with 59 additions and 6 deletions
|
@ -4,10 +4,10 @@ all: beacon clocks
|
||||||
|
|
||||||
|
|
||||||
beacon:
|
beacon:
|
||||||
./generate_beacon.py
|
./aa_generate_beacon.py
|
||||||
|
|
||||||
clocks:
|
clocks:
|
||||||
./modify_clocks.py
|
./ab_modify_clocks.py
|
||||||
|
|
||||||
dist-clean:
|
dist-clean:
|
||||||
rm -f ZH_airshower/antennas.hdf5
|
rm -f ZH_airshower/antennas.hdf5
|
||||||
|
|
|
@ -9,13 +9,19 @@ The produced files can be read using [./earsim](./earsim).
|
||||||
|
|
||||||
Steps:
|
Steps:
|
||||||
1. Setup
|
1. Setup
|
||||||
1. Beacon ([./generate_beacon.py])
|
1. Beacon ([./aa_generate_beacon.py])
|
||||||
1. Define tx position
|
1. Define tx position
|
||||||
2. Read in antennas
|
2. Read in antennas
|
||||||
3. Sample beacon at each antenna
|
3. Sample beacon at each antenna
|
||||||
4. Add to relevant polarisation
|
4. Add to relevant polarisation
|
||||||
5. Save antenna traces
|
5. Save antenna traces
|
||||||
|
|
||||||
2. Timeoffset ([./generate_timeoffset.pyt])
|
2. Timeoffset ([./ab_modify_clocks.py])
|
||||||
1. Generate timeoffsets for each antenna
|
1. Generate timeoffsets for each antenna
|
||||||
2. Modify time samples
|
2. Modify time samples
|
||||||
|
|
||||||
|
2. Beacon analysis
|
||||||
|
1. Find beacon frequency and phase in antenna traces ([./ba_beacon_phases.py])
|
||||||
|
2. Find k\*2\\pi phase offsets (periods) ([./bb_beacon_multiples.py])
|
||||||
|
|
||||||
|
3. Rewrite clocks
|
||||||
|
|
|
@ -52,6 +52,7 @@ def read_beacon_hdf5(fname):
|
||||||
antenna.Ex = ant['traces'][1]
|
antenna.Ex = ant['traces'][1]
|
||||||
antenna.Ey = ant['traces'][2]
|
antenna.Ey = ant['traces'][2]
|
||||||
antenna.Ez = ant['traces'][3]
|
antenna.Ez = ant['traces'][3]
|
||||||
|
if len(ant['traces']) > 4:
|
||||||
antenna.beacon = ant['traces'][4]
|
antenna.beacon = ant['traces'][4]
|
||||||
|
|
||||||
antennas.append(antenna)
|
antennas.append(antenna)
|
|
@ -9,7 +9,7 @@ from copy import deepcopy as copy
|
||||||
|
|
||||||
from earsim import REvent, Antenna
|
from earsim import REvent, Antenna
|
||||||
|
|
||||||
import generate_beacon as beacon
|
import aa_generate_beacon as beacon
|
||||||
|
|
||||||
import lib
|
import lib
|
||||||
|
|
46
simulations/airshower_beacon_simulation/view_beaconed_antenna.py
Executable file
46
simulations/airshower_beacon_simulation/view_beaconed_antenna.py
Executable file
|
@ -0,0 +1,46 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy.fft as ft
|
||||||
|
|
||||||
|
from earsim import Antenna
|
||||||
|
import aa_generate_beacon as beacon
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import os.path as path
|
||||||
|
|
||||||
|
fname = "ZH_airshower/mysim.sry"
|
||||||
|
|
||||||
|
####
|
||||||
|
fname_dir = path.dirname(fname)
|
||||||
|
antennas_fname = path.join(fname_dir, beacon.antennas_fname)
|
||||||
|
|
||||||
|
f_beacon, tx, antennas = beacon.read_beacon_hdf5(antennas_fname)
|
||||||
|
|
||||||
|
idx = [0, len(antennas)//2, -1]
|
||||||
|
fig1, axs = plt.subplots(2)
|
||||||
|
axs[0].set_xlabel('t [ns]')
|
||||||
|
axs[0].set_ylabel('[$\mu$V/m]')
|
||||||
|
axs[1].set_xlabel('f [GHz]')
|
||||||
|
axs[1].set_ylabel('Power')
|
||||||
|
|
||||||
|
for i in idx:
|
||||||
|
ant = antennas[i]
|
||||||
|
|
||||||
|
n_samples = len(ant.t)
|
||||||
|
samplerate = (ant.t[-1] - ant.t[0])/n_samples
|
||||||
|
|
||||||
|
axs[0].axvline(ant.t[0], color='k', alpha=0.5)
|
||||||
|
|
||||||
|
for direction, trace in dict(x=ant.Ex, y=ant.Ex, z=ant.Ez).items():
|
||||||
|
freqs = ft.fftfreq(n_samples, 1/samplerate)[:n_samples//2]
|
||||||
|
fft = 2*ft.fft(trace)[:n_samples//2]/n_samples
|
||||||
|
|
||||||
|
axs[0].plot(ant.t, trace, label=f"E{direction} {i}")
|
||||||
|
axs[1].plot(freqs, np.abs(fft))
|
||||||
|
|
||||||
|
fig1.legend(loc='center right', ncol=min(3, len(idx)))
|
||||||
|
|
||||||
|
#fig1.savefig('./fig1.png')
|
||||||
|
plt.show()
|
Loading…
Reference in a new issue