From 7b18837d6d3f4797b31eb8955cd381d0b82a63cd Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Fri, 13 Jan 2023 17:07:18 +0100 Subject: [PATCH] ZH: cli arguments for clock modification --- simulations/airshower_beacon_simulation/Makefile | 2 +- .../ab_modify_clocks.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/simulations/airshower_beacon_simulation/Makefile b/simulations/airshower_beacon_simulation/Makefile index cbdbbec..7528db2 100644 --- a/simulations/airshower_beacon_simulation/Makefile +++ b/simulations/airshower_beacon_simulation/Makefile @@ -12,7 +12,7 @@ beacon: ./ac_show_signal_to_noise.py --no-show-plots --fig-dir=${FIG_DIR} clocks: - ./ab_modify_clocks.py 15 + ./ab_modify_clocks.py 15 --gaussian phases: ./ba_measure_beacon_phase.py --no-show-plots --fig-dir=${FIG_DIR} diff --git a/simulations/airshower_beacon_simulation/ab_modify_clocks.py b/simulations/airshower_beacon_simulation/ab_modify_clocks.py index 413b03a..51c7e78 100755 --- a/simulations/airshower_beacon_simulation/ab_modify_clocks.py +++ b/simulations/airshower_beacon_simulation/ab_modify_clocks.py @@ -19,7 +19,17 @@ if __name__ == "__main__": from os import path import sys - max_clock_offset = 100 if len(sys.argv) < 2 else float(sys.argv[1]) # ns + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('max_clock_offset', nargs='?', type=float, default=25, help='(Default: %(default)d)') + parser.add_argument('--uniform', action='store_const', const='uniform', dest='dist_type') + parser.add_argument('--gaussian', action='store_const', const='gauss', dest='dist_type') + parser.set_defaults(dist_type='gauss') + + args = parser.parse_args() + + max_clock_offset = args.max_clock_offset # ns remake_clock_offsets = True seed = 12345 @@ -54,7 +64,7 @@ if __name__ == "__main__": if True: print(f"Modifying clocks upto {max_clock_offset}ns.") clock_offsets = np.zeros( N_antennas ) - if not True: # uniform + if args.dist_type == 'uniform': # uniform print("Uniform distribution") clock_offsets = max_clock_offset * (2*rng.uniform(size=N_antennas) - 1) else: # normal