From 6d3a983cad56bc39dab8e6dc1d048137cce29550 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 2 Feb 2023 18:09:10 +0100 Subject: [PATCH] ZH: cli optional clock seed --- simulations/airshower_beacon_simulation/Makefile | 3 ++- simulations/airshower_beacon_simulation/ab_modify_clocks.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/simulations/airshower_beacon_simulation/Makefile b/simulations/airshower_beacon_simulation/Makefile index b90d0c9..923582c 100644 --- a/simulations/airshower_beacon_simulation/Makefile +++ b/simulations/airshower_beacon_simulation/Makefile @@ -21,6 +21,7 @@ REF_ANTS ?= DATA_DIR ?= ./data INPUT_DIR ?= ./ZH_airshower/ +SEED ?= 12345 all: beacon clocks phases findks vary-fixes reconstruct @@ -31,7 +32,7 @@ beacon: ./view_beaconed_antenna.py 72 -p x -p y -p z -p n -p b --ft --no-show-plots --fig-dir=${FIG_DIR} --data-dir ${DATA_DIR} clocks: - ./ab_modify_clocks.py ${CLK_DEV} --gaussian --data-dir ${DATA_DIR} + ./ab_modify_clocks.py ${CLK_DEV} --seed ${SEED} --gaussian --data-dir ${DATA_DIR} phases: ./ba_measure_beacon_phase.py --no-show-plots --fig-dir=${FIG_DIR} --data-dir ${DATA_DIR} diff --git a/simulations/airshower_beacon_simulation/ab_modify_clocks.py b/simulations/airshower_beacon_simulation/ab_modify_clocks.py index f9e8654..1532cdd 100755 --- a/simulations/airshower_beacon_simulation/ab_modify_clocks.py +++ b/simulations/airshower_beacon_simulation/ab_modify_clocks.py @@ -23,6 +23,7 @@ if __name__ == "__main__": parser = ArgumentParser() parser.add_argument('max_clock_offset', nargs='?', type=float, default=25, help='(Default: %(default)d)') + parser.add_argument('-s', '--seed', type=int, nargs='?', default=None, help='Fix seed if supplied.') 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') @@ -34,7 +35,7 @@ if __name__ == "__main__": max_clock_offset = args.max_clock_offset # ns remake_clock_offsets = True - seed = 12345 + seed = args.seed rng = np.random.default_rng(seed) ####