ZH: read clocks from clocks_fname if exists and argument is True

This commit is contained in:
Eric Teunis de Boone 2023-02-09 13:53:10 +01:00
parent a478a27079
commit bea540a722

View file

@ -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('-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('--uniform', action='store_const', const='uniform', dest='dist_type')
parser.add_argument('--gaussian', action='store_const', const='gauss', 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.set_defaults(dist_type='gauss')
parser.add_argument('--data-dir', type=str, default="./data", help='Path to Data Directory. (Default: %(default)s)') 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()) 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.") print(f"Modifying clocks upto {max_clock_offset}ns.")
clock_offsets = np.zeros( N_antennas ) clock_offsets = np.zeros( N_antennas )
if args.dist_type == 'uniform': # uniform if args.dist_type == 'uniform': # uniform