diff options
| author | shivesh <s.p.mandalia@qmul.ac.uk> | 2018-11-26 21:46:18 -0600 |
|---|---|---|
| committer | shivesh <s.p.mandalia@qmul.ac.uk> | 2018-11-26 21:46:18 -0600 |
| commit | 2a19e060fc9e982d6d4249a0e9eba0e4d6ac860d (patch) | |
| tree | 148095cdfb4e9c71728e89a632c5da69b230fb78 /contour.py | |
| parent | cc69e1c33d69a39367630a613b523bc15b38583f (diff) | |
| download | GolemFlavor-2a19e060fc9e982d6d4249a0e9eba0e4d6ac860d.tar.gz GolemFlavor-2a19e060fc9e982d6d4249a0e9eba0e4d6ac860d.zip | |
Mon 26 Nov 21:46:18 CST 2018
Diffstat (limited to 'contour.py')
| -rwxr-xr-x | contour.py | 35 |
1 files changed, 32 insertions, 3 deletions
@@ -20,7 +20,8 @@ from utils import gf as gf_utils from utils import llh as llh_utils from utils import misc as misc_utils from utils import plot as plot_utils -from utils.enums import ParamTag +from utils.enums import str_enum +from utils.enums import DataType, Likelihood, ParamTag from utils.param import Param, ParamSet, get_paramsets @@ -46,6 +47,17 @@ def nuisance_argparse(parser): help=parm.name+' to inject' ) +def process_args(args): + """Process the input args.""" + if args.likelihood is not Likelihood.GOLEMFIT \ + and args.likelihood is not Likelihood.GF_FREQ: + raise AssertionError( + 'Likelihood method {0} not supported for this ' + 'script!\nChoose either GOLEMFIT or GF_FREQ'.format( + str_enum(args.likelihood) + ) + ) + def parse_args(args=None): """Parse command line arguments""" @@ -58,6 +70,10 @@ def parse_args(args=None): help='Set the central value for the injected flavour ratio at IceCube' ) parser.add_argument( + '--run-scan', type=misc_utils.parse_bool, default='True', + help='Do the scan from scratch' + ) + parser.add_argument( '--seed', type=misc_utils.seed_parse, default='25', help='Set the random seed value' ) @@ -74,20 +90,33 @@ def parse_args(args=None): except: pass llh_utils.likelihood_argparse(parser) nuisance_argparse(parser) + misc_utils.remove_option(parser, 'sigma_ratio') if args is None: return parser.parse_args() else: return parser.parse_args(args.split()) +def gen_identifier(args): + f = '_{0}_{1}'.format(*map(str_enum, (args.likelihood, args.data))) + if args.data is not DataType.REAL: + ir1, ir2, ir3 = solve_ratio(args.injected_ratio) + f += '_INJ_{1:03d}_{2:03d}_{3:03d}'.format(ir1, ir2, ir3) + return f + + def main(): args = parse_args() + process_args(args) misc_utils.print_args(args) if args.seed is not None: np.random.seed(args.seed) asimov_paramset, llh_paramset = get_paramsets(args, define_nuisance()) - print 'asimov_paramset', asimov_paramset - print 'llh_paramset', llh_paramset + outfile = args.outfile + gen_identifier(args) + print '== {0:<25} = {1}'.format('outfile', outfile) + + if args.run_scan: + fitter = gf_utils.setup_fitter(args, asimov_paramset) print "DONE!" |
