From 0966be97b917c192b44d6667745604a819ba0e21 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 10 Nov 2022 15:08:00 +0100 Subject: [PATCH] ZH: Allow the beacon's signal to decrease with distance --- simulations/airshower_beacon_simulation/lib.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/simulations/airshower_beacon_simulation/lib.py b/simulations/airshower_beacon_simulation/lib.py index 2fb0c48..b5e1a81 100644 --- a/simulations/airshower_beacon_simulation/lib.py +++ b/simulations/airshower_beacon_simulation/lib.py @@ -5,8 +5,8 @@ import numpy as np from earsim import Antenna -def sine_beacon(f, t, t0=0, amplitude=1): - return amplitude * np.sin(2*np.pi*f*(t-t0)) +def sine_beacon(f, t, t0=0, amplitude=1, baseline=0): + return amplitude * np.sin(2*np.pi*f*(t-t0)) + baseline def distance(x1, x2): @@ -22,8 +22,11 @@ def distance(x1, x2): return np.sqrt( np.sum( (x1-x2)**2 ) ) -def beacon_from(tx, rx, f, t=0, t0=0, c_light=3e8, **kwargs): - dist = distance(tx,rx)/c_light +def beacon_from(tx, rx, f, t=0, t0=0, c_light=3e8, radiate_rsq=True, amplitude=1,**kwargs): + dist = distance(tx,rx) t0 = t0 + dist/c_light - return sine_beacon(f, t, t0=t0, **kwargs) + if radiate_rsq: + amplitude *= 1/(dist**2) + + return sine_beacon(f, t, t0=t0, amplitude=amplitude,**kwargs)