ZH: CLI args for baseline phase determination

This commit is contained in:
Eric Teunis de Boone 2023-02-02 14:57:55 +01:00
parent 040f27bd78
commit ad7a62604b
2 changed files with 12 additions and 6 deletions

View file

@ -1,6 +1,5 @@
.PHONY: all .PHONY: all
FIG_DIR := ./figures FIG_DIR := ./figures
-include config.mk -include config.mk
@ -18,6 +17,7 @@ BEAC_DECAY ?= 0
PB_LOW ?= 0.03 PB_LOW ?= 0.03
PB_HIGH ?= 0.08 PB_HIGH ?= 0.08
REF_ANTS ?=
all: beacon clocks phases findks vary-fixes reconstruct all: beacon clocks phases findks vary-fixes reconstruct
@ -33,7 +33,7 @@ clocks:
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}
./bb_measure_clock_phase.py --no-show-plots --fig-dir=${FIG_DIR} ./bb_measure_clock_phase.py --no-show-plots --fig-dir=${FIG_DIR}
./bc_baseline_phase_deltas.py --no-show-plots --fig-dir=${FIG_DIR} ./bc_baseline_phase_deltas.py ${REF_ANTS} --no-show-plots --fig-dir=${FIG_DIR}
./bd_antenna_phase_deltas.py --no-show-plots --fig-dir=${FIG_DIR} ./bd_antenna_phase_deltas.py --no-show-plots --fig-dir=${FIG_DIR}
findks: findks:

View file

@ -21,13 +21,14 @@ if __name__ == "__main__":
from scriptlib import MyArgumentParser from scriptlib import MyArgumentParser
parser = MyArgumentParser() parser = MyArgumentParser()
parser.add_argument('ref_ant_idx', default=None, nargs='*', type=int, help='Reference Antenna Indices for Baselines(ref_ant_idx, *). Leave empty to use all available antennas. (Default: %(default)s) ')
args = parser.parse_args() args = parser.parse_args()
fname = "ZH_airshower/mysim.sry" fname = "ZH_airshower/mysim.sry"
figsize = (12,8) figsize = (12,8)
c_light = 3e8*1e-9 c_light = 3e8*1e-9
show_plots = args.show_plots show_plots = args.show_plots
ref_ant_id = None if True else [50] # leave None for all baselines ref_ant_id = args.ref_ant_idx # leave None for all baselines
#### ####
fname_dir = path.dirname(fname) fname_dir = path.dirname(fname)
@ -44,14 +45,15 @@ if __name__ == "__main__":
f_beacon, tx, antennas = beacon.read_beacon_hdf5(antennas_fname) f_beacon, tx, antennas = beacon.read_beacon_hdf5(antennas_fname)
# run over all baselines # run over all baselines
if ref_ant_id is None: if not ref_ant_id:
print("Doing all baselines") print("Doing all baselines")
baselines = list(combinations(antennas,2)) baselines = combinations(antennas,2)
# use ref_ant # use ref_ant
else: else:
ref_ants = [antennas[i] for i in ref_ant_id] ref_ants = [antennas[i] for i in ref_ant_id]
print("Doing all baselines with {}".format([int(a.name) for a in ref_ants])) print("Doing all baselines with {}".format([int(a.name) for a in ref_ants]))
baselines = list(product(ref_ants, antennas)) baselines = product(ref_ants, antennas)
# For now, only one beacon_frequency is supported # For now, only one beacon_frequency is supported
freq_names = antennas[0].beacon_info.keys() freq_names = antennas[0].beacon_info.keys()
@ -60,7 +62,11 @@ if __name__ == "__main__":
freq_name = next(iter(freq_names)) freq_name = next(iter(freq_names))
# Collect baselines from optional generators
baselines = list(baselines)
# Get phase difference per baseline # Get phase difference per baseline
phase_diffs = np.empty( (len(baselines), 2) ) phase_diffs = np.empty( (len(baselines), 2) )
for i, base in enumerate(baselines): for i, base in enumerate(baselines):
if i%1000==0: if i%1000==0: