From bea540a7220d7db3dffa2260e40681eb1325e61a Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 9 Feb 2023 13:53:10 +0100 Subject: [PATCH] ZH: read clocks from clocks_fname if exists and argument is True --- .../airshower_beacon_simulation/ab_modify_clocks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/simulations/airshower_beacon_simulation/ab_modify_clocks.py b/simulations/airshower_beacon_simulation/ab_modify_clocks.py index 1532cdd..eedf05f 100755 --- a/simulations/airshower_beacon_simulation/ab_modify_clocks.py +++ b/simulations/airshower_beacon_simulation/ab_modify_clocks.py @@ -26,6 +26,7 @@ if __name__ == "__main__": 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.add_argument('-r','--read-clocks-file', action='store_true', dest='read_clocks_file') parser.set_defaults(dist_type='gauss') parser.add_argument('--data-dir', type=str, default="./data", help='Path to Data Directory. (Default: %(default)s)') @@ -62,7 +63,11 @@ if __name__ == "__main__": N_antennas = len(group.keys()) - if True: + if args.read_clocks_file and path.isfile(clocks_fname): # read clock deviations from file + print(f"Reading clocks from {clocks_fname}.") + clock_offsets = np.loadtxt(clocks_fname) + + elif True: # random clock deviations print(f"Modifying clocks upto {max_clock_offset}ns.") clock_offsets = np.zeros( N_antennas ) if args.dist_type == 'uniform': # uniform