From ac97c96a4168541e77649f4f94c5e8954aadbbd0 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 2 Feb 2023 19:27:01 +0100 Subject: [PATCH] ZH: more cli arguments to k-finding --- .../airshower_beacon_simulation/Makefile | 2 +- .../aa_generate_beacon.py | 4 ++-- .../ca_period_from_shower.py | 21 +++++++++++++------ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/simulations/airshower_beacon_simulation/Makefile b/simulations/airshower_beacon_simulation/Makefile index 923582c..379779c 100644 --- a/simulations/airshower_beacon_simulation/Makefile +++ b/simulations/airshower_beacon_simulation/Makefile @@ -41,7 +41,7 @@ phases: ./bd_antenna_phase_deltas.py --no-show-plots --fig-dir=${FIG_DIR} --data-dir ${DATA_DIR} findks: - ./ca_period_from_shower.py --input-fname ${INPUT_DIR} --max-k ${MAX_K} --no-show-plots --fig-dir=${FIG_DIR} --data-dir ${DATA_DIR} + ./ca_period_from_shower.py --input-fname ${INPUT_DIR} --max-k ${MAX_K} --no-show-plots --fig-dir=${FIG_DIR} --data-dir ${DATA_DIR} -l ${PB_LOW} -u ${PB_HIGH} ./cb_report_measured_antenna_time_offsets.py --no-show-plots --fig-dir=${FIG_DIR} --data-dir ${DATA_DIR} vary-fixes: diff --git a/simulations/airshower_beacon_simulation/aa_generate_beacon.py b/simulations/airshower_beacon_simulation/aa_generate_beacon.py index 2ac92a9..8fb41a6 100755 --- a/simulations/airshower_beacon_simulation/aa_generate_beacon.py +++ b/simulations/airshower_beacon_simulation/aa_generate_beacon.py @@ -282,8 +282,8 @@ if __name__ == "__main__": # Bandpass parser.add_argument('-p', '--use-passband', type=bool, default=True, help='(Default: %(default)d)') - parser.add_argument('-l', '--passband-low', type=float, default=30e-3, help='Lower frequency [GHz] of the passband filter. (set -1 for np.inf) (Default: %(default)d)') - parser.add_argument('-u', '--passband-high', type=float, default=80e-3, help='Upper frequency [GHz] of the passband filter. (set -1 for np.inf) (Default: %(default)d)') + parser.add_argument('-l', '--passband-low', type=float, default=30e-3, help='Lower frequency [GHz] of the passband filter. (set -1 for np.inf) (Default: %(default)g)') + parser.add_argument('-u', '--passband-high', type=float, default=80e-3, help='Upper frequency [GHz] of the passband filter. (set -1 for np.inf) (Default: %(default)g)') # Trace length modification parser.add_argument('-N', '--new-trace-length', type=float, help='resize airshower trace (Default: %(default)d)', default=1e4) diff --git a/simulations/airshower_beacon_simulation/ca_period_from_shower.py b/simulations/airshower_beacon_simulation/ca_period_from_shower.py index bd9ac33..30435c5 100755 --- a/simulations/airshower_beacon_simulation/ca_period_from_shower.py +++ b/simulations/airshower_beacon_simulation/ca_period_from_shower.py @@ -151,7 +151,14 @@ if __name__ == "__main__": from scriptlib import MyArgumentParser parser = MyArgumentParser(default_fig_dir="./figures/periods_from_shower_figures/") + parser.add_argument('--quick_run', action='store_true', help='Use a very coarse grid (6x6)') + parser.add_argument('--max-k', type=float, default=2, help='Maximum abs(k) allowed to be shifted. (Default: %(default)d)') + parser.add_argument('-N', '--N_runs', type=int, default=5, help='Maximum amount of iterations to grid search. (Default: %(default)d)') + + parser.add_argument('-l', '--passband-low', type=float, default=30e-3, help='Lower frequency [GHz] of the passband filter. (set -1 for np.inf) (Default: %(default)g)') + parser.add_argument('-u', '--passband-high', type=float, default=80e-3, help='Upper frequency [GHz] of the passband filter. (set -1 for np.inf) (Default: %(default)g)') + parser.add_argument('--input-fname', type=str, default=None, help='Path to mysim.sry, either directory or path. If empty it takes DATA_DIR and appends mysim.sry. (Default: %(default)s)') args = parser.parse_args() @@ -171,10 +178,13 @@ if __name__ == "__main__": allowed_ks = np.arange(-max_k, max_k+1, dtype=int) Xref = 400 - N_runs = 3 + N_runs = args.N_runs remove_beacon_from_trace = True apply_signal_window_from_max = True + low_bp = args.passband_low if args.passband_low >= 0 else np.inf # GHz + high_bp = args.passband_high if args.passband_high >= 0 else np.inf # GHz + #### fname_dir = args.data_dir antennas_fname = path.join(fname_dir, beacon.antennas_fname) @@ -207,7 +217,7 @@ if __name__ == "__main__": f_beacon = ev.antennas[0].beacon_info[freq_name]['freq'] # Prepare polarisation and passbands - rit.set_pol_and_bp(ev, low=0.03, high=0.08) + rit.set_pol_and_bp(ev, low=low_bp, high=high_bp) ## ## Manipulate time and traces of each antenna @@ -303,14 +313,13 @@ if __name__ == "__main__": scale2d = dXref*np.tan(np.deg2rad(2.)) scale4d = dXref*np.tan(np.deg2rad(4.)) - if False: #quicky - x_coarse = np.linspace(-scale2d, scale2d, 4) - y_coarse = np.linspace(-scale2d, scale2d, 4) + if args.quick_run: #quicky + x_coarse = np.linspace(-scale2d, scale2d, 6) + y_coarse = np.linspace(-scale2d, scale2d, 6) x_fine = x_coarse/4 y_fine = y_coarse/4 else: # long - N_runs = 5 x_coarse = np.linspace(-scale4d, scale4d, 40) y_coarse = np.linspace(-scale4d, scale4d, 40)