mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-12-22 03:23:34 +01:00
ZH: introduce argparse for showing plots
This commit is contained in:
parent
9af9815a31
commit
8c1eb516e8
10 changed files with 68 additions and 12 deletions
|
@ -15,7 +15,6 @@ from earsim import REvent, block_filter
|
|||
import aa_generate_beacon as beacon
|
||||
import lib
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from os import path
|
||||
import sys
|
||||
|
@ -24,10 +23,14 @@ if __name__ == "__main__":
|
|||
if os.name == 'posix' and "DISPLAY" not in os.environ:
|
||||
matplotlib.use('Agg')
|
||||
|
||||
from scriptlib import MyArgumentParser
|
||||
parser = MyArgumentParser()
|
||||
args = parser.parse_args()
|
||||
|
||||
fname = "ZH_airshower/mysim.sry"
|
||||
|
||||
fig_dir = "./figures/"
|
||||
show_plots = not False
|
||||
show_plots = args.show_plots
|
||||
|
||||
####
|
||||
fname_dir = path.dirname(fname)
|
||||
|
|
|
@ -21,14 +21,19 @@ if __name__ == "__main__":
|
|||
if os.name == 'posix' and "DISPLAY" not in os.environ:
|
||||
matplotlib.use('Agg')
|
||||
|
||||
from scriptlib import MyArgumentParser
|
||||
parser = MyArgumentParser()
|
||||
parser.add_argument('--no-use-AxB', dest='use_AxB_trace', action='store_false')
|
||||
args = parser.parse_args()
|
||||
|
||||
f_beacon_band = (49e-3,55e-3) #GHz
|
||||
allow_frequency_fitting = False
|
||||
read_frequency_from_file = True
|
||||
|
||||
use_AxB_trace = True if len(sys.argv) < 2 else bool(int(sys.argv[1]))
|
||||
use_AxB_trace = args.use_AxB_trace
|
||||
use_beacon_trace = True # only applicable if AxB = False
|
||||
|
||||
show_plots = True
|
||||
show_plots = args.show_plots
|
||||
|
||||
fname = "ZH_airshower/mysim.sry"
|
||||
|
||||
|
|
|
@ -18,9 +18,13 @@ if __name__ == "__main__":
|
|||
if os.name == 'posix' and "DISPLAY" not in os.environ:
|
||||
matplotlib.use('Agg')
|
||||
|
||||
from scriptlib import MyArgumentParser
|
||||
parser = MyArgumentParser()
|
||||
args = parser.parse_args()
|
||||
|
||||
fname = "ZH_airshower/mysim.sry"
|
||||
c_light = lib.c_light
|
||||
show_plots = True
|
||||
show_plots = args.show_plots
|
||||
|
||||
remove_absolute_phase_offset_first_antenna = True # takes precedence
|
||||
remove_absolute_phase_offset_minimum = True
|
||||
|
|
|
@ -19,10 +19,14 @@ if __name__ == "__main__":
|
|||
if os.name == 'posix' and "DISPLAY" not in os.environ:
|
||||
matplotlib.use('Agg')
|
||||
|
||||
from scriptlib import MyArgumentParser
|
||||
parser = MyArgumentParser()
|
||||
args = parser.parse_args()
|
||||
|
||||
fname = "ZH_airshower/mysim.sry"
|
||||
c_light = 3e8*1e-9
|
||||
show_plots = True
|
||||
ref_ant_id = None if not True else [50] # leave None for all baselines
|
||||
show_plots = args.show_plots
|
||||
ref_ant_id = None if True else [50] # leave None for all baselines
|
||||
|
||||
####
|
||||
fname_dir = path.dirname(fname)
|
||||
|
|
|
@ -21,9 +21,13 @@ if __name__ == "__main__":
|
|||
if os.name == 'posix' and "DISPLAY" not in os.environ:
|
||||
matplotlib.use('Agg')
|
||||
|
||||
from scriptlib import MyArgumentParser
|
||||
parser = MyArgumentParser()
|
||||
args = parser.parse_args()
|
||||
|
||||
fname = "ZH_airshower/mysim.sry"
|
||||
|
||||
show_plots = True
|
||||
show_plots = args.show_plots
|
||||
ref_ant_id = None # leave None for all baselines
|
||||
|
||||
####
|
||||
|
|
|
@ -149,11 +149,15 @@ if __name__ == "__main__":
|
|||
|
||||
atm = AtmoCal()
|
||||
|
||||
from scriptlib import MyArgumentParser
|
||||
parser = MyArgumentParser()
|
||||
args = parser.parse_args()
|
||||
|
||||
fname = "ZH_airshower/mysim.sry"
|
||||
|
||||
fig_dir = "./figures/periods_from_shower_figures/"
|
||||
fig_subdir = path.join(fig_dir, 'shifts/')
|
||||
show_plots = False
|
||||
show_plots = args.show_plots
|
||||
|
||||
allowed_ks = [ -2, -1, 0, 1, 2]
|
||||
Xref = 400
|
||||
|
|
|
@ -18,10 +18,14 @@ if __name__ == "__main__":
|
|||
if os.name == 'posix' and "DISPLAY" not in os.environ:
|
||||
matplotlib.use('Agg')
|
||||
|
||||
from scriptlib import MyArgumentParser
|
||||
parser = MyArgumentParser()
|
||||
args = parser.parse_args()
|
||||
|
||||
fname = "ZH_airshower/mysim.sry"
|
||||
|
||||
fig_dir = "./figures" # set None to disable saving
|
||||
show_plots = not False
|
||||
show_plots = args.show_plots
|
||||
|
||||
####
|
||||
fname_dir = path.dirname(fname)
|
||||
|
|
|
@ -28,11 +28,15 @@ if __name__ == "__main__":
|
|||
|
||||
atm = AtmoCal()
|
||||
|
||||
from scriptlib import MyArgumentParser
|
||||
parser = MyArgumentParser()
|
||||
args = parser.parse_args()
|
||||
|
||||
fname = "ZH_airshower/mysim.sry"
|
||||
|
||||
fig_dir = "./figures/"
|
||||
fig_subdir = path.join(fig_dir, 'reconstruction')
|
||||
show_plots = False
|
||||
show_plots = args.show_plots
|
||||
|
||||
####
|
||||
fname_dir = path.dirname(fname)
|
||||
|
|
|
@ -24,10 +24,14 @@ if __name__ == "__main__":
|
|||
if os.name == 'posix' and "DISPLAY" not in os.environ:
|
||||
matplotlib.use('Agg')
|
||||
|
||||
from scriptlib import MyArgumentParser
|
||||
parser = MyArgumentParser()
|
||||
args = parser.parse_args()
|
||||
|
||||
fname = "ZH_airshower/mysim.sry"
|
||||
|
||||
fig_dir = "./figures/"
|
||||
show_plots = False
|
||||
show_plots = args.show_plots
|
||||
|
||||
####
|
||||
fname_dir = path.dirname(fname)
|
||||
|
|
20
simulations/airshower_beacon_simulation/scriptlib.py
Normal file
20
simulations/airshower_beacon_simulation/scriptlib.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
"""
|
||||
Some preconfigured ArgumentParser
|
||||
"""
|
||||
|
||||
from argparse import ArgumentParser
|
||||
|
||||
def MyArgumentParser(default_show_plots=False, **kwargs):
|
||||
"""
|
||||
A somewhat preconfigured ArgumentParser
|
||||
|
||||
Set show_plots=True to by default enable showing plots.
|
||||
"""
|
||||
parser = ArgumentParser(**kwargs)
|
||||
|
||||
# Whether to show plots
|
||||
parser.add_argument('--show-plots', action='store_true')
|
||||
parser.add_argument('--no-show-plots', dest='show-plots', action='store_false')
|
||||
parser.set_defaults(show_plots=default_show_plots)
|
||||
|
||||
return parser
|
Loading…
Reference in a new issue