ZH: cli arguments for clock modification

This commit is contained in:
Eric Teunis de Boone 2023-01-13 17:07:18 +01:00
parent 031e21636d
commit 7b18837d6d
2 changed files with 13 additions and 3 deletions

View file

@ -12,7 +12,7 @@ beacon:
./ac_show_signal_to_noise.py --no-show-plots --fig-dir=${FIG_DIR} ./ac_show_signal_to_noise.py --no-show-plots --fig-dir=${FIG_DIR}
clocks: clocks:
./ab_modify_clocks.py 15 ./ab_modify_clocks.py 15 --gaussian
phases: phases:
./ba_measure_beacon_phase.py --no-show-plots --fig-dir=${FIG_DIR} ./ba_measure_beacon_phase.py --no-show-plots --fig-dir=${FIG_DIR}

View file

@ -19,7 +19,17 @@ if __name__ == "__main__":
from os import path from os import path
import sys 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 remake_clock_offsets = True
seed = 12345 seed = 12345
@ -54,7 +64,7 @@ if __name__ == "__main__":
if True: if True:
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 not True: # uniform if args.dist_type == 'uniform': # uniform
print("Uniform distribution") print("Uniform distribution")
clock_offsets = max_clock_offset * (2*rng.uniform(size=N_antennas) - 1) clock_offsets = max_clock_offset * (2*rng.uniform(size=N_antennas) - 1)
else: # normal else: # normal