mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 03:23:34 +01:00
ZH: control noise realisations when generating traces
This commit is contained in:
parent
cea74ee2cd
commit
2f6616734b
1 changed files with 5 additions and 3 deletions
|
@ -321,6 +321,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
# Noise properties
|
# Noise properties
|
||||||
noise_sigma = args.noise_sigma # mu V/m set to None to ignore
|
noise_sigma = args.noise_sigma # mu V/m set to None to ignore
|
||||||
|
unique_noise_realisations = True # a new noise realisation per antenna vs. single noise realisation shared across antennas
|
||||||
|
|
||||||
# Beacon properties
|
# Beacon properties
|
||||||
beacon_amplitudes = np.array(args.beacon_amplitudes) # mu V/m
|
beacon_amplitudes = np.array(args.beacon_amplitudes) # mu V/m
|
||||||
|
@ -381,6 +382,7 @@ if __name__ == "__main__":
|
||||||
init_antenna_hdf5(antennas_fname, tx, f_beacon)
|
init_antenna_hdf5(antennas_fname, tx, f_beacon)
|
||||||
|
|
||||||
# make beacon per antenna
|
# make beacon per antenna
|
||||||
|
noise_realisation = np.array([0])
|
||||||
for i, antenna in enumerate(ev.antennas):
|
for i, antenna in enumerate(ev.antennas):
|
||||||
#TODO: allow to change the samplerate (2, 4, 8 ns)
|
#TODO: allow to change the samplerate (2, 4, 8 ns)
|
||||||
|
|
||||||
|
@ -409,9 +411,9 @@ if __name__ == "__main__":
|
||||||
beacon = 1e-6 * lib.beacon_from(tx, antenna, f_beacon, antenna.t, c_light=c_light, radiate_rsq=beacon_radiate_rsq) # mu V/m
|
beacon = 1e-6 * lib.beacon_from(tx, antenna, f_beacon, antenna.t, c_light=c_light, radiate_rsq=beacon_radiate_rsq) # mu V/m
|
||||||
|
|
||||||
# noise realisation
|
# noise realisation
|
||||||
noise_realisation = 0
|
if unique_noise_realisations or (noise_realisation == 0).all(): # either create one for every antenna, or generate a single one
|
||||||
if noise_sigma is not None:
|
print("Noise realisation!")
|
||||||
noise_realisation = 1e-6 * rng.normal(0, noise_sigma, size=len(beacon)) # mu V/m
|
noise_realisation = 1e-6 * rng.normal(0, noise_sigma or 0, size=len(antenna.t)) # mu V/m
|
||||||
|
|
||||||
# Collect all data to be saved (with the first 3 values the E fields)
|
# Collect all data to be saved (with the first 3 values the E fields)
|
||||||
traces = np.array([antenna.Ex, antenna.Ey, antenna.Ez, beacon, noise_realisation])
|
traces = np.array([antenna.Ex, antenna.Ey, antenna.Ez, beacon, noise_realisation])
|
||||||
|
|
Loading…
Reference in a new issue